-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Kitty graphics: Implement animation support (a=f, a=a, a=c) #5713
Copy link
Copy link
Open
Labels
area/addon/imagetype/enhancementFeatures or improvements to existing featuresFeatures or improvements to existing features
Description
Context
The Kitty graphics protocol supports animated images through three actions: a=f (frame operations), a=a (animation control), and a=c (frame composition). None of these are implemented — they all return EINVAL:unsupported action. The related animation keys (frame number, gap, blend mode, etc.) are also not parsed.
What needs to happen
-
Parse animation keys in
KittyGraphicsTypes.ts:- Add to
KittyKeyenum andIKittyCommand:- Frame-related: frame number, source frame for copy, gap (ms between frames), blend mode, composition mode, background frame
- Reference: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference
- Add to
-
Implement
a=f(frame operations):- Load a new frame into an existing image
- Edit an existing frame's data
- Delete specific frames
- Each frame has its own pixel data, gap timing, blend/composition mode
-
Implement
a=a(animation control):- Start/stop animation playback
- Set number of loops
- Jump to a specific frame
- Set default gap timing
-
Implement
a=c(frame composition):- Compose/blend one frame onto another
- Support composition modes: overwrite, alpha blend, etc.
-
Animation rendering loop:
- Timer-based frame advancement using per-frame gap values
- Re-render the image placement each time the active frame changes
- Respect loop count
-
Wire up delete selector
f/F(delete animation frames) — currently listed as unsupported in_handleDelete(), depends on this work
Spec reference
https://sw.kovidgoyal.net/kitty/graphics-protocol/#animation
Key files
addons/addon-image/src/kitty/KittyGraphicsTypes.ts— add animation key parsingaddons/addon-image/src/kitty/KittyGraphicsHandler.ts— TODOs at lines 329 and 363 fora=f,a=a,a=caddons/addon-image/src/kitty/KittyImageStorage.ts— needs per-image frame storageaddons/addon-image/src/ImageRenderer.ts— needs timer-driven re-rendering for animationaddons/addon-image/test/KittyGraphics.test.ts— TODO at line 108 for animation frame tests
Acceptance criteria
a=f,i=3loads a new animation frame into image 3a=a,i=3,s=1starts animation playback for image 3a=a,i=3,s=3stops animation playback- Frame gap timing controls the speed of animation
- Blend modes (alpha blend, overwrite) work correctly between frames
a=c,i=3composes frames togetherd=fdeletes animation frames- Integration tests with animated image sequences
Discussion
See feature inventory §2.6–2.8, §13 in #5683
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/addon/imagetype/enhancementFeatures or improvements to existing featuresFeatures or improvements to existing features