Struct exr::meta::header::Header [−][src]
pub struct Header {
pub channels: ChannelList,
pub compression: Compression,
pub blocks: BlockDescription,
pub line_order: LineOrder,
pub layer_size: Vec2<usize>,
pub deep: bool,
pub deep_data_version: Option<i32>,
pub chunk_count: usize,
pub max_samples_per_pixel: Option<usize>,
pub shared_attributes: ImageAttributes,
pub own_attributes: LayerAttributes,
}Expand description
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: ChannelListList of channels in this layer.
compression: CompressionHow the pixel data of all channels in this layer is compressed. May be Compression::Uncompressed.
blocks: BlockDescriptionDescribes 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: LineOrderIn what order the tiles of this header occur in the file.
layer_size: Vec2<usize>The resolution of this layer. Equivalent to the size of the DataWindow.
deep: boolWhether this layer contains deep data.
deep_data_version: Option<i32>This library supports only deep data version 1.
chunk_count: usizeNumber 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: LayerAttributesDoes not include the attributes required for reading the file contents. Excludes standard fields that must be the same for all headers.
Implementations
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:
- RLE compression
- display window equal to data window
- tiles (64 x 64 px)
- unspecified line order
- no custom attributes
Set the display window, that is, the global clipping rectangle. Must be the same for all headers of a file.
Set the offset of this layer.
pub fn with_encoding(
self,
compression: Compression,
blocks: BlockDescription,
line_order: LineOrder
) -> Self
pub fn with_encoding(
self,
compression: Compression,
blocks: BlockDescription,
line_order: LineOrder
) -> Self
Set compression, tiling, and line order. Automatically computes chunk count.
Set all attributes of the header that are not shared with all other headers in the image.
Set all attributes of the header that are shared with all other headers in the image.
Iterate over all blocks, in the order specified by the headers line order attribute. Unspecified line order is treated as increasing line order. Also enumerates the index of each block in the header, as if it were sorted in increasing line order.
pub fn blocks_increasing_y_order(
&self
) -> impl Iterator<Item = TileIndices> + ExactSizeIterator + DoubleEndedIterator
pub fn blocks_increasing_y_order(
&self
) -> impl Iterator<Item = TileIndices> + ExactSizeIterator + DoubleEndedIterator
Iterate over all tile indices in this header in LineOrder::Increasing order.
The default pixel resolution of a single block (tile or scan line block). Not all blocks have this size, because they may be cutoff at the end of the image.
pub fn get_block_data_window_pixel_coordinates(
&self,
tile: TileCoordinates
) -> Result<IntegerBounds>
pub fn get_block_data_window_pixel_coordinates(
&self,
tile: TileCoordinates
) -> Result<IntegerBounds>
Calculate the position of a block in the global infinite 2D space of a file. May be negative.
pub fn get_absolute_block_pixel_coordinates(
&self,
tile: TileCoordinates
) -> Result<IntegerBounds>
pub fn get_absolute_block_pixel_coordinates(
&self,
tile: TileCoordinates
) -> Result<IntegerBounds>
Calculate the pixel index rectangle inside this header. Is not negative. Starts at 0.
Return the tile index, converting scan line block coordinates to tile indices.
Starts at 0 and is not negative.
pub fn get_scan_line_block_tile_coordinates(
&self,
block_y_coordinate: i32
) -> Result<TileCoordinates>
pub fn get_scan_line_block_tile_coordinates(
&self,
block_y_coordinate: i32
) -> Result<TileCoordinates>
Computes the absolute tile coordinate data indices, which start at 0.
Maximum byte length of an uncompressed or compressed block, used for validation.
Returns the number of bytes that the pixels of this header will require when stored without compression. Respects multi-resolution levels and subsampling.
Approximates the maximum number of bytes that the pixels of this header will consume in a file. Due to compression, the actual byte size may be smaller.
Validate this instance.
Read the headers without validating them.
Without validation, write the headers to the byte stream.
Read the value without validating.
Without validation, write this instance to the byte stream.
The rectangle describing the bounding box of this layer within the infinite global 2D space of the file.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Header
impl UnwindSafe for Header
Blanket Implementations
Mutably borrows from an owned value. Read more