struct
TermBuf::Rect
- TermBuf::Rect
- Struct
- Value
- Object
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.crConstructors
-
.full(width : Int32, height : Int32) : Rect
The rectangle covering a whole width by height grid.
- .new(x : Int32, y : Int32, width : Int32, height : Int32)
Instance Method Summary
-
#bottom : Int32
Row of the bottom cell.
-
#contains?(x : Int32, y : Int32) : Bool
Whether (x, y) falls inside.
-
#contains?(other : Rect) : Bool
Whether other falls entirely inside.
-
#each_row(& : Int32 -> ) : Nil
Yields each row index from the top edge down.
-
#empty? : Bool
Whether the rectangle covers no cells.
-
#height : Int32
Rows down.
-
#intersect(other : Rect) : Rect
The overlap of two rectangles, empty when they do not meet.
-
#right : Int32
Column of the rightmost cell.
-
#to_s(io : IO) : Nil
Same as
#inspect(io). -
#width : Int32
Columns across.
-
#x : Int32
Column of the left edge.
-
#y : Int32
Row of the top edge.
Constructor Detail
The rectangle covering a whole width by height grid.
Instance Method Detail
Whether other falls entirely inside. An empty rectangle is contained by anything.
The overlap of two rectangles, empty when they do not meet.