Documentation
¶
Index ¶
- func KittyDelete(id uint32) string
- func ProtocolName(p Protocol) string
- type Cache
- type ImageRenderer
- func (r *ImageRenderer) MaxRows() int
- func (r *ImageRenderer) PlaceFile(path string) (Placement, error)
- func (r *ImageRenderer) PlaceImage(img image.Image) (Placement, error)
- func (r *ImageRenderer) Protocol() Protocol
- func (r *ImageRenderer) RenderFile(path string) (string, error)
- func (r *ImageRenderer) RenderImage(img image.Image) (string, error)
- type Placement
- type PlaybackState
- type Protocol
- type VideoPlayer
- type VoicePlayer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KittyDelete ¶
KittyDelete is the sequence that removes one image and every placement of it, freeing the terminal's copy of the data too (d=I rather than d=i).
An id of 0 returns "" rather than a delete-everything: kitty reads a=d with no id as "delete all visible placements", which would take the thread's inline art with it.
func ProtocolName ¶
ProtocolName returns a human-readable name for the protocol.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an LRU cache for rendered media (terminal strings).
type ImageRenderer ¶
type ImageRenderer struct {
// contains filtered or unexported fields
}
func NewImageRenderer ¶
func NewImageRenderer(protocol Protocol, maxWidth, maxHeight int) *ImageRenderer
func (*ImageRenderer) MaxRows ¶
func (r *ImageRenderer) MaxRows() int
MaxRows is the tallest this renderer will draw, in terminal rows. It is exported so a caller that bounds inline art can assert the bound rather than assert on a rendered picture — which would need a decoder, and would pass equally against a version that cropped instead of scaling.
func (*ImageRenderer) PlaceFile ¶
func (r *ImageRenderer) PlaceFile(path string) (Placement, error)
PlaceFile renders a file and reports how to remove it.
func (*ImageRenderer) PlaceImage ¶
func (r *ImageRenderer) PlaceImage(img image.Image) (Placement, error)
PlaceImage renders an already-decoded image and reports how to remove it.
func (*ImageRenderer) Protocol ¶
func (r *ImageRenderer) Protocol() Protocol
Protocol reports which protocol this renderer draws with.
func (*ImageRenderer) RenderFile ¶
func (r *ImageRenderer) RenderFile(path string) (string, error)
func (*ImageRenderer) RenderImage ¶
func (r *ImageRenderer) RenderImage(img image.Image) (string, error)
type Placement ¶
Placement is a rendered image together with whatever it takes to remove it again.
The two protocols differ in who owns the pixels. Sixel and half-blocks are written into the cell grid, so redrawing those cells erases them and Teardown is empty. A kitty image belongs to the TERMINAL: it survives any number of text redraws, and a caller that draws one over the UI and then stops drawing it has left it on the screen. Teardown is that caller's way to say it is finished with the image.
type PlaybackState ¶
type PlaybackState int
PlaybackState represents the state of audio/video playback.
const ( PlaybackStopped PlaybackState = iota PlaybackPlaying PlaybackPaused )
type Protocol ¶
type Protocol int
Protocol represents a terminal image rendering protocol.
func DetectProtocol ¶
func DetectProtocol() Protocol
DetectProtocol probes the terminal for image rendering capabilities.
func ResolveProtocol ¶
ResolveProtocol returns the protocol to use based on config and detection.
type VideoPlayer ¶
type VideoPlayer struct {
// contains filtered or unexported fields
}
VideoPlayer launches videos in an external player.
func NewVideoPlayer ¶
func NewVideoPlayer(player string) *VideoPlayer
NewVideoPlayer creates a new video player launcher.
func (*VideoPlayer) Play ¶
func (v *VideoPlayer) Play(filePath string) error
Play launches a video file in the external player.
type VoicePlayer ¶
type VoicePlayer struct {
// contains filtered or unexported fields
}
VoicePlayer handles voice message playback.
func NewVoicePlayer ¶
func NewVoicePlayer(player string) *VoicePlayer
NewVoicePlayer creates a new voice player using the specified player binary.
func (*VoicePlayer) IsPlaying ¶
func (v *VoicePlayer) IsPlaying() bool
IsPlaying returns true if audio is currently playing.
func (*VoicePlayer) Play ¶
func (v *VoicePlayer) Play(filePath string) error
Play starts playing a voice note file.
func (*VoicePlayer) State ¶
func (v *VoicePlayer) State() PlaybackState
State returns the current playback state.