Image::RGBA16
Inherits Image::PixelBuffer < Reference < Object
RGBA16 is an in-memory image storing Color::RGBA16 pixels.
Higher precision version of RGBA8 for professional imaging and HDR. Uses 16 bits per channel (8 bytes per pixel: R, G, B, A).
Storage format: Raw bytes in big-endian, R, G, B, A order (2 bytes each) Memory usage: width × height × 8 bytes
Use cases:
- Professional photography and image editing
- HDR (High Dynamic Range) images
- Reduced banding in gradients
- Precision for color transformations
Features:
- Direct byte buffer access via
pixmethod - Sub-image support (shares underlying buffer)
- Stride support for flexible memory layouts
Example:
img = Image::RGBA16.new(Image.rect(0, 0, 640, 480))
img[10, 20] = Image::Color::RGBA16.new(65535, 0, 0, 65535)
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