CrImage::BoundsCheck
BoundsCheck provides common bounds checking and clipping operations to reduce code duplication across draw operations
Class methods
clamp_point(x : Int32, y : Int32, bounds : Rectangle) : Tuple(Int32, Int32)
Clamp coordinates to bounds
clip_line(x0 : Int32, y0 : Int32, x1 : Int32, y1 : Int32, bounds : Rectangle) : Tuple(Int32, Int32, Int32, Int32) | Nil
Clip a line to rectangle bounds using Cohen-Sutherland algorithm Returns nil if line is completely outside, otherwise returns clipped coordinates
overlap(r1 : Rectangle, r2 : Rectangle) : Rectangle | Nil
Get the overlapping region between two rectangles
validate_rect!(rect : Rectangle, bounds : Rectangle)
Validate that a rectangle is within bounds, raise error if not