Can I somehow blit a part of a PNG file in the expose event in GTK2? I can load the PNG in a Pixbuf and use Cairo to use the Pixbuf as a brush, but I dont know how I can only use, lets say, the rectangle (1,1,10,10)
of the PNG as a brush. Can someone point me in the right direction?
cairo_image_surface_create_from_png
is a good way to create a Cairo-centric PNG surface. You could then use cairo_surface_create_for_rectangle
to restrict the size of the cairo_surface_t
. Then you use cairo_set_source_surface
to use your surface returned from create_for_rectangle
as a source or brush.