class Opal::Image::PixelBuffer

Overview

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

Defined in:

opal/image/pixel_buffer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.from_bmp(bytes : Bytes) : PixelBuffer #

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


[View source]
def self.from_ppm(content : String) : PixelBuffer #

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


[View source]
def self.new(width : Int32, height : Int32, default_color : Color = Color.none) #

[View source]
def self.new(width : Int32, height : Int32, pixels : Array(Color)) #

[View source]
def self.sample_gem(w : Int32 = 48, h : Int32 = 48) : PixelBuffer #

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


[View source]
def self.sample_landscape(w : Int32 = 48, h : Int32 = 36) : PixelBuffer #

Generates a retro twilight mountain landscape with sunset gradient and sun


[View source]

Instance Method Detail

def clone : PixelBuffer #

[View source]
def get(x : Int32, y : Int32) : Color #

[View source]
def height : Int32 #

[View source]
def in_bounds?(x : Int32, y : Int32) : Bool #

[View source]
def pixels : Array(Color) #

[View source]
def 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.


[View source]
def set(x : Int32, y : Int32, color : Color) : Nil #

[View source]
def width : Int32 #

[View source]