struct TUI::ClipRect

Overview

A rectangle, in the same 1-based coordinate convention as Widget#x/ #y, that Screen#with_clip bounds #blit writes to. Exists so a container of independently-compositing children (see Grid, src/tui/layout/grid.cr) can bound where its children are allowed to draw without needing to intercept or redirect their #composite calls — every Widget#composite ever reaches the real screen through exactly one call, Screen#blit, so clipping there is sufficient no matter how deep the widget tree gets.

Defined in:

tui/core/screen.cr

Constructors

Instance Method Summary

Constructor Detail

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

[View source]

Instance Method Detail

def clone #

[View source]
def col : Int32 #

def copy_with(row _row = @row, col _col = @col, height _height = @height, width _width = @width) #

[View source]
def height : Int32 #

def intersect(other : ClipRect) : ClipRect #

Narrows self to the overlap with other — used by #with_clip so a nested clip can only ever shrink the bound in effect, never widen past an outer container's own clip.


[View source]
def row : Int32 #

def width : Int32 #