Non-animated GIF handling less than ideal
fire-eggs opened this issue · comments
Still finding this code to be extremely useful.
I've used the patch which changes fl_images_core.cxx
, in fl_check_images
, so that GIF files are loaded as Fl_Anim_GIF_Image
instances.
But this leads to the following convolution when it comes time to draw, in order to handle non-animated GIFs:
if (animgif_->is_animated())
{
animgif_->draw(xoff, yoff, xsize, ysize);
}
else
{
animgif_->Fl_Pixmap::draw(xoff, yoff, xsize, ysize);
}
It "works" but requires "knowing" that Fl_Anim_GIF_Image
is derived from Fl_Pixmap
!
I'd prefer that animgif_->draw()
would work for both animated and still GIFs. I'm not smart enough yet to quite understand the implications of this comment in the Fl_Anim_GIF_Image
code:
// Note: should the base class be called here?
// If it is, then the copy() method must also
// copy the base image!
// Inherited::draw(x_, y_, w_, h_, cx_, cy_);
Advice, fixes appreciated.
Hm, its a long time since I was active in this project...
Could you please give me a complete example code, so that I can see clearer, what your issue is?
Trying to create a sample program, I'm reminded about how much I've learned over the last few months.
This particular section of code is, in fact, dealing with the rare case that Fl_Anim_GIF_Image has failed to load a valid GIF file, in which case I've used Fl_GIF_Image as a fallback. The bug here is that Fl_GIF_Image fails to draw correctly. Not your bug!
Closing this issue and submitting an issue for the animated GIF file that Fl_Anim_GIF_Image fails to load.