namespace Minint.Core.Models; /// /// A single document (frame) within a container. /// Has its own palette shared by all layers, plus a list of layers. /// public sealed class MinintDocument { public string Name { get; set; } /// /// Delay before showing the next frame during animation playback (ms). /// public uint FrameDelayMs { get; set; } /// /// Document palette. Index 0 is always . /// All layers reference colors by index into this list. /// public List Palette { get; } public List Layers { get; } public MinintDocument(string name) { Name = name; FrameDelayMs = 100; Palette = [RgbaColor.Transparent]; Layers = []; } /// /// Constructor for deserialization — accepts pre-built palette and layers. /// public MinintDocument(string name, uint frameDelayMs, List palette, List layers) { Name = name; FrameDelayMs = frameDelayMs; Palette = palette; Layers = layers; } /// /// Returns the number of bytes needed to store a single palette index on disk. /// public int IndexByteWidth => Palette.Count switch { <= 255 => 1, <= 65_535 => 2, <= 16_777_215 => 3, _ => 4 }; }