RSS/Atom feed Twitter
Site is read-only, email is disabled

Draw gegl image to cairo surface?

This discussion is connected to the gegl-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

Draw gegl image to cairo surface? Stuart Axon 15 May 01:41
  Draw gegl image to cairo surface? Martin Nordholts 15 May 13:05
Stuart Axon
2010-05-15 01:41:45 UTC (almost 15 years ago)

Draw gegl image to cairo surface?

Hi,
I read somewhere that gegl can wrap a cairo surface....

Any idea how in python/vala/c#/some high level language I can use gegl to load an image, and draw on the cairo surface ?

S++

Martin Nordholts
2010-05-15 13:05:43 UTC (almost 15 years ago)

Draw gegl image to cairo surface?

On 05/15/2010 01:41 AM, Stuart Axon wrote:

Hi,
I read somewhere that gegl can wrap a cairo surface....

Any idea how in python/vala/c#/some high level language I can use gegl to load an image, and draw on the cairo surface ?

This is how you'd do it in C, so now you just has to make sure you can do the same with some binding:

#include #include

int main (int argc, char **argv) {
GeglNode *load;
GeglRectangle size;
cairo_surface_t *image;

gegl_init (&argc, &argv);

load = gegl_node_new (); gegl_node_set (load,
"operation", "gegl:load", "path", "/tmp/test.png", NULL);

size = gegl_node_get_bounding_box (load); image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, size.width, size.height);

gegl_node_blit (load, 1.0 /*scale*/,
&size,
babl_format ("R'G'B'A u8"), cairo_image_surface_get_data (image), GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);

cairo_surface_write_to_png (image, "/tmp/output.png");

return 0; }

/ Martin