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

LRN lrn1986 at gmail.com
Sun Jan 22 21:28:13 UTC 2017


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;
}


-- 
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/140503a9/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/140503a9/attachment.sig>


More information about the cairo mailing list