[−][src]Trait openexr::frame_buffer::PixelStruct
Types that can be inserted into a FrameBuffer
as a set of channels.
This should only be implemented for types that that contain components that
are bitwise- and semantically-identical to the PixelType
variants.
The intended use of this is to allow e.g. a tuple or struct of RGB values to be used directly by the library to write data out to and read data in from EXR files. This avoids having to create buffers of converted values.
Examples
use openexr::PixelType; use openexr::frame_buffer::PixelStruct; #[repr(C)] #[derive(Copy, Clone)] struct RGB { r: f32, g: f32, b: f32, } unsafe impl PixelStruct for RGB { fn channel_count() -> usize { 3 } fn channel(i: usize) -> (PixelType, usize) { [(PixelType::FLOAT, 0), (PixelType::FLOAT, 4), (PixelType::FLOAT, 8)][i] } }
Required methods
fn channel_count() -> usize
Returns the number of channels in this type
fn channel(i: usize) -> (PixelType, usize)
Returns the type and offset of channel i
Panics
Will either panic or return garbage when i >= channel_count()
.
Provided methods
fn channels() -> PixelStructChannelIter
Returns an iterator over the set of channels
Implementations on Foreign Types
impl<A: PixelData> PixelStruct for (A,)
[src]
fn channel_count() -> usize
[src]
fn channel(_: usize) -> (PixelType, usize)
[src]
fn channels() -> PixelStructChannelIter
[src]
impl<A, B> PixelStruct for (A, B) where
A: PixelData,
B: PixelData,
[src]
A: PixelData,
B: PixelData,
fn channel_count() -> usize
[src]
fn channel(i: usize) -> (PixelType, usize)
[src]
fn channels() -> PixelStructChannelIter
[src]
impl<A, B, C> PixelStruct for (A, B, C) where
A: PixelData,
B: PixelData,
C: PixelData,
[src]
A: PixelData,
B: PixelData,
C: PixelData,
fn channel_count() -> usize
[src]
fn channel(i: usize) -> (PixelType, usize)
[src]
fn channels() -> PixelStructChannelIter
[src]
impl<A, B, C, D> PixelStruct for (A, B, C, D) where
A: PixelData,
B: PixelData,
C: PixelData,
D: PixelData,
[src]
A: PixelData,
B: PixelData,
C: PixelData,
D: PixelData,