Skip to main content

DualLayerHdrBuf

Struct DualLayerHdrBuf 

Source
pub struct DualLayerHdrBuf { /* private fields */ }
Expand description

Full re-export of zenpixels core types (zero module name collisions!). 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

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub const fn with_orientation(self, orientation: Orientation) -> DualLayerHdrBuf

Attach a shared pending Orientation for the aligned pair.

Source

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}.

Source

pub fn as_view(&self) -> DualLayerHdrView<'_>

Borrow as a zero-copy DualLayerHdrView.

Source

pub fn base(&self) -> &PixelBuf

Base rendition buffer.

Source

pub fn gain_map(&self) -> &PixelBuf

Numeric gain-map buffer (ColorSpace::Untagged, 1 or 3 channels).

Source

pub const fn metadata(&self) -> GainMapMetadata

Validated exact rational ISO 21496-1 reconstruction metadata.

Source

pub fn alternate_color_space(&self) -> Option<&ColorSpace>

Alternate rendition color space, if declared.

Source

pub const fn orientation(&self) -> Orientation

Shared pending EXIF orientation for the aligned pair.

Source

pub const fn display_dimensions(&self) -> (u32, u32)

Display-oriented (width, height) of the base image after applying self.orientation().

Source

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

Source§

fn clone(&self) -> DualLayerHdrBuf

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DualLayerHdrBuf

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.