render

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2022 License: MIT Imports: 15 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ITermImageSupported

func ITermImageSupported() bool

ITermImageSupported ...

func SixelSupported

func SixelSupported() bool

SixelSupported ...

Types

type CellGrid

type CellGrid struct {

	// Border is a border printer.
	Border border.Border
	// Colorpicker is an algorithm to pickup colors.
	Colorpicker color.Picker

	// Row of cell grid, the terminal height by default if the image is portrait.
	Row uint16
	// Col of cell grid, the terminal width by default if the image is landscape.
	Col uint16

	// Placeholder is a text printed in the cell, " " by default,
	// ignored in debug mode because color number will be printed instead.
	Placeholder string

	// Debug given, print available color tables
	// and print calculated color number inside the cell.
	// Debug is exclusive property, any other properties might be ignored.
	Debug bool
}

CellGrid ...

func (*CellGrid) Fprint

func (grid *CellGrid) Fprint(w io.Writer, code int)

Fprint ...

func (*CellGrid) Render

func (grid *CellGrid) Render(w io.Writer, img image.Image) error

Render renders specified image by using cell.

func (*CellGrid) SetScale

func (grid *CellGrid) SetScale(scale float64) error

SetScale ...

type ITerm

type ITerm struct {
	// Scale size
	Scale float64
}

ITerm renderer to support image printing on iTerm. See https://www.iterm2.com/documentation-images.html

func (*ITerm) Render

func (iterm *ITerm) Render(w io.Writer, img image.Image) error

Render renders specified image to iTerm stdout.

func (*ITerm) SetScale

func (iterm *ITerm) SetScale(scale float64) error

SetScale ...

type Renderer

type Renderer interface {
	Render(io.Writer, image.Image) error
	SetScale(float64) error
}

Renderer interface.

func GetDefaultRenderer

func GetDefaultRenderer() Renderer

GetDefaultRenderer provides an applicable renderer for current platform.

type Sixel

type Sixel struct {
	Scale float64
}

Sixel ... See https://github.com/saitoha/libsixel

func (*Sixel) Render

func (sxl *Sixel) Render(w io.Writer, img image.Image) error

Render renders specified image to iTerm stdout.

func (*Sixel) SetScale

func (sxl *Sixel) SetScale(scale float64) error

SetScale ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL