[Haskell-cafe] Drawing an existing image into a cairo surface?

Rafal Kolanski xs at xaph.net
Sun Sep 21 08:28:37 EDT 2008


I'm trying to, in addition to all the other things on my cairo surface,
pull some images in from .png files. I've googled, I've looked in the
docs, but there isn't any way I can see to load a .png file into a
surface. The best I can find is withImageSurfaceFromPNG, but I can't
make it work.

The C guys can do:
  image = cairo_image_surface_create_from_png("blah.png");
and then:
  cairo_set_source_surface(cr, image, 10, 10);

I tried playing around with unsafePerformIO but that just gets me into:
cairo_surface_reference: Assertion
`((*&(&surface->ref_count)->ref_count) > 0)' failed.

Are any gtk2hs people around who can throw me in the right direction?


Rafal Kolanski.

More information about the Haskell-Cafe mailing list