| """Studio: orchestration shell for animation development. |
| |
| The Studio class is a thin convenience facade. It holds no direct reference to |
| model code; every pixel mutation routes through pixel_cursor.PixelCursor.write_*. |
| Enable a backend by importing its adapter (e.g. studio.backends.motionclone) — |
| the adapter self-registers with pixel_cursor.ops.register_backend. |
| """ |
| from __future__ import annotations |
| from dataclasses import dataclass |
| from typing import Iterable, Optional |
|
|
| from pixel_cursor import ( |
| PixelCursor, |
| open_cursor, |
| Image, |
| FrameStack, |
| AnimationSegment, |
| load_image, |
| ) |
|
|
|
|
| @dataclass |
| class Studio: |
| cursor: Optional[PixelCursor] = None |
|
|
| def load(self, image_path: str) -> "Studio": |
| img = load_image(image_path) |
| self.cursor = open_cursor(img) |
| return self |
|
|
| def with_cursor(self, cursor: PixelCursor) -> "Studio": |
| self.cursor = cursor |
| return self |
|
|
| def compile_24fps_from_keyframes( |
| self, |
| keyframe_cursors: Iterable[PixelCursor], |
| segments: Iterable[AnimationSegment], |
| ) -> FrameStack: |
| from .compile_24fps import compile_keyframes |
|
|
| return compile_keyframes(keyframe_cursors, segments) |
|
|
|
|
| __all__ = ["Studio"] |
|
|