Documentation
¶
Index ¶
Constants ¶
const MaxRows = 4
MaxRows is the maximum number of terminal rows an image may span.
Variables ¶
var (
BaseImageDirectory = filepath.Join(xdg.DataHome, "chatuino")
)
var ErrUnsupportedAnimatedFormat = errors.New("emote is animated but in non supported format")
Functions ¶
func PlaceholderRowsAbove ¶ added in v1.4.0
PlaceholderRowsAbove returns the rows-1 terminal lines that must be rendered above line, so multi-row images in line (which contains their bottom row) are displayed in full. Every placeholder cell in line is repeated at the same column with the matching row diacritic; all other cells become spaces. Returns nil if rows <= 1 or line contains no placeholders.
Types ¶
type DecodedImage ¶
type DecodedImage struct {
ID int32 `json:"-"`
Cols int `json:"cols"`
Images []DecodedImageFrame `json:"images"`
// Rows is the number of terminal rows the image spans. Not persisted, since it
// depends on the current settings and is applied when the image is loaded.
Rows int `json:"-"`
// contains filtered or unexported fields
}
func (DecodedImage) DisplayUnicodePlaceholder ¶
func (i DecodedImage) DisplayUnicodePlaceholder() string
DisplayUnicodePlaceholder returns the placeholder text for the last (bottom) row of the image, so the image is bottom aligned with the surrounding text. For multi-row images the rows above are derived via PlaceholderRowsAbove.
func (DecodedImage) MarshalEasyJSON ¶
func (v DecodedImage) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (DecodedImage) PrepareCommand ¶
func (i DecodedImage) PrepareCommand() string
func (*DecodedImage) UnmarshalEasyJSON ¶
func (v *DecodedImage) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
type DecodedImageFrame ¶
type DecodedImageFrame struct {
Width int `json:"width"`
Height int `json:"height"`
EncodedPath string `json:"encoded_path"`
DelayInMS int `json:"delay_in_ms"`
}
func (DecodedImageFrame) MarshalEasyJSON ¶
func (v DecodedImageFrame) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (*DecodedImageFrame) UnmarshalEasyJSON ¶
func (v *DecodedImageFrame) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
type DisplayManager ¶
type DisplayManager struct {
// contains filtered or unexported fields
}
func NewDisplayManager ¶
func NewDisplayManager(fs afero.Fs, cellWidth, cellHeight float32, opts DisplayOptions) *DisplayManager
NewDisplayManager creates a display manager for a terminal with the given cell size in pixels.
func (*DisplayManager) CleanupAllImagesCommand ¶
func (d *DisplayManager) CleanupAllImagesCommand() string
func (*DisplayManager) CleanupOldImagesCommand ¶
func (d *DisplayManager) CleanupOldImagesCommand(maxAge time.Duration) string
func (*DisplayManager) Convert ¶
func (d *DisplayManager) Convert(unit DisplayUnit) (KittyDisplayUnit, error)
type DisplayOptions ¶ added in v1.4.0
type DisplayOptions struct {
Rows int // terminal rows an image spans, clamped to [1, MaxRows]
}
DisplayOptions configures how images are displayed.