Documentation
¶
Index ¶
Constants ¶
const DefaultKittyID = 43
Variables ¶
This section is empty.
Functions ¶
func IsPictureMsg ¶
IsPictureMsg reports whether msg is a picture-owned async update.
Types ¶
type Config ¶
type Config struct {
KittyID int // default 43
Background color.Color // default color.Transparent (no compositing)
}
Config configures a Model at construction.
type KittyFrameMsg ¶
type KittyFrameMsg struct {
ID int
Seq uint64
APC string
Grid string
// contains filtered or unexported fields
}
KittyFrameMsg carries the result of building a Kitty APC payload + grid for a specific generation of the Model. Update() ignores frames whose modelID (a per-Model atomic counter, unforgeable from outside the package) does not match the receiving Model's, or whose Seq does not match the Model's current seq (image/size/mode changed since dispatch). The modelID check is what prevents cross-talk when multiple Models share a tea.Program — every msg is forwarded to every Model — even if they happen to share a Kitty image ID.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model renders an image.Image as half-blocks or Kitty graphics inside a Bubble Tea program. The Model has no notion of where images come from; callers feed it via SetImage. For URL-driven fetching, see pictureurl.
func NewWithConfig ¶
NewWithConfig returns a Model with the supplied Config. Zero/nil fields are filled with defaults.
func (*Model) SetImage ¶
SetImage sets the image to render. Pass nil to clear. Returns a tea.Cmd if rendering needs to be scheduled (Kitty mode), or a cleanup Cmd if Kitty was previously placed and is now being cleared, or nil otherwise.
In Kitty mode with a non-nil new image, the previous placeholder grid is preserved until the new KittyFrameMsg arrives. The grid is a pure function of (cols, rows, kittyID) — byte-identical between renders when those are stable — and the previously-resident image at kittyID stays visible until the new APC overwrites it. Clearing the grid synchronously would create a visible blank window during animation.
func (*Model) SetSize ¶
SetSize updates the rendering dimensions in terminal cells. Returns a render Cmd in Kitty mode (re-encode for the new size) or nil otherwise.
func (*Model) Toggle ¶
Toggle switches between Glyph and Kitty modes. When toggling away from Kitty after an image was placed, returns a Cmd that emits the Kitty delete sequence; otherwise returns the Cmd to render in the new mode (or nil).
func (*Model) Update ¶
Update processes the picture component's own messages. Forward every tea.Msg to it; unknown messages are ignored and return nil.
type PictureMode ¶
type PictureMode int8
PictureMode selects how images are rendered.
const ( PictureGlyph PictureMode = iota // Universal half-block ANSI PictureKitty // High-res Kitty graphics protocol )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chartpicture is a go-analyze/charts source for picture.Model.
|
Package chartpicture is a go-analyze/charts source for picture.Model. |
|
Package pictureurl is a URL-driven layer on top of picture.Model.
|
Package pictureurl is a URL-driven layer on top of picture.Model. |