Skip to main content

RawImage

Struct RawImage 

Source
pub struct RawImage {
    pub width: u32,
    pub height: u32,
    pub cpp: u32,
    pub data: PixelData,
    pub float_max: Option<f32>,
}
Expand description

A decoded image buffer: width x height pixels of cpp interleaved samples.

Fields§

§width: u32

Width in pixels.

§height: u32

Height in pixels.

§cpp: u32

Components (samples) per pixel: 1 for CFA/mono, 3 for linear RGB / Foveon, 4 for some.

§data: PixelData

Row-major samples, width * height * cpp in total.

§float_max: Option<f32>

Largest non-negative, non-NaN sample of float data, when the decoder measured it while decoding (saves a pass over the buffer when converting to integers).

Implementations§

Source§

impl RawImage

Source

pub fn new_u16( width: u32, height: u32, cpp: u32, limits: &Limits, ) -> Result<Self>

Allocate a zeroed u16 image, enforcing limits.

Source

pub fn new_f32( width: u32, height: u32, cpp: u32, limits: &Limits, ) -> Result<Self>

Allocate a zeroed f32 image, enforcing limits.

Source

pub fn row_len(&self) -> usize

Samples per row.

Source

pub fn u16(&self) -> &[u16]

u16 samples. Panics if this is a float image (a decoder bug, not bad input).

Source

pub fn u16_mut(&mut self) -> &mut [u16]

Mutable u16 samples. Panics if this is a float image (a decoder bug, not bad input).

Source

pub fn f32_mut(&mut self) -> &mut [f32]

Mutable f32 samples. Panics if this is a u16 image.

Source

pub fn crop(&self, r: Rect) -> Result<RawImage>

Copy out a sub-rectangle (rows copied in parallel for large images).

Source

pub fn sample(&self, x: u32, y: u32, c: u32) -> f32

Sample at (x, y, c) as f32 (convenience for tests/tools; not for hot loops).

Trait Implementations§

Source§

impl Clone for RawImage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RawImage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RawImage

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RawImage

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.