Struct openexr::core::frame_buffer::Frame[][src]

pub struct Frame { /* fields omitted */ }
Expand description

Frame attempts to provide a safer API on top of OpenEXR’s Slice type.

Instead of providing a pointer and calculating offsets based on the data window offset, as Slice does, Frame wraps up the data window offset and handles memory allocation internally so that you can’t get it wrong.

Examples

use openexr::prelude::*;

let file = InputFile::new("test.exr", 4)?;
let data_window: [i32; 4] = *file.header().data_window();

let frame_rgba =
    Frame::new::<Rgba, _, _>(
        &["R", "G", "B", "A"],
        data_window
        )?;

let (file, frames) = file
    .into_reader(vec![frame_rgba])?
    .read_pixels(data_window[1], data_window[3])?;

Implementations

Constructs a new frame for the given channel_names and data_window and allocates storage to hold the pixel data.

Errors

Error::InvalidArgument - if the length of the channel_names slice is not a multiple of Pixel::NUM_CHANNELS

Construct a new Frame using the storage provided in vec.

This can either be used to provide pixel data for writing, or to re-use storage between reads.

Errors

Error::InvalidArgument - if the length of the channel_names slice is not a multiple of Pixel::NUM_CHANNELS

Get a reference to the pixel data slice.

Get a mutable reference to the pixel data slice.

Consume this Frame and return the pixel data as a Vec.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.