DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2873
Version: 1.3-current
The docs for the Fl_JPEG_Image ctor says:
> There is no error function in this class.
> If the image has loaded correctly,
> w(), h(), and d() should return values greater zero. <--
However, I just did a test using the attached (foo.cxx);
if the jpg file doesn't exist, d() should return zero but it does not.
(in my test, it returns 3)
Logging this as a bug, since it disagrees with the docs.
FWIW, testing w() & h() for zero works.
Suggest that if the file can't be opened, the code explicitly
sets w()/h()/d() to zero to comply with the docs, and not rely
on the subclass ctors to zero these out.
Also suggest testing other image types (PNG, BMP, etc)
Link: http://www.fltk.org/str.php?L2873
Version: 1.3-current#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_Box.H>
#include <FL/fl_ask.H> // fl_alert()
#include <errno.h> // strerror()
int main() {
fl_register_images(); // initialize image lib
Fl_Window win(720,486); // make a window
Fl_Box box(10,10,720-20,486-20); // widget that will contain
image
const char *filename = "/var/tmp/foo.jpg"; // load jpeg image into ram
Fl_JPEG_Image jpg(filename); // load jpeg image into ram
if ( jpg.d() == 0 ) // should be zero if file
doesn't exist
{ fl_alert("%s: %s", filename, strerror(errno)); }
box.image(jpg); // attach jpg image to box
win.show();
return(Fl::run());
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs