CrImage::CMYK
Inherits CrImage::Image / Reference / Object
CMYK is an in-memory image using the CMYK color model.
Each pixel is stored as 4 bytes (Cyan, Magenta, Yellow, Black/Key). Used primarily for print production and prepress workflows.
Memory layout: Contiguous byte array with 4 bytes per pixel Color model: CMYK (subtractive color for printing)
Use CMYK for:
- Print production workflows
- Converting images for professional printing
- Prepress color separation
Example:
img = CrImage::CMYK.new(CrImage.rect(0, 0, 640, 480))
img.set_cmyk(100, 100, CrImage::Color::CMYK.new(0, 255, 255, 0)) # Red in CMYK
Constructors
Instance methods
Returns true if this reference is the same as other. Invokes same?.
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.
bounds returns the domain for which at can return non-zero color.
The bounds do not necessarily contain the point(0,0).
See Object#hash(hasher)
Returns a read-only view of the pixel buffer Modifying the returned Bytes directly is unsafe and may break image invariants Use at()/set() methods for safe pixel manipulation :nodoc:
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.
sub_image returns an image representing the portion of the image visible though r. the returned value shares pixes with the original image.