[cairo] Windows GTK+ 2.24.10: Cairo contexts not rendering to surface

LRN lrn1986 at gmail.com
Mon Jan 23 19:00:46 UTC 2017


On 23.01.2017 21:17, Jeffrey Sheen wrote:
> On 23.01.2017 1:41, Jeffrey Sheen wrote:
>> On 22 Jan 2017 21:28, "LRN" wrote:
>>> On 22.01.2017 23:24, Jeffrey Sheen wrote:
>>>> Dear list,
>>>>
>>>> I'm trying to incorporate Cairo rendering into a cross-platform project.
>>>> Windows XP is a target platform for the project, so I am building against the
>>>> GTK+ 2.24.10 Bundle (20120208). N.B. This is a C/C++ implementation.
>>>>
>>>> The problem I'm having is that no Cairo backend contexts are rendering pixels
>>>> to their surfaces.
>>>>
>>>> I've tried the examples on the Zetcode guides for a PNG image surface and GTK
>>>> Window: http://zetcode.com/gfx/cairo/cairobackends/ 
>>> 
>>> These are for GTK3, i think. For GTK2 you need to do something like this:
>>> 
>>> ...
>>>   g_signal_connect(G_OBJECT(darea), "expose-event",
>>>       G_CALLBACK(on_expose_event), NULL);
>>> ...
>>> 
>>> static gboolean
>>> on_expose_event (GtkWidget      *widget,
>>>                  GdkEventExpose *event,
>>>                  gpointer        data)
>>> {
>>>   cairo_t *cr;
>>> 
>>>   cr = gdk_cairo_create (gtk_widget_get_window (widget));
>>> 
>>>   do_drawing (cr);
>>> 
>>>   cairo_destroy (cr);
>>> 
>>>   return FALSE;
>>> }
>> 
>> 
>> Thanks. I'll try the suggested syntax for the GDK Window example, and find an earlier API reference.
>> 
>> However, I have also tried rendering with an image context, and the resulting PNG was blank too.
>> 
>> Is it possible that I'm having the same issue here (the API has changed, but for Cairo specifically)?
>> 
>> What I'll do is build against the very latest stable GTK libs, to check whether the code functions as expected in the reference examples (i.e. pixels are rendered).
>> 
>> Then, given Windows XP is a target platform, what is the latest version of the Cairo libs that I can build against? N.B. I'm using Cairo in combination with Pango for image surface rendering only.
> 
> 
> An update:
> 
> I implemented LRN's GTK+ 2 alterations to the Zetcode example (see
> also http://stackoverflow.com/questions/21102622/how-to-create-a-cairo-t-on-a-gtk-2-window).
> I compiled against the same GTK+ 2 bundle as before, and rendering to the
> widget worked.
> 
> I then dropped in this code fragment into the example project to test image
> surface rendering:
> This also worked, outputting the expected PNG file.
> 
> However, this same code fragment generates a blank PNG file in my main project.
> I have the same GTK-related parameters in both VS projects' settings (as per
> http://stackoverflow.com/questions/15906580/how-to-configure-gtk-on-visual-studio-2010).
> 
> The only difference in output when building each is that I get a dozen linker
> warnings for my main project, all of the form:
> 
>     1>gdk-win32-2.0.lib(libgdk-win32-2.0-0.dll) : warning LNK4006:
>     __NULL_IMPORT_DESCRIPTOR already defined in
>     gtk-win32-2.0.lib(libgtk-win32-2.0-0.dll); second definition ignored
>     1>gdk-win32-2.0.lib(libgdk-win32-2.0-0.dll) : warning LNK4221: This object
>     file does not define any previously undefined public symbols, so it will
>     not be used by any link operation that consumes this library
> 
> I'd appreciate any advice.
> 

I would suggest asking GTK+ people (specifically - GTK+ MSVS people on the gtk
mailing list[1]).

[1] gtk-list at gnome.org

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x6759BA74.asc
Type: application/pgp-keys
Size: 3482 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20170123/d502de89/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.cairographics.org/archives/cairo/attachments/20170123/d502de89/attachment.sig>


More information about the cairo mailing list