[−][src]Struct exr::meta::Header
Describes a single layer in a file. A file can have any number of layers. The meta data contains one header per layer.
Fields
channels: ChannelList
List of channels in this layer.
compression: Compression
How the pixel data of all channels in this layer is compressed. May be Compression::Uncompressed
.
blocks: Blocks
Describes how the pixels of this layer are divided into smaller blocks. A single block can be loaded without processing all bytes of a file.
Also describes whether a file contains multiple resolution levels: mip maps or rip maps. This allows loading not the full resolution, but the smallest sensible resolution.
line_order: LineOrder
In what order the tiles of this header occur in the file.
data_size: Vec2<usize>
The resolution of this layer. Equals the size of the data window.
deep: bool
Whether this layer contains deep data.
deep_data_version: Option<i32>
This library supports only deep data version 1.
chunk_count: usize
Number of chunks, that is, scan line blocks or tiles, that this image has been divided into. This number is calculated once at the beginning of the read process or when creating a header object.
This value includes all chunks of all resolution levels.
Warning
This value is relied upon. You should probably use Header::with_encoding
,
which automatically updates the chunk count.
max_samples_per_pixel: Option<usize>
Maximum number of samples in a single pixel in a deep image.
Includes mandatory fields like pixel aspect or display window which must be the same for all layers.
own_attributes: LayerAttributes
Does not include the attributes required for reading the file contents. Excludes standard fields that must be the same for all headers.
Methods
impl Header
[src]
pub fn new(
name: Text,
data_size: Vec2<usize>,
channels: SmallVec<[Channel; 5]>
) -> Self
[src]
name: Text,
data_size: Vec2<usize>,
channels: SmallVec<[Channel; 5]>
) -> Self
Create a new Header with the specified name, display window and channels.
Use Header::with_encoding
and the similar methods to add further properties to the header.
The other settings are left to their default values:
- no compression
- display window equal to data window
- scan line blocks
- unspecified line order
- no custom attributes
pub fn with_display_window(self, display_window: IntRect) -> Self
[src]
Set the display window, that is, the global clipping rectangle. Must be the same for all headers of a file.
pub fn with_position(self, position: Vec2<i32>) -> Self
[src]
Set the offset of this layer.
pub fn with_encoding(
self,
compression: Compression,
blocks: Blocks,
line_order: LineOrder
) -> Self
[src]
self,
compression: Compression,
blocks: Blocks,
line_order: LineOrder
) -> Self
Set compression, tiling, and line order. Automatically computes chunk count.
pub fn with_attributes(self, own_attributes: LayerAttributes) -> Self
[src]
Add some custom attributes to the header that are not shared with all other headers in the image.
pub fn with_shared_attributes(self, shared_attributes: ImageAttributes) -> Self
[src]
Add some custom attributes to the header that are shared with all other headers in the image.
pub fn enumerate_ordered_blocks(
&self
) -> impl Iterator<Item = (usize, TileIndices)> + Send
[src]
&self
) -> impl Iterator<Item = (usize, TileIndices)> + Send
Iterate over all blocks, in the order specified by the headers line order attribute,
with an index returning the original index of the block if it were LineOrder::Increasing
.
pub fn blocks_increasing_y_order(
&self
) -> impl Iterator<Item = TileIndices> + ExactSizeIterator + DoubleEndedIterator
[src]
&self
) -> impl Iterator<Item = TileIndices> + ExactSizeIterator + DoubleEndedIterator
Iterate over all tile indices in this header in LineOrder::Increasing
order.
pub fn get_block_data_window_coordinates(
&self,
tile: TileCoordinates
) -> Result<IntRect>
[src]
&self,
tile: TileCoordinates
) -> Result<IntRect>
Calculate the position of a block in the global infinite 2D space of a file. May be negative.
pub fn get_absolute_block_indices(
&self,
tile: TileCoordinates
) -> Result<IntRect>
[src]
&self,
tile: TileCoordinates
) -> Result<IntRect>
Calculate the pixel index rectangle inside this header. Is not negative. Starts at 0
.
pub fn get_block_data_indices(&self, block: &Block) -> Result<TileCoordinates>
[src]
Return the tile index, converting scan line block coordinates to tile indices.
Starts at 0
and is not negative.
pub fn max_block_byte_size(&self) -> usize
[src]
Maximum byte length of an uncompressed or compressed block, used for validation.
pub fn validate(&self, requirements: &Requirements, strict: bool) -> UnitResult
[src]
Validate this instance.
pub fn read_all(
read: &mut PeekRead<impl Read>,
version: &Requirements
) -> Result<Headers>
[src]
read: &mut PeekRead<impl Read>,
version: &Requirements
) -> Result<Headers>
Read the headers without validating them.
pub fn write_all(
headers: &[Header],
write: &mut impl Write,
is_multilayer: bool
) -> UnitResult
[src]
headers: &[Header],
write: &mut impl Write,
is_multilayer: bool
) -> UnitResult
Without validation, write the headers to the byte stream.
pub fn read(
read: &mut PeekRead<impl Read>,
requirements: &Requirements
) -> Result<Self>
[src]
read: &mut PeekRead<impl Read>,
requirements: &Requirements
) -> Result<Self>
Read the value without validating.
pub fn write(&self, write: &mut impl Write) -> UnitResult
[src]
Without validation, write this instance to the byte stream.
pub fn data_window(&self) -> IntRect
[src]
The rectangle describing the bounding box of this layer within the infinite global 2D space of the file.
Trait Implementations
impl Clone for Header
[src]
impl Debug for Header
[src]
impl PartialEq<Header> for Header
[src]
impl StructuralPartialEq for Header
[src]
Auto Trait Implementations
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,