1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

LibGfx: Add support for animated images to ImageDecoder{Plugin}

Adds methods to determine whether an image is animated, how many times
the animation loops, the number of frames, and to get individual frames.

Implements stubs of these methods for PNGImageDecoderPlugin and
GIFImageDecoderPlugin.
This commit is contained in:
Peter Nelson 2020-05-03 17:12:54 +01:00 committed by Andreas Kling
parent eec99b23a0
commit d22bb92764
5 changed files with 71 additions and 2 deletions

View file

@ -528,4 +528,28 @@ bool GIFImageDecoderPlugin::sniff()
BufferStream stream(buffer);
return decode_gif_header(stream).has_value();
}
bool GIFImageDecoderPlugin::is_animated()
{
return false;
}
size_t GIFImageDecoderPlugin::loop_count()
{
return 0;
}
size_t GIFImageDecoderPlugin::frame_count()
{
return 1;
}
ImageFrameDescriptor GIFImageDecoderPlugin::frame(size_t i)
{
if (i > 0) {
return { bitmap(), 0 };
}
return {};
}
}