Image::RGBA8
Inherits Image::PixelBuffer < Reference < Object
RGBA8 is an in-memory image storing Color::RGBA8 pixels.
This is the most common image type for color images with transparency. Pixels are stored in a contiguous byte buffer (4 bytes per pixel: R, G, B, A).
Storage format: Raw bytes in R, G, B, A order Memory usage: width × height × 4 bytes
Features:
- Direct byte buffer access via
pixmethod - Sub-image support (shares underlying buffer)
- Stride support for flexible memory layouts
Example:
img = Image::RGBA8.new(Image.rect(0, 0, 640, 480))
img[10, 20] = Image::Color::RGBA8.new(255, 0, 0, 255)
pixel = img[10, 20] # Returns Color::RGBA8
Constructors
new(rect : Rectangle)
SourceInstance methods
Returns the pixel at (x, y), or default value if out of bounds
Sets the pixel at (x, y), no-op if out of bounds