class Opal::UI::Buffer

Overview

In-memory 2D grid of screen cells representing a terminal frame.

Defined in:

opal/ui/buffer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(width : Int32, height : Int32) #

[View source]

Instance Method Detail

def blit(src : Buffer, dst_x : Int32, dst_y : Int32, ignore_spaces : Bool = false) : Nil #

Blits (copies) another buffer onto this buffer at the given coordinates. If ignore_spaces is true, empty cells without background do not overwrite existing cells.


[View source]
def cells : Array(Cell) #

[View source]
def clear : Nil #

[View source]
def clone : Buffer #

[View source]
def dim_all : Nil #

Dims the entire buffer to create a backdrop effect.


[View source]
def dim_rect(x : Int32, y : Int32, w : Int32, h : Int32) : Nil #

Applies dimming attribute to all cells within the given rectangle.


[View source]
def fill(x : Int32, y : Int32, w : Int32, h : Int32, cell : Cell = Cell.empty) : Nil #

[View source]
def get(x : Int32, y : Int32) : Cell #

[View source]
def height : Int32 #

[View source]
def in_bounds?(x : Int32, y : Int32) : Bool #

[View source]
def put_char(x : Int32, y : Int32, char : Char, fg : Color = Color.none, bg : Color = Color.none, bold : Bool = false, dim : Bool = false, italic : Bool = false, underline : Bool = false, reverse : Bool = false) : Nil #

[View source]
def put_string(x : Int32, y : Int32, text : String, fg : Color = Color.none, bg : Color = Color.none, bold : Bool = false, dim : Bool = false, italic : Bool = false, underline : Bool = false, reverse : Bool = false, max_width : Int32 | Nil = nil) : Int32 #

[View source]
def render_to_string(with_ansi : Bool = true) : String #

Renders the buffer content to a string, optionally including ANSI color and style sequences.


[View source]
def set(x : Int32, y : Int32, cell : Cell) : Nil #

[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def width : Int32 #

[View source]