[cairo] surface_create and pnm

Gadi Dor gadido30 at gmail.com
Tue Dec 25 02:36:18 PST 2012


Hi All,

I have some code that read .pnm file with fgets and had it into buffer, Can
I change it to read my desktop:

  if(argc>1) {
    in=fopen(argv[1],"rb");
    if(!in) {
      printf("Couldn't find file %s.\n",argv[1]);
      exit(1);
    }
fgets(buffer,1024,in);
  if(strncmp(buffer,"P6",2)) {
    printf("Not a ppm.\n");
    exit(2);

I want to use this code and had it into buffer:

cairo_surface_write_to_png(cairo_xlib_surface_create(dpy,
								    DefaultRootWindow(dpy), DefaultVisual(dpy, DefaultScreen(dpy)),
								    400, 400), /* a lie */
					  "out.png")

any idea please?

Best Regards
Gadi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20121225/4bd481ec/attachment.html>


More information about the cairo mailing list