struct TermBuf::Rect

Overview

A rectangle of cells, in buffer coordinates with the origin at the top left. Widths and heights are never negative; a zero in either makes the rectangle empty.

Defined in:

termbuf/core/rect.cr

Constructors

Instance Method Summary

Constructor Detail

def self.full(width : Int32, height : Int32) : Rect #

The rectangle covering a whole width by height grid.


[View source]
def self.new(x : Int32, y : Int32, width : Int32, height : Int32) #

[View source]

Instance Method Detail

def bottom : Int32 #

Row of the bottom cell. Meaningless for an empty rectangle.


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

Whether (x, y) falls inside.


[View source]
def contains?(other : Rect) : Bool #

Whether other falls entirely inside. An empty rectangle is contained by anything.


[View source]
def each_row(& : Int32 -> ) : Nil #

Yields each row index from the top edge down.


[View source]
def empty? : Bool #

Whether the rectangle covers no cells.


[View source]
def height : Int32 #

Rows down.


[View source]
def intersect(other : Rect) : Rect #

The overlap of two rectangles, empty when they do not meet.


[View source]
def right : Int32 #

Column of the rightmost cell. Meaningless for an empty rectangle.


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

Same as #inspect(io).


[View source]
def width : Int32 #

Columns across.


[View source]
def x : Int32 #

Column of the left edge.


[View source]
def y : Int32 #

Row of the top edge.


[View source]