struct

TermBuf::Image

Inherits Struct < Value < Object

Stability: stable — changes only in a major release.

Pixels ready to be sent to a terminal that draws them.

The shard does not decode or scale anything. An application hands over the bytes it already has, says what they are, and says how many cells to draw them across; the terminal does the scaling.

Constructors

new(pixels : Bytes, format : Format, width : Int32 = 0, height : Int32 = 0)

Pixels in format. A raw format needs its dimensions and exactly as many bytes as they imply; Png reads both out of the file. .rgb, .rgba and .png say the same thing more plainly.

Source
png(data : Bytes) : Image

A PNG file as it came off disk.

Source
png(path : String | Path) : Image

A PNG file as it came off disk.

Source
rgb(pixels : Bytes, width : Int32, height : Int32) : Image

Three bytes a pixel, row by row from the top left.

Source
rgba(pixels : Bytes, width : Int32, height : Int32) : Image

Three bytes a pixel, row by row from the top left.

Source

Instance methods

format

What those bytes are.

Source
height

Pixel dimensions. A terminal needs these for the raw formats and reads them out of the file for Png, where they may be left at zero.

Source
pixels

The bytes as the terminal will receive them.

Source
width

Pixel dimensions. A terminal needs these for the raw formats and reads them out of the file for Png, where they may be left at zero.

Source

Nested types