[cairo] how to import .BMP without other libs(GTK+ etc)?

Tor Lillqvist tml at iki.fi
Wed Feb 4 08:44:17 PST 2009

> we could do it with GTK+. However, is there some other way to import BMP or
> dib in cairo without the suppot of other libs?

Not as far as I can see.

> I had tried to do it whit cairo_image_surface_create_for_data, but failed. I could not see the right image.

Are you sure that the .bmp file you are reading actually is in a
(sub)format your code can handle? Didn't debugging (or adding
printouts...) tell you anything? There must be a lot of sample code
that reads .bmp out there, compare to the code of those... I know of
io-bmp.c in gtk+/gdk-pixbuf and GIMP's bmp-read.c.

A "throwaway" program I wrote to dump the contents of a .bmp file is
at http://pastebin.com/m6e96721e . Unfortunately it compiles as such
only on Windows.


More information about the cairo mailing list