pub struct DualLayerHdrBuf { /* private fields */ }Expand description
Container-agnostic dual-layer HDR image (base + numeric gain map + exact ISO 21496-1 metadata).
Unifies UltraHDR JPEG, AVIF tmap, JXL jhgm, and PNG gain-map HDR in one validated core type.
gain_map dimensions are independent of base dimensions (any positive resolution ratio such
as full-res, 1/2, or 1/4 is permitted).
Implementations§
Source§impl DualLayerHdrBuf
impl DualLayerHdrBuf
Sourcepub fn new(
base: PixelBuf,
gain_map: PixelBuf,
metadata: GainMapMetadata,
) -> Result<DualLayerHdrBuf, At<BufferError>>
pub fn new( base: PixelBuf, gain_map: PixelBuf, metadata: GainMapMetadata, ) -> Result<DualLayerHdrBuf, At<BufferError>>
Construct a validated dual-layer HDR carrier with GainMapColorSpace::Base.
Validates base color model (Rgb/Gray/1-or-3-ch Icc), numeric gain-map layout
(ColorSpace::Untagged, 1 or 3 channels, U8/U16/F32 with Full/Lsb/Msb packing),
and exact rational ISO 21496-1 metadata (gamma > 0, min <= max, H_base != H_alt).
Inherits pending Orientation from base (requiring base.orientation() == gain_map.orientation()).
Rejects metadata.application_space() == GainMapColorSpace::Alternate because no
alternate color space is supplied — use
new_with_alternate_color when
application_space == Alternate.
Sourcepub fn new_with_alternate_color(
base: PixelBuf,
gain_map: PixelBuf,
metadata: GainMapMetadata,
alternate_color_space: ColorSpace,
) -> Result<DualLayerHdrBuf, At<BufferError>>
pub fn new_with_alternate_color( base: PixelBuf, gain_map: PixelBuf, metadata: GainMapMetadata, alternate_color_space: ColorSpace, ) -> Result<DualLayerHdrBuf, At<BufferError>>
Construct a validated dual-layer HDR carrier with an explicit alternate ColorSpace
(required when metadata.application_space() == GainMapColorSpace::Alternate).
Inherits pending Orientation from base (rejecting misregistered
base.orientation() != gain_map.orientation()). To attach or replace orientation metadata
afterward, chain with_orientation.
Sourcepub fn from_parts(
parts: DualLayerHdrBufParts,
) -> Result<DualLayerHdrBuf, At<BufferError>>
pub fn from_parts( parts: DualLayerHdrBufParts, ) -> Result<DualLayerHdrBuf, At<BufferError>>
Reconstruct a validated DualLayerHdrBuf from DualLayerHdrBufParts.
Requires parts.base.orientation() == parts.gain_map.orientation(), and if non-Identity,
that they match parts.orientation.
Sourcepub fn with_alternate_color_space(
self,
alt: ColorSpace,
) -> Result<DualLayerHdrBuf, At<BufferError>>
pub fn with_alternate_color_space( self, alt: ColorSpace, ) -> Result<DualLayerHdrBuf, At<BufferError>>
Attach a validated alternate rendition color space (required when application_space == Alternate).
Sourcepub const fn with_orientation(self, orientation: Orientation) -> DualLayerHdrBuf
pub const fn with_orientation(self, orientation: Orientation) -> DualLayerHdrBuf
Attach a shared pending Orientation for the aligned pair.
Sourcepub const fn compose_orientation(self, delta: Orientation) -> DualLayerHdrBuf
pub const fn compose_orientation(self, delta: Orientation) -> DualLayerHdrBuf
Compose an additional display transform (including reflections) onto the shared pending
EXIF orientation (self.orientation.then(delta)) in O(1) without touching or rebaking
either pixel layer.
Keeps base and gain_map strictly registered in stored-frame coordinates for
lossless EXIF passthrough workflows. To physically bake orientation into both pixel
buffers, use zenpixels_convert::gainmap::{bake_dual_layer_orientation, bake_dual_layer_orientation_after}.
Sourcepub fn as_view(&self) -> DualLayerHdrView<'_>
pub fn as_view(&self) -> DualLayerHdrView<'_>
Borrow as a zero-copy DualLayerHdrView.
Sourcepub fn gain_map(&self) -> &PixelBuf
pub fn gain_map(&self) -> &PixelBuf
Numeric gain-map buffer (ColorSpace::Untagged, 1 or 3 channels).
Sourcepub const fn metadata(&self) -> GainMapMetadata
pub const fn metadata(&self) -> GainMapMetadata
Validated exact rational ISO 21496-1 reconstruction metadata.
Sourcepub fn alternate_color_space(&self) -> Option<&ColorSpace>
pub fn alternate_color_space(&self) -> Option<&ColorSpace>
Alternate rendition color space, if declared.
Sourcepub const fn orientation(&self) -> Orientation
pub const fn orientation(&self) -> Orientation
Shared pending EXIF orientation for the aligned pair.
Sourcepub const fn display_dimensions(&self) -> (u32, u32)
pub const fn display_dimensions(&self) -> (u32, u32)
Display-oriented (width, height) of the base image after applying self.orientation().
Sourcepub fn into_parts(self) -> DualLayerHdrBufParts
pub fn into_parts(self) -> DualLayerHdrBufParts
Decompose into complete owned DualLayerHdrBufParts, preserving alternate_color_space
and pending orientation losslessly.
Trait Implementations§
Source§impl Clone for DualLayerHdrBuf
impl Clone for DualLayerHdrBuf
Source§fn clone(&self) -> DualLayerHdrBuf
fn clone(&self) -> DualLayerHdrBuf
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more