Documentation
¶
Index ¶
- Constants
- func ClearKittyImages() string
- func ConvertImageToANSI(img image.Image, defaultBGColor color.Color) string
- func ConvertImageToANSITransparent(img image.Image) string
- type CachedPreview
- type ImagePreviewCache
- type ImagePreviewer
- func (p *ImagePreviewer) ANSIRenderer(img image.Image, defaultBGColor string, maxWidth, maxHeight int) (string, error)
- func (p *ImagePreviewer) ANSIRendererTransparent(img image.Image, maxWidth int, maxHeight int) (string, error)
- func (p *ImagePreviewer) ClearKittyImages() string
- func (p *ImagePreviewer) ImagePreview(path string, maxWidth int, maxHeight int, defaultBGColor string, ...) (string, error)
- func (p *ImagePreviewer) ImagePreviewFromBytes(data []byte, maxWidth int, maxHeight int, defaultBGColor string) (string, error)
- func (p *ImagePreviewer) ImagePreviewWithRenderer(path string, maxWidth int, maxHeight int, defaultBGColor string, ...) (string, error)
- func (p *ImagePreviewer) IsKittyCapable() bool
- type ImageRenderer
- type TerminalCapabilities
- type TerminalCellSize
Constants ¶
View Source
const ( DefaultPixelsPerColumn = 10 // approximate pixels per terminal column DefaultPixelsPerRow = 20 // approximate pixels per terminal row )
Terminal cell to pixel conversion constants These approximate the pixel dimensions of terminal cells
Variables ¶
This section is empty.
Functions ¶
func ClearKittyImages ¶
func ClearKittyImages() string
ClearKittyImages clears all Kitty protocol images from the terminal
func ConvertImageToANSI ¶
Types ¶
type CachedPreview ¶
type CachedPreview struct {
Preview string
Timestamp time.Time
Renderer ImageRenderer
Dimensions string // "width,height,bgColor,sideAreaWidth"
}
type ImagePreviewCache ¶
type ImagePreviewCache struct {
// contains filtered or unexported fields
}
func NewImagePreviewCache ¶
func NewImagePreviewCache(maxEntries int, expiration time.Duration) *ImagePreviewCache
func (*ImagePreviewCache) Get ¶
func (c *ImagePreviewCache) Get(path, dimensions string, renderer ImageRenderer) (string, bool)
func (*ImagePreviewCache) Set ¶
func (c *ImagePreviewCache) Set(path, dimensions, preview string, renderer ImageRenderer)
type ImagePreviewer ¶
type ImagePreviewer struct {
// contains filtered or unexported fields
}
func NewImagePreviewer ¶
func NewImagePreviewer() *ImagePreviewer
func NewImagePreviewerWithConfig ¶
func NewImagePreviewerWithConfig(maxEntries int, expiration time.Duration) *ImagePreviewer
func (*ImagePreviewer) ANSIRenderer ¶
func (p *ImagePreviewer) ANSIRenderer( img image.Image, defaultBGColor string, maxWidth, maxHeight int) (string, error)
Convert image to ansi
func (*ImagePreviewer) ANSIRendererTransparent ¶
func (*ImagePreviewer) ClearKittyImages ¶
func (p *ImagePreviewer) ClearKittyImages() string
ClearKittyImages clears all Kitty protocol images from the terminal
func (*ImagePreviewer) ImagePreview ¶
func (*ImagePreviewer) ImagePreviewFromBytes ¶
func (*ImagePreviewer) ImagePreviewWithRenderer ¶
func (p *ImagePreviewer) ImagePreviewWithRenderer( path string, maxWidth int, maxHeight int, defaultBGColor string, renderer ImageRenderer, sideAreaWidth int) (string, error)
ImagePreviewWithRenderer generates an image preview using the specified renderer
func (*ImagePreviewer) IsKittyCapable ¶
func (p *ImagePreviewer) IsKittyCapable() bool
IsKittyCapable checks if the terminal supports Kitty graphics protocol
type ImageRenderer ¶
type ImageRenderer int
const ( RendererANSI ImageRenderer = iota RendererKitty )
type TerminalCapabilities ¶
type TerminalCapabilities struct {
// contains filtered or unexported fields
}
func NewTerminalCapabilities ¶
func NewTerminalCapabilities() *TerminalCapabilities
func (*TerminalCapabilities) GetTerminalCellSize ¶
func (tc *TerminalCapabilities) GetTerminalCellSize() TerminalCellSize
func (*TerminalCapabilities) InitTerminalCapabilities ¶
func (tc *TerminalCapabilities) InitTerminalCapabilities()
type TerminalCellSize ¶
Click to show internal directories.
Click to hide internal directories.