ui::AnimatedImage¶
Header: winui/render/Bitmap.hpp.
An animated picture: a decoded animated GIF. The frames are already composited, each the whole picture as it should look at that point (the GIF's frame offsets, disposal and transparency applied), so a player only ever shows one of them.
A frame delay under 20 ms is shown for 100 ms, because tools write 0 or 1 hundredths and expect browsers to play it at 10 fps. loop_count is how many times the whole sequence plays, as the GIF's loop block says: 1 when it has none, 0 for forever.
Example:
ui::AnimatedImage spinner = ui::AnimatedImage::read("spinner.gif");
spinner.auto_play = false; // show the first frame until play() is called
window.set_content(ui::Image{.source = std::move(spinner)});
frames¶
Fully composited frames, all the same size.
delays¶
Display time of each frame; one per frame.
loop_count¶
Plays of the whole sequence; 0 loops forever.
auto_play¶
Whether an Image starts playing this the moment it is given it. Off, the first frame shows until something calls play().
empty¶
True with no frames, or an empty first frame.
animated¶
True with more than one frame.
width¶
The first frame's width in pixels; 0 with no frames.
height¶
The first frame's height in pixels; 0 with no frames.
decode¶
Every frame of an animated GIF on every platform; any other format Bitmap::decode() reads comes back as its one frame. Throws std::runtime_error if it can't be decoded.
read¶
decode() of the file at path.