class

CRT::Ansi::Viewport

Inherits CRT::Ansi::Canvas < Reference < Object

A virtual buffer larger than the visible area, for scrollable content.

Has the same drawing API as Render (via Canvas): put, write, clear, cell, box, panel. Use blit on the target to copy a visible window from the viewport.

vp = Viewport.new(width: 80, height: 200)
vp.write(0, 150, "way down here", style)
render.blit(vp, x: 5, y: 3, w: 20, h: 10, scroll_y: 140)

Constructors

new(width : Int, height : Int, *, context : Context = CRT::Ansi.context)
Source

Instance methods

cell(x : Int, y : Int) : Cell
Source
clear(style : Style = default_style) : Nil
Source
default_style
Source
height
Source
put(x : Int, y : Int, grapheme : String, style : Style = default_style) : Nil
Source
resize(width : Int, height : Int, *, context : Context = CRT::Ansi.context) : Nil
Source
width
Source
write(x : Int, y : Int, text : String, style : Style = default_style) : Int32
Source