Preserve per-layer document timelines

This commit is contained in:
2026-06-01 13:05:14 +02:00
parent c16cab87bd
commit 10e5d5b5ae
8 changed files with 182 additions and 35 deletions

View File

@@ -25,16 +25,17 @@ struct DocumentConfig {
std::uint32_t layer_count = 1;
};
struct AnimationFrame {
std::uint32_t duration_ms = 100;
};
struct Layer {
std::string name;
bool visible = true;
bool alpha_locked = false;
float opacity = 1.0F;
pp::paint::BlendMode blend_mode = pp::paint::BlendMode::normal;
};
struct AnimationFrame {
std::uint32_t duration_ms = 100;
std::vector<AnimationFrame> frames;
};
struct DocumentLayerConfig {
@@ -43,6 +44,7 @@ struct DocumentLayerConfig {
bool alpha_locked = false;
float opacity = 1.0F;
pp::paint::BlendMode blend_mode = pp::paint::BlendMode::normal;
std::span<const AnimationFrame> frames;
};
struct DocumentSnapshotConfig {
@@ -62,6 +64,7 @@ public:
[[nodiscard]] std::size_t active_layer_index() const noexcept;
[[nodiscard]] std::size_t active_frame_index() const noexcept;
[[nodiscard]] std::uint64_t animation_duration_ms() const noexcept;
[[nodiscard]] pp::foundation::Result<std::uint64_t> layer_animation_duration_ms(std::size_t index) const noexcept;
[[nodiscard]] std::span<const Layer> layers() const noexcept;
[[nodiscard]] std::span<const AnimationFrame> frames() const noexcept;