Skip to main content

RGBSource

Trait RGBSource 

Source
pub trait RGBSource {
    // Required methods
    fn dimensions(&self) -> (usize, usize);
    fn pixel_f32(&self, x: usize, y: usize) -> (f32, f32, f32);

    // Provided method
    fn dimensions_i32(&self) -> (i32, i32) { ... }
}
Expand description

Source of arbitrarily formatted RGB data.

This is the “compatible” trait for RGB sources, but it will be slow, since it only supports single pixel lookup.

Required Methods§

Source

fn dimensions(&self) -> (usize, usize)

Returns the underlying image size as an usize tuple (w, h).

Source

fn pixel_f32(&self, x: usize, y: usize) -> (f32, f32, f32)

Extract the pixel value at the specified location. Pixel values are expected to be floats in the range [0, 255] (u8 represented as f32).

Provided Methods§

Source

fn dimensions_i32(&self) -> (i32, i32)

Returns the underlying image size as an i32 tuple (w, h).

Implementors§