class

Opal::Image::PixelBuffer

Inherits Reference < Object

2D TrueColor pixel buffer supporting direct coordinate access, algorithmic generators, high-fidelity nearest & bilinear interpolation, and file decoders.

Constructors

from_bmp(bytes : Bytes) : PixelBuffer

Parses 24-bit or 32-bit uncompressed Windows BMP bytes

Source
from_ppm(content : String) : PixelBuffer

Parses Netpbm PPM (P3 ASCII or P6 Binary) image stream

Source
new(width : Int32, height : Int32, default_color : Color = Color.none)
Source
new(width : Int32, height : Int32, pixels : Array(Color))
Source
sample_gem(w : Int32 = 48, h : Int32 = 48) : PixelBuffer

Generates a radiant 24-bit TrueColor Opal gemstone with multi-faceted refraction

Source
sample_landscape(w : Int32 = 48, h : Int32 = 36) : PixelBuffer

Generates a retro twilight mountain landscape with sunset gradient and sun

Source

Instance methods

clone
Source
get(x : Int32, y : Int32) : Color
Source
height
Source
in_bounds?(x : Int32, y : Int32) : Bool
Source
pixels
Source
resize(target_w : Int32, target_h : Int32, interpolation : Interpolation = Interpolation::Bilinear) : PixelBuffer

Resizes the pixel buffer to the target dimensions using either nearest-neighbor or bilinear filtering.

Source
set(x : Int32, y : Int32, color : Color) : Nil
Source
width
Source