You can get an Fl_RGB_Image object from a .png file with: https://www.fltk.org/doc-1.3/classFl__PNG__Image.html#a64b3f34f7b97784763802e39e2db3fc2 and similarly with .jpeg: https://www.fltk.org/doc-1.3/classFl__JPEG__Image.html#a8a12107808d6e86cd82b7bede8637aeb and .bmp: https://www.fltk.org/doc-1.3/classFl__BMP__Image.html#a1abb2ebb6ca113fd03a967b66624c868
In all these cases, the resulting Fl_RGB_Image object, supposing you call it img, will tell you
if its RGB (img->d() == 3) or RGBA (img->d() == 4)and its width (img->w()) and height (img->h()). In some cases, the row length is bigger than img->w()*img->d(). In that case img->ld() is != 0 and gives that length. Finally, you get the address of the first byte of the RGB or RGBA data by img->array of type const unsigned char *. That should put you in the position to build a texture.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/87f4fbe3-1ed2-4b80-a974-4a39dab90c26n%40googlegroups.com.
[ Direct Link to Message ] |