struct Opal::UI::Rect

Overview

A 2D integer bounding box for layouts, clipping, layers, and regions.

Defined in:

opal/ui/rect.cr

Constructors

Instance Method Summary

Constructor Detail

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

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

Convenience constructor for zero-origin rects


[View source]

Instance Method Detail

def bottom : Int32 #

[View source]
def clamp_x(px : Int32) : Int32 #

Clamps an x-coordinate to lie within this rectangle.


[View source]
def clamp_y(py : Int32) : Int32 #

Clamps a y-coordinate to lie within this rectangle.


[View source]
def contains?(px : Int32, py : Int32) : Bool #

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

[View source]
def height : Int32 #

[View source]
def in_bounds?(px : Int32, py : Int32) : Bool #

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

Computes the intersection of this rect with another rect. If they do not intersect, returns a zero-sized rect.


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

[View source]
def right : Int32 #

[View source]
def width : Int32 #

[View source]
def x : Int32 #

[View source]
def y : Int32 #

[View source]