On 09/20/12 13:26, Herman wrote:
> Hmm, I usually use
>
> Fl_JPEG_Image* o=new Fl_JPEG_Image(file);
> if (o && o->w() && o->h())
> {/*loaded successfully*/}
> else {/*some error occured*/}
>
> It never failed so far on all the platforms I tested (Win/Linux/Mac).
>
> So I don't really see why to add anything to the library, since it works
> just fine like that, but ...
Right -- the only reason I'd suggest adding to the API is to
get more specific errors from the image class, so one can tell
the difference between a file access issue, or if the file itself
is readable but corrupt.
Most of the underlying image libs provide useful error messages
that the app can't see currently due to the class being somewhat
opaque.. messages like "Invalid number of colors in palette"
or "Invalid bit depth" or "Invalid header".. things that would
clearly indicate there are problems with the file itself,
vs. issues with file access.
Perhaps the simplest is two methods: fail() and fail_msg(),
the first returning a failure indication, and the second
an error message.
Or perhaps it could just be one method: "fail()",
which returns NULL if there's no error, or a string if there was
indicating the actual error message (including filename+OS error
in the case of an access issue, or the filename+img lib error
if the file was corrupt)
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk