Re: surface_create and pnm

Simon Sapin <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Le 25/12/2012 11:36, Gadi Dor a écrit :
> I have some code that read .pnm file with fgets and had it into buffer,

Hi,

I’d say the easy way would be to use pnmtopng or a similar tool, then 
use cairo_image_surface_create_from_png() or 
cairo_image_surface_create_from_png_stream().

A (maybe) more efficient way would be to parse the source image with 
libnetpbm, create a cairo image surface of the right size, then copy the 
pixels to a buffer returned by cairo_image_surface_get_data() while 
converting them to cairo’s native-endian ARGB32 format.

Cheers,
-- 
Simon Sapin
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.