Documentation
¶
Overview ¶
Package image prepares and renders images for terminal display.
Index ¶
- func KittySequence(pngData []byte, cols, rows int) string
- func Render(img Inline, width int) []string
- func RenderMarkers(img Inline, width int) []string
- func SetRenderingEnabled(enabled bool)
- func SupportsKittyGraphics(in, out *os.File) bool
- type Inline
- type MarkdownReference
- type Writer
- func (w *Writer) Close() error
- func (w *Writer) Fd() uintptr
- func (w *Writer) Invalidate()
- func (w *Writer) Read(p []byte) (int, error)
- func (w *Writer) RenderingEnabled() bool
- func (w *Writer) SetContent(content string) string
- func (w *Writer) SetEnabled(enabled bool)
- func (w *Writer) SetSupported(supported bool)
- func (w *Writer) Write(p []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KittySequence ¶
KittySequence encodes PNG data as a kitty graphics escape sequence.
func RenderMarkers ¶
RenderMarkers renders a compact marker on every occupied row. The normal TUI resolves these after viewport clipping, which lets it crop images that are partially scrolled off-screen without copying PNG data into every row.
func SetRenderingEnabled ¶
func SetRenderingEnabled(enabled bool)
SetRenderingEnabled controls whether the full-screen TUI reserves image rows.
func SupportsKittyGraphics ¶
SupportsKittyGraphics probes a terminal for Kitty graphics support. It must run before the TUI takes ownership of the terminal input stream.
Types ¶
type Inline ¶
Inline is a PNG image prepared for inline kitty-protocol rendering.
func FromBase64 ¶
FromBase64 decodes and normalizes one base64-encoded image.
func FromToolResult ¶
func FromToolResult(result *tools.ToolCallResult) []Inline
FromToolResult extracts displayable images from a tool result.
func LoadMarkdownReference ¶
func LoadMarkdownReference(ctx context.Context, ref MarkdownReference) (Inline, bool)
LoadMarkdownReference resolves a data URI, local path, or public HTTP URL.
type MarkdownReference ¶
MarkdownReference is an image embedded with Markdown's  syntax.
func MarkdownReferences ¶
func MarkdownReferences(markdown string) []MarkdownReference
MarkdownReferences extracts image references in document order.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer adds kitty graphics after Bubble Tea has rendered its text cell buffer. Bubble Tea intentionally consumes APC sequences while parsing view content, so images must be overlaid on the completed frame instead.
func (*Writer) Fd ¶
Fd, Read, and Close preserve the terminal file interface when Writer wraps stdout. Bubble Tea uses that interface to detect the output TTY.
func (*Writer) Invalidate ¶
func (w *Writer) Invalidate()
Invalidate forces image data and placements to be rebuilt after the terminal clears graphics state, such as during a resize or terminal restore.
func (*Writer) RenderingEnabled ¶
RenderingEnabled reports whether both the user setting and terminal support allow images.
func (*Writer) SetContent ¶
func (*Writer) SetEnabled ¶
SetEnabled controls whether image markers become terminal overlays.
func (*Writer) SetSupported ¶
SetSupported records whether the terminal answered the Kitty graphics probe.