[][src]Struct openexr::header::Header

pub struct Header { /* fields omitted */ }

Represents an OpenEXR file header.

The file header describes the properties of the image, such as image resolution, the channels it contains, custom attributes, etc. It is used both for fetching information about a loaded EXR file and for defining the properties of a file to be written.

Examples

Creating a header for a file that will be written:

use openexr::{Header, PixelType};

Header::new()
    .set_resolution(1920, 1080)
    .add_channel("R", PixelType::FLOAT)
    .add_channel("G", PixelType::FLOAT)
    .add_channel("B", PixelType::FLOAT);

Methods

impl Header[src]

pub fn new() -> Self[src]

Creates a new header.

pub fn set_resolution(&mut self, width: u32, height: u32) -> &mut Self[src]

Sets the resolution.

This is really just a shortcut for setting both the display window and data window to (0, 0), (width-1, height-1).

pub fn set_display_window(&mut self, window: Box2i) -> &mut Self[src]

Sets the display window.

For simple use-cases, it's better to use set_resolution() instead.

pub fn set_data_window(&mut self, window: Box2i) -> &mut Self[src]

Sets the data window.

For simple use-cases, it's better to use set_resolution() instead.

pub fn set_pixel_aspect_ratio(&mut self, aspect_ratio: f32) -> &mut Self[src]

Sets the pixel aspect ratio.

pub fn set_screen_window_center(&mut self, center: (f32, f32)) -> &mut Self[src]

Sets the screen window center.

pub fn set_screen_window_width(&mut self, width: f32) -> &mut Self[src]

Sets the screen window width.

pub fn set_line_order(&mut self, line_order: LineOrder) -> &mut Self[src]

Sets the line order.

pub fn set_compression(&mut self, compression: Compression) -> &mut Self[src]

Sets the compression mode.

pub fn add_channel(&mut self, name: &str, pixel_type: PixelType) -> &mut Self[src]

Adds a channel.

This is a simplified version of add_channel_detailed(), using some reasonable defaults for the details. Specifically: sampling is set to (1, 1) and p_linear is set to true.

pub fn add_channel_detailed(
    &mut self,
    name: &str,
    channel: Channel
) -> &mut Self
[src]

Adds a channel, specifying full details.

pub fn data_origin(&self) -> (i32, i32)[src]

Convenience method for the origin (min coordinate) of the data window.

pub fn data_dimensions(&self) -> (u32, u32)[src]

Convenience method for the dimensions of the data window.

pub fn data_window(&self) -> &Box2i[src]

Access to the data window.

pub fn display_window(&self) -> &Box2i[src]

Access to the display window.

Important traits for ChannelIter<'a>
pub fn channels(&self) -> ChannelIter[src]

Returns an iterator over the channels in the header.

pub fn get_channel<'a>(&'a self, name: &str) -> Option<&'a Channel>[src]

Access channels by name.

pub fn envmap(&self) -> Option<Envmap>[src]

Determine whether this header describes an environment map, and if so, what type

pub fn set_envmap(&mut self, envmap: Option<Envmap>) -> &mut Self[src]

Declare whether this header represents an environment map

pub fn multiview(&self) -> Option<impl Iterator<Item = &str>>[src]

Access the list of view names, if any

pub fn set_multiview(&mut self, views: Option<&[&str]>) -> &mut Self[src]

Set the list of view names

pub fn box2i(x: i32, y: i32, width: u32, height: u32) -> Box2i[src]

Utility function to create a Box2i specifying its origin (bottom left) and size

Trait Implementations

impl Default for Header[src]

impl Drop for Header[src]

Auto Trait Implementations

impl !Send for Header

impl !Sync for Header

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]