struct

Opal::UI::Rect

Inherits Struct < Value < Object

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

Constructors

new(x : Int32, y : Int32, width : Int32, height : Int32)
Source
new(width : Int32, height : Int32) : Rect

Convenience constructor for zero-origin rects

Source

Instance methods

bottom
Source
clamp_x(px : Int32) : Int32

Clamps an x-coordinate to lie within this rectangle.

Source
clamp_y(py : Int32) : Int32

Clamps a y-coordinate to lie within this rectangle.

Source
contains?(px : Int32, py : Int32) : Bool
Source
contains?(other : Rect) : Bool
Source
height
Source
in_bounds?(px : Int32, py : Int32) : Bool
Source
intersection(other : Rect) : Rect

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

Source
intersects?(other : Rect) : Bool
Source
right
Source
width
Source