pushparaj muthu wrote:
> Hi
>
> When I try to read image drawn by mouse (like paint program) by using
> API fl_read_image from current window in Linux pc (using X11)
> It throws error message "X_GetImage: BadMatch( invalid parameter
> attributes)
> x0
> Please help me
> Regards
> raj
How are you using it?
This is what I do to do a screenshot of a part of a window:
uchar *buf = fl_read_image(NULL, canvas->x(), canvas->y(), canvas->w(),
canvas->h(), 0);
Basically, I'm making a screenshot of the contents of the Fl_Group (canvas
in the code above).
All that is left is to save the contents of buf to a file. I create PPM
files:
FILE *fd = fopen(fpath, "w");
fprintf(fd, "P5\n%d %d\n255\n", fpath, canvas->w(), canvas->h());
fwrite(buf, 1, canvas->w() * canvas->h() * 3, fd);
fclose(fd);
Of course, there are dozens of libraries out there that would be better at
saving the image (which include error checking ;) ).
--
Alvin
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk