pub struct ImagePlan { /* private fields */ }Expand description
Whole-image conversion plan supporting streaming HDR peak measurement
(PeakSource::Measured), container metadata peaks (PeakSource::Declared),
and uniform execution across PixelView, PixelBuf, and BandedBuf.
Implementations§
Source§impl ImagePlan
impl ImagePlan
Sourcepub fn build(
src: impl AsRef<PixelFormat>,
dst: impl AsRef<PixelFormat>,
policy: &ConvertPolicy,
peak: PeakSource,
) -> Result<Self, At<ConvertError>>
pub fn build( src: impl AsRef<PixelFormat>, dst: impl AsRef<PixelFormat>, policy: &ConvertPolicy, peak: PeakSource, ) -> Result<Self, At<ConvertError>>
Validate and construct an image-level conversion plan.
Accepts either borrowed &PixelFormat or owned PixelFormat at the call site and borrows
&ConvertPolicy (retaining internal clones inside the built plan).
When the route does not require per-image HDR peak resolution or runtime
buffer facts (DiscardIfOpaque / Forbid on U16→U8, RGB→Gray, or float→int),
the compiled RowPlan is built once and reused across every execute call.
Sourcepub fn build_with_pulse(
src: impl AsRef<PixelFormat>,
dst: impl AsRef<PixelFormat>,
policy: &ConvertPolicy,
peak: PeakSource,
pulse: Option<&dyn Pulse>,
) -> Result<Self, At<ConvertError>>
pub fn build_with_pulse( src: impl AsRef<PixelFormat>, dst: impl AsRef<PixelFormat>, policy: &ConvertPolicy, peak: PeakSource, pulse: Option<&dyn Pulse>, ) -> Result<Self, At<ConvertError>>
Build a reusable ImagePlan with optional cooperative cancellation and progress via
pulse (forwarded to CmsBackend::build_transform
and ToneMapper::prepare when eagerly compiling the row
plan; pass None when not needed).
Sourcepub fn execute_into<S: PixelSource + ?Sized, D: PixelSink + ?Sized>(
&self,
src: &S,
dst: &mut D,
) -> Result<(), At<ConvertError>>
pub fn execute_into<S: PixelSource + ?Sized, D: PixelSink + ?Sized>( &self, src: &S, dst: &mut D, ) -> Result<(), At<ConvertError>>
Execute into an existing PixelSink (PixelViewMut, PixelBuf, BandedBuf)
with O(1) row scratch memory (never allocates a full-image F32 temporary!).
Sourcepub fn execute_into_with_pulse<S: PixelSource + ?Sized, D: PixelSink + ?Sized>(
&self,
src: &S,
dst: &mut D,
pulse: Option<&dyn Pulse>,
) -> Result<(), At<ConvertError>>
pub fn execute_into_with_pulse<S: PixelSource + ?Sized, D: PixelSink + ?Sized>( &self, src: &S, dst: &mut D, pulse: Option<&dyn Pulse>, ) -> Result<(), At<ConvertError>>
Execute into an existing PixelSink with optional cooperative cancellation and
row progress via pulse (pass None when not needed).
Sourcepub fn execute<S: PixelSource + ?Sized>(
&self,
src: &S,
) -> Result<PixelBuf, At<ConvertError>>
pub fn execute<S: PixelSource + ?Sized>( &self, src: &S, ) -> Result<PixelBuf, At<ConvertError>>
Execute into a freshly allocated tightly packed PixelBuf.
Sourcepub fn execute_with_pulse<S: PixelSource + ?Sized>(
&self,
src: &S,
pulse: Option<&dyn Pulse>,
) -> Result<PixelBuf, At<ConvertError>>
pub fn execute_with_pulse<S: PixelSource + ?Sized>( &self, src: &S, pulse: Option<&dyn Pulse>, ) -> Result<PixelBuf, At<ConvertError>>
Execute into a freshly allocated tightly packed PixelBuf with optional cooperative
cancellation and row progress via pulse (pass None when not needed).
Sourcepub fn convert<S: PixelSource + ?Sized>(
src: &S,
destination_format: impl AsRef<PixelFormat>,
policy: &ConvertPolicy,
) -> Result<PixelBuf, At<ConvertError>>
pub fn convert<S: PixelSource + ?Sized>( src: &S, destination_format: impl AsRef<PixelFormat>, policy: &ConvertPolicy, ) -> Result<PixelBuf, At<ConvertError>>
One-shot conversion from any PixelSource (PixelBuf, PixelView,
BandedBuf, or dyn PixelSource) into a newly allocated
tightly packed PixelBuf.
Resolves HDR source peak via PeakSource::Measured only when HDR→SDR tone mapping
actually requires it; for explicit peak control (Declared / Fixed), use
ImagePlan::convert_with_peak.
Sourcepub fn convert_with_peak<S: PixelSource + ?Sized>(
src: &S,
destination_format: impl AsRef<PixelFormat>,
policy: &ConvertPolicy,
peak: PeakSource,
) -> Result<PixelBuf, At<ConvertError>>
pub fn convert_with_peak<S: PixelSource + ?Sized>( src: &S, destination_format: impl AsRef<PixelFormat>, policy: &ConvertPolicy, peak: PeakSource, ) -> Result<PixelBuf, At<ConvertError>>
One-shot conversion from any PixelSource into a newly allocated PixelBuf
with an explicit PeakSource (Measured, Declared, or Fixed).
Sourcepub fn convert_with_pulse<S: PixelSource + ?Sized>(
src: &S,
destination_format: impl AsRef<PixelFormat>,
policy: &ConvertPolicy,
peak: PeakSource,
pulse: Option<&dyn Pulse>,
) -> Result<PixelBuf, At<ConvertError>>
pub fn convert_with_pulse<S: PixelSource + ?Sized>( src: &S, destination_format: impl AsRef<PixelFormat>, policy: &ConvertPolicy, peak: PeakSource, pulse: Option<&dyn Pulse>, ) -> Result<PixelBuf, At<ConvertError>>
One-shot conversion from any PixelSource into a newly allocated PixelBuf
with an explicit PeakSource and optional cooperative cancellation/progress via
pulse (pass None when not needed).
Sourcepub fn convert_into<S: PixelSource + ?Sized, D: PixelSink + ?Sized>(
src: &S,
dst: &mut D,
policy: &ConvertPolicy,
) -> Result<(), At<ConvertError>>
pub fn convert_into<S: PixelSource + ?Sized, D: PixelSink + ?Sized>( src: &S, dst: &mut D, policy: &ConvertPolicy, ) -> Result<(), At<ConvertError>>
One-shot conversion from any PixelSource into any existing PixelSink
(PixelBuf, PixelViewMut, or
BandedBuf) with O(1) row scratch memory.
Resolves HDR source peak via PeakSource::Measured only when HDR→SDR tone mapping
actually requires it; for explicit peak control, use ImagePlan::convert_into_with_peak.
Sourcepub fn convert_into_with_peak<S: PixelSource + ?Sized, D: PixelSink + ?Sized>(
src: &S,
dst: &mut D,
policy: &ConvertPolicy,
peak: PeakSource,
) -> Result<(), At<ConvertError>>
pub fn convert_into_with_peak<S: PixelSource + ?Sized, D: PixelSink + ?Sized>( src: &S, dst: &mut D, policy: &ConvertPolicy, peak: PeakSource, ) -> Result<(), At<ConvertError>>
One-shot conversion from any PixelSource into any PixelSink with an explicit
PeakSource.
Sourcepub fn convert_into_with_pulse<S: PixelSource + ?Sized, D: PixelSink + ?Sized>(
src: &S,
dst: &mut D,
policy: &ConvertPolicy,
peak: PeakSource,
pulse: Option<&dyn Pulse>,
) -> Result<(), At<ConvertError>>
pub fn convert_into_with_pulse<S: PixelSource + ?Sized, D: PixelSink + ?Sized>( src: &S, dst: &mut D, policy: &ConvertPolicy, peak: PeakSource, pulse: Option<&dyn Pulse>, ) -> Result<(), At<ConvertError>>
One-shot conversion from any PixelSource into any PixelSink with an explicit
PeakSource and optional cooperative cancellation/progress via pulse (pass None
when not needed).
Sourcepub fn to_rgb8_if_opaque<S: PixelSource + ?Sized>(
src: &S,
) -> Result<PixelBuf, At<ConvertError>>
pub fn to_rgb8_if_opaque<S: PixelSource + ?Sized>( src: &S, ) -> Result<PixelBuf, At<ConvertError>>
One-shot conversion from any PixelSource to full-range sRGB RGB8 under
ConvertPolicy::permissive().with_alpha(AlphaPolicy::DiscardIfOpaque).
DiscardIfOpaque is a metadata-only check (AlphaMode::None, AlphaMode::Opaque,
AlphaMode::Undefined, or src.source_claims().all_opaque == true) — it does not scan
pixels. For straight-alpha buffers whose pixels happen to be opaque, run
PixelScanExt::measure_claims first (or pass AlphaPolicy::CompositeOnto /
AlphaPolicy::DiscardUnchecked to ImagePlan::convert).
Sourcepub fn to_rgba8<S: PixelSource + ?Sized>(
src: &S,
) -> Result<PixelBuf, At<ConvertError>>
pub fn to_rgba8<S: PixelSource + ?Sized>( src: &S, ) -> Result<PixelBuf, At<ConvertError>>
One-shot conversion from any PixelSource to full-range sRGB straight-alpha RGBA8
under ConvertPolicy::permissive.
Sourcepub fn to_gray8_if_opaque<S: PixelSource + ?Sized>(
src: &S,
) -> Result<PixelBuf, At<ConvertError>>
pub fn to_gray8_if_opaque<S: PixelSource + ?Sized>( src: &S, ) -> Result<PixelBuf, At<ConvertError>>
One-shot conversion from any PixelSource to full-range sRGB GRAY8 (encoded Y’ luma
by default) under ConvertPolicy::permissive().with_alpha(AlphaPolicy::DiscardIfOpaque).
DiscardIfOpaque is a metadata-only check (AlphaMode::None, AlphaMode::Opaque,
AlphaMode::Undefined, or src.source_claims().all_opaque == true) — it does not scan
pixels. For straight-alpha buffers whose pixels happen to be opaque, run
PixelScanExt::measure_claims first (or pass AlphaPolicy::CompositeOnto /
AlphaPolicy::DiscardUnchecked to ImagePlan::convert).
Sourcepub fn to_bgra8<S: PixelSource + ?Sized>(
src: &S,
) -> Result<PixelBuf, At<ConvertError>>
pub fn to_bgra8<S: PixelSource + ?Sized>( src: &S, ) -> Result<PixelBuf, At<ConvertError>>
One-shot conversion from any PixelSource to full-range sRGB straight-alpha BGRA8
under ConvertPolicy::permissive.