Skip to main content

euv_core/media/gif/
enum.rs

1use super::*;
2
3/// GIF89a Graphic Control Extension disposal method applied after a frame finishes displaying.
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
5pub enum GifDisposalMethod {
6    /// Disposal method `0`: no disposal specified (leave canvas intact).
7    #[default]
8    Unspecified,
9    /// Disposal method `1`: do not dispose (preserve drawn pixels for subsequent frames).
10    Keep,
11    /// Disposal method `2`: restore the frame's sub-rectangle to transparent background `[0, 0, 0, 0]`.
12    RestoreToBackground,
13    /// Disposal method `3`: restore the canvas to its state immediately before this frame was composited.
14    RestoreToPrevious,
15}
16
17/// Playback resume strategy applied when an off-screen paused GIF becomes visible again.
18#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
19pub enum GifVisibilityPolicy {
20    /// Pause pre-decoding and timeline while off-screen and resume from the current frame when visible.
21    #[default]
22    PauseAndResumeFromCurrent,
23    /// Pause while off-screen and restart cleanly from frame `0` upon becoming visible again.
24    PauseAndRestart,
25}
26
27/// Operational status of a streaming `GifStreamPlayer`.
28#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
29pub enum GifPlaybackStatus {
30    /// Decoded header and frame index ready at frame `0`.
31    #[default]
32    Ready,
33    /// Actively advancing frames on screen.
34    Playing,
35    /// Suspended because the viewport is currently off-screen (zero decode or timer work).
36    PausedOffscreen,
37    /// Finite Netscape loop count completed.
38    Ended,
39    /// Encountered a corrupt frame or budget violation (never fakes valid output).
40    Corrupt,
41}