Struct openexr::deep::deep_tiled_output_file::DeepTiledOutputFile [−][src]
#[repr(transparent)]pub struct DeepTiledOutputFile(_);
Implementations
Opens the file and writes the header.
Errors
Error::Base
- If the file could not be opened or theHeader
is invalid
Define a frame buffer as the pixel data source.
Pixel (x, y) is at offset x * x_stride + y * y_stride
Errors
Error::Base
- If an error occurs
Get the DeepFrameBuffer
Get the tiles’ x dimension
Get the tiles’ y dimension
Get the level mode
Get the level rounding mode
Get the number of levels in the file
Returns
Ok(1)
iflevel_mode()
==LevelMode::OneLevel
Ok(rfunc (log (max (w, h)) / log (2)) + 1)
iflevel_mode()
==LevelMode::MipmapLevels
Err(Error::Logic)
iflevel_mode()
==LevelMode::RipmapLevels
where rfunc
is either floor()
or ceil()
depending on whether
level_rounding_mode()
is LevelRoundingMode::RoundUp
or LevelRoundingMode::RoundDown
Get the number of levels in the file in the x axis
Returns
1
iflevel_mode()
==LevelMode::OneLevel
rfunc (log (max (w, h)) / log (2)) + 1
iflevel_mode()
==LevelMode::MipmapLevels
rfunc (log (w) / log (2)) + 1
iflevel_mode()
==LevelMode::RipmapLevels
where rfunc
is either floor()
or ceil()
depending on whether
level_rounding_mode()
is LevelRoundingMode::RoundUp
or LevelRoundingMode::RoundDown
Get the number of levels in the file in the y axis
Returns
1
iflevel_mode()
==LevelMode::OneLevel
rfunc (log (max (w, h)) / log (2)) + 1
iflevel_mode()
DeepTiledOutputFile::mode()
] ==LevelMode::MipmapLevels
rfunc (log (h) / log (2)) + 1
iflevel_mode()
==LevelMode::RipmapLevels
where rfunc
is either floor()
or ceil()
depending on whether
level_rounding_mode()
is LevelRoundingMode::RoundUp
or LevelRoundingMode::RoundDown
Returns true
if the file contains a level with level number (lx, ly)
, false
otherwise.
Returns the width of the level with level number (lx, *)
, where *
is any number.
Returns
max (1, rfunc (w / pow (2, lx)))
where rfunc
is either floor()
or ceil()
depending on whether
level_rounding_mode()
is LevelRoundingMode::RoundUp
or LevelRoundingMode::RoundDown
Errors
*Error::Base
- If any error occurs
Returns the height of the level with level number (*, ly)
, where *
is any number.
Returns
max (1, rfunc (h / pow (2, ly)))
where rfunc
is either floor()
or ceil()
depending on whether
level_rounding_mode()
is LevelRoundingMode::RoundUp
or LevelRoundingMode::RoundDown
Errors
*Error::Base
- If any error occurs
Get the number of tiles in the x axis that cover a level with level number (lx, *)
where *
is any number
Returns
*(level_width(lx) + tile_x_size() - 1) / tile_x_size()
Errors
*Error::InvalidArgument
- If lx
is not a valid level
Get the number of tiles in the y axis that cover a level with level number (*, ly)
where *
is any number
Returns
- (level_height(ly) + tile_y_size() - 1) / tile_y_size()
Errors
*Error::InvalidArgument
- If lx
is not a valid level
Returns a 2-dimensional region of valid pixel coordinates for a level with level number (lx, ly)
Errors
*Error::Base
- if any error occurs
Returns a 2-dimensional region of valid pixel coordinates for a level with tile coordinates (dx, dy)
and level number (lx, ly)
Errors
Error::InvalidArgument
- if the passed tile coordinates are invalidError::Base
- if any other error occurs
Writes the tile with tile coordinates (dx, dy), and level number (lx, ly) to the file.
Errors
-
Error::InvalidArgument
if dx does not lie in the interval [0, numXTiles(lx) - 1] -
Error::InvalidArgument
if dy does not lie in the interval [0, numYTiles(ly) - 1] -
Error::InvalidArgument
if lx does not lie in the interval [0, numXLevels() - 1] -
Error::InvalidArgument
if ly does not lie in the inverval [0, numYLevels() - 1] -
Error::Base
if any other error occurs
Pixels that are outside the pixel coordinate range for the tile’s level, are never accessed by writeTile().
Each tile in the file must be written exactly once.
The file’s line order attribute determines the order of the tiles in the file:
LineOrder::IncreasingY
In the file, the tiles for each level are stored in a contiguous block. The levels are ordered like this:
(0, 0) (1, 0) ... (nx-1, 0)
(0, 1) (1, 1) ... (nx-1, 1)
...
(0,ny-1) (1,ny-1) ... (nx-1,ny-1)
where nx = num_x_levels()
, and ny = num_y_levels()
.
In an individual level, (lx, ly)
, the tiles
are stored in the following order:
(0, 0) (1, 0) ... (tx-1, 0)
(0, 1) (1, 1) ... (tx-1, 1)
...
(0,ty-1) (1,ty-1) ... (tx-1,ty-1)
where tx = num_x_tiles(lx)
,
and ty = num_y_tiles(ly)
.
LineOrder::DecreasingY
As for LineOrder::IncreasingY
, the tiles
for each level are stored in a contiguous block. The levels
are ordered the same way as for LineOrder::IncreasingY
,
but within an individual level, the tiles
are stored in this order:
(0,ty-1) (1,ty-1) ... (tx-1,ty-1)
...
(0, 1) (1, 1) ... (tx-1, 1)
(0, 0) (1, 0) ... (tx-1, 0)
LineOrder::RandomY
The order of the calls to write_tile()
determines
the order of the tiles in the file.
Writes multiple tiles at once.
If multi-threading is used multiple tiles are written concurrently.
The tile coordinates, dx1, dx2 and dy1, dy2, specify inclusive ranges of tile
coordinates. It is valid for dx1 < dx2 or dy1 < dy2; the
tiles are always written in the order specified by the line
order attribute. Hence, it is not possible to specify an
“invalid” or empty tile range.
Pixels that are outside the pixel coordinate range for the tile’s level, are never accessed by writeTile().
Each tile in the file must be written exactly once.
The file’s line order attribute determines the order of the tiles in the file:
LineOrder::IncreasingY
In the file, the tiles for each level are stored in a contiguous block. The levels are ordered like this:
(0, 0) (1, 0) ... (nx-1, 0)
(0, 1) (1, 1) ... (nx-1, 1)
...
(0,ny-1) (1,ny-1) ... (nx-1,ny-1)
where nx = num_x_levels()
, and ny = num_y_levels()
.
In an individual level, (lx, ly)
, the tiles
are stored in the following order:
(0, 0) (1, 0) ... (tx-1, 0)
(0, 1) (1, 1) ... (tx-1, 1)
...
(0,ty-1) (1,ty-1) ... (tx-1,ty-1)
where tx = num_x_tiles(lx)
,
and ty = num_y_tiles(ly)
.
LineOrder::DecreasingY
As for LineOrder::IncreasingY
, the tiles
for each level are stored in a contiguous block. The levels
are ordered the same way as for LineOrder::IncreasingY
,
but within an individual level, the tiles
are stored in this order:
(0,ty-1) (1,ty-1) ... (tx-1,ty-1)
...
(0, 1) (1, 1) ... (tx-1, 1)
(0, 0) (1, 0) ... (tx-1, 0)
LineOrder::RandomY
The order of the calls to write_tile()
determines
the order of the tiles in the file.
Supplies a new set of pixels for the preview image attribute in the file’s header
Note: update_preview_image() is necessary because images are often stored in a file incrementally, a few tiles at a time, while the image is being generated. Since the preview image is an attribute in the file’s header, it gets stored in the file as soon as the file is opened, but we may not know what the preview image should look like until we have written the last tile of the main image.
Errors
Error::LogicError
- If the image header does not contain a preview imageError::Base
- If any other error occurs
Shortcut to copy all pixels from a DeepTiledInputFile
into this file,
without uncompressing and then recompressing the pixel data.
This file’s header must be compatible with the DeepTiledInputFile
’s
header: The two header’s “dataWindow”, “compression”,
“lineOrder” and “channels” attributes must be the same.
Errors
Error::InvalidArgument
- If the headers do not matchError::LogicError
- If tiles have already been written to this file.Error::Base
- If any other error occurs
pub fn copy_pixels_from_part(
&mut self,
file: &mut DeepTiledInputPart<'_>
) -> Result<(), Error>
pub fn copy_pixels_from_part(
&mut self,
file: &mut DeepTiledInputPart<'_>
) -> Result<(), Error>
Shortcut to copy all pixels from an DeepTiledInputPart
into this file,
without uncompressing and then recompressing the pixel data.
This file’s header must be compatible with the DeepTiledInputPart
’s
header: The two header’s “dataWindow”, “compression”,
“lineOrder” and “channels” attributes must be the same.
Errors
Error::InvalidArgument
- If the headers do not matchError::LogicError
- If tiles have already been written to this file.Error::Base
- If any other error occurs