class

Mosaic::Renderer

Inherits Reference < Object

Mosaic represents a Unicode image renderer.

Example:

art = Mosaic::Renderer.new.width(100) # Limit to 100 cells
  .scale(2)                           # Scale factor
  .render(image)

Constructors

new

New creates and returns a [Renderer].

Source

Instance methods

dither(dither : Bool) : self

Dither sets the dither level on [Renderer].

Source
dither=(dither : Bool)
Source
dither?
Source
height(height : Int) : self

Height sets the maximum height the image can have. Defaults to the image height.

Source
ignore_block_symbols(fg_only : Bool) : self

IgnoreBlockSymbols set UseFgBgOnly on [Renderer].

Source
invert_colors(invert : Bool) : self

InvertColors whether to invert the colors of the mosaic image.

Source
invert_colors=(invert_colors : Bool)
Source
invert_colors?
Source
output_height
Source
output_height=(output_height : Int32)
Source
output_width
Source
output_width=(output_width : Int32)
Source
render(canvas : StumpyCore::Canvas) : String

Render renders the image to a string.

Source
render(image : CrImage::Image) : String

Render renders a CrImage image.

Source
render(path : String) : String

Render decodes and renders an image from path.

Source
render(io : IO) : String

Render decodes and renders an image from IO.

Source
render(bytes : Bytes) : String

Render decodes and renders an image from bytes.

Source
scale(scale : Int) : self

Scale sets the scale level on [Renderer].

Source
scale
Source
scale=(scale : Int32)
Source
symbol(symbol : Symbol) : self

Symbol sets the mosaic symbol type.

Source
symbols
Source
symbols=(symbols : Symbol)
Source
threshold(threshold : Int) : self

Threshold sets the threshold level on [Renderer]. It expects a value between 0-255, anything else will be ignored.

Source
threshold_level
Source
threshold_level=(threshold_level : UInt8)
Source
use_fg_bg_only=(use_fg_bg_only : Bool)
Source
use_fg_bg_only?
Source
width(width : Int) : self

Width sets the maximum width the image can have. Defaults to the image width.

Source