Image::NRGBA16
Inherits Image::PixelBuffer < Reference < Object
NRGBA16 is an in-memory image storing Color::NRGBA16 pixels.
Non-premultiplied alpha version of RGBA16. Higher precision with independent alpha. 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 color editing with high precision
- HDR images with independent alpha channel
- Interchange format for high-bit-depth workflows
Features:
- Direct byte buffer access via
pixmethod - Sub-image support (shares underlying buffer)
- Stride support for flexible memory layouts
Example:
img = Image::NRGBA16.new(Image.rect(0, 0, 640, 480))
img[10, 20] = Image::Color::NRGBA16.new(65535, 0, 0, 32768) # 50% transparent red
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