mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +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:
parent
eec99b23a0
commit
d22bb92764
Notes:
sideshowbarker
2024-07-19 06:49:23 +09:00
Author: https://github.com/peterdn
Commit: d22bb92764
Pull-request: https://github.com/SerenityOS/serenity/pull/2158
Reviewed-by: https://github.com/awesomekling
5 changed files with 71 additions and 2 deletions
|
@ -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 {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue