class

CrImage::ClippedImage

Inherits CrImage::Image / Reference / Object

ClippedImage wraps an image and restricts all drawing to a clip region.

This is a proxy that intercepts set() calls and only allows modifications within the clip bounds.

Constructors

Instance methods

at(x : Int32, y : Int32) : CrImage::Color::Color

Returns the color of the pixel at (x,y).

If coordinates are outside bounds, returns a default color (typically transparent black) rather than raising an exception. This simplifies image processing algorithms.

  • at(bounds().min.x, bounds().min.y) returns the upper-left pixel of the grid.
  • at(bounds().max.x-1, bounds().max.y-1) returns the lower-right one.

For explicit nil on out-of-bounds, concrete types provide at? method.

Source
bounds

bounds returns the domain for which at can return non-zero color. The bounds do not necessarily contain the point(0,0).

Source
color_model

color_model returns the Image's color model

Source
set(x : Int32, y : Int32, c : CrImage::Color::Color)

Sets the color of the pixel at (x,y).

If the provided coordinates are not within bounds, this method does nothing (no-op). This simplifies drawing operations that may extend beyond image boundaries.

Source