Struct vfxpreopenexr::deep::composite_deep_scan_line::CompositeDeepScanLine[][src]

pub struct CompositeDeepScanLine<'a, 'p> { /* fields omitted */ }
Expand description

Allows to composite multiple deep parts/files together into a single frame_buffer

use openexr::prelude::*;
use openexr::deep::{CompositeDeepScanLine, DeepScanLineInputFile};

// Open the two input deeps we want to composite
let file_a = DeepScanLineInputFile::new("a.exr", 4)?;
let data_window_a = *file_a.header().data_window::<[i32; 4]>();

let file_b = DeepScanLineInputFile::new("b.exr", 4)?;
let data_window_b = *file_b.header().data_window::<[i32; 4]>();

// Get the union of their data windows
let data_window = [
    data_window_a[0].min(data_window_b[0]),
    data_window_a[1].min(data_window_b[1]),
    data_window_a[2].max(data_window_b[2]),
    data_window_a[3].max(data_window_b[3]),
];

// Create a frame buffer to hold the composited image
let mut frame_buffer = FrameBuffer::new();

frame_buffer.insert_frame(Frame::new::<Rgba, _, _>(
    &["R", "G", "B", "A"],
    data_window,
)?)?;

frame_buffer.insert_frame(Frame::new::<f32, _, _>(&["Z"], data_window)?)?;

// Create the CompositeDeepScanLine, add the files, set the output
// frame buffer and read the pixels to perform the compositing.
let mut cds = CompositeDeepScanLine::new();
cds.add_source_file(&file_a)?;
cds.add_source_file(&file_b)?;
cds.set_frame_buffer(&frame_buffer);

// If this call completes successfully, `frame_buffer` will hold the
// composited R, G, B, A channels.
cds.read_pixels(data_window[1], data_window[3])?;

Implementations

Creates a Default CompositeDeepScanLine

Add a source part

Errors

  • Error::InvalidArgument - If the part is missing deep Z or alpha channels, or if the display window does not match previously added sources

Add a source file

Errors

  • Error::InvalidArgument - If the file is missing deep Z or alpha channels, or if the display window does not match previously added sources

Set the frame buffer to composite into. The buffer specified must be large enough to handle the unifed data window of all sources

Retrieve the frame buffer

Read scanlines from the sources from start to end, compositing them and storing them in the previously provided frame buffer

Errors

The number of sources added

Get the data window

If multiple parts are specified, this will be the union of each of their data windows.

Trait Implementations

Returns the “default value” for a 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.