Sorry I didn't follow my own post closely. Personall and local events in Montreal took most of my attention recently. ...but... back to topic!...
Thank you Edzard for the files you posted, I was going that way anyway, but your posts will save me a lot of time! I was actually thinking on binding the "screenshot" mechanism to some event, button, keys, timer or anything that would be useful in a given context. Is there a real need to have the fl_read_image() call at a specific place? or is the only important thing that drawing be finished? By the way guys, I'm reading the opengl superbible in which they read and write to TGA files (uncompressed). The format is basically one standard tga header struct, written straight with fwrite and sizeof(the struct) followed by the pixel data in RGB (8bit per component). The final image file has a size of (width*height*3 + sizeof(tga_header)). If space isn't important, this seems the simplest approach. But it does become a bit more involved if you need the image to be portable across different arch endianess, etc. This said, I will still use PNGs anyway! I used to program opengl in the oldshool days over 10 years ago and I loved the 16bit per component feature for dealing with a height field (otherwise, the heightfield has 256 steps in its slopes). Thanks a lot guys! Simon On Tue, May 15, 2012 at 5:57 AM, MacArthur, Ian (SELEX GALILEO, UK) < [email protected]> wrote: > > > protected: > > void draw() > > { > > Fl_Double_Windwo::draw(); > > if (unsigned char* pImage= fl_read_image(0, 0, 0, w(), h(), 0)) > > { > > write_png("/home/ed/temp/image.png", pImage, w(), h(), 3); > > delete[] pImage; > > } > > } > > }; > > > > When you use this window-class, it will copy every draw to "image.png". > > Yeah - I'd strongly advocate putting a control flag around that so it only > saves one screenshot, when you actually want it! > > > > SELEX Galileo Ltd > Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex > SS14 3EL > A company registered in England & Wales. Company no. 02426132 > ******************************************************************** > This email and any attachments are confidential to the intended > recipient and may also be privileged. If you are not the intended > recipient please delete it from your system and notify the sender. > You should not copy it or use it for any purpose nor disclose or > distribute its contents to any other person. > ******************************************************************** > > _______________________________________________ > fltk mailing list > [email protected] > http://lists.easysw.com/mailman/listinfo/fltk > _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

