On 13.07.2012, at 01:28, Greg Ercolano wrote:

>       I added a little example to the cheat page to show how to use 
> Fl_PNG_Image
>       to output PNG pixel data in C/C++ readable hex format:
> 
>       http://seriss.com/people/erco/fltk/#Fl_PNG_Hex_Dump
> 
>       I find it often useful to 'inline' PNG files into apps for the same 
> reason
>       .pixmaps are useful, only PNGs are great in that they handle 8bit alpha,
>       useful for smooth overlays.
> 
>       I always find it a nuisance to have to look around for ways to get a 
> hexdump
>       of pixel data, so having this kinda saves the trouble.
> 
>       Can probably be easily modified to support all the FLTK image formats,
>       but I almost always find myself working with PNGs when it comes to 
> images
>       containing transparency.

Starting with FLTK 1.3 (svn?), Fluid has a new type that allows to store 
arbitrary files as binary data in "C" source code. It's in "New -> Code -> 
Binary Data". Enter any filename, and a binary dump will appear in the source 
code. By assigning a variable name, the data can then be read using 

 Fl_PNG_Image *img = new Fl_PNG_Image("someName", myBinaryData, 
sizeof(myBinaryData));

This is also supported for Fl_JPEG_Image.



_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to