#[non_exhaustive]pub enum ConvertError {
Show 15 variants
NoMatch {
source: PixelDescriptor,
},
NoPath {
from: PixelDescriptor,
to: PixelDescriptor,
},
BufferSize {
expected: usize,
actual: usize,
},
InvalidWidth(u32),
EmptyFormatList,
UnsupportedTransfer {
from: TransferFunction,
to: TransferFunction,
},
AlphaNotOpaque,
DepthReductionForbidden,
AlphaRemovalForbidden,
RgbToGray,
AllocationFailed,
Buffer(BufferError),
CmsError(String),
HdrSourceRequiresPeak {
from: PixelDescriptor,
to: PixelDescriptor,
},
NeedsCms {
from: PixelDescriptor,
to: PixelDescriptor,
},
}Expand description
Errors that can occur during pixel format negotiation or conversion.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoMatch
No supported format could be found for the source descriptor.
Fields
source: PixelDescriptorNoPath
No conversion path exists between the two formats.
BufferSize
Source and destination buffer sizes don’t match the expected dimensions.
InvalidWidth(u32)
Width is zero or would overflow stride calculations.
EmptyFormatList
The supported format list was empty.
UnsupportedTransfer
Conversion between these transfer functions is not yet supported.
AlphaNotOpaque
Alpha channel is not fully opaque and AlphaPolicy::DiscardIfOpaque was set.
DepthReductionForbidden
Depth reduction was requested but DepthPolicy::Forbid was set.
AlphaRemovalForbidden
Alpha removal was requested but AlphaPolicy::Forbid was set.
RgbToGray
RGB-to-grayscale conversion requires explicit luma coefficients.
AllocationFailed
Buffer allocation failed.
Buffer(BufferError)
A pixel buffer or slice could not be constructed: carries the real
zenpixels::BufferError cause (StrideTooSmall, InvalidDimensions,
…) instead of collapsing it into AllocationFailed.
CmsError(String)
CMS transform could not be built (invalid ICC profile, unsupported color space, etc.).
HdrSourceRequiresPeak
The conversion is HDR (Pq / Hlg) → SDR but no usable peak
luminance was supplied. Raised both when no peak was given at all
(the plain ConvertPlan::new entry
point doesn’t take one) and when a supplied HdrConfig carries a
non-finite or non-positive source_peak_nits / target_peak_nits
(including the unset HdrConfig::default() value 0.0) — a
degenerate peak would tone-map every pixel to black. Build the
plan via ConvertPlan::new_with_hdr_peak (or
ConvertPlan::new_with_hdr_config for full knob control), and
pass the source’s MaxCLL — e.g. from
hdr::measure::CllMeasure::measure_max. All three live behind
the hdr-experimental Cargo feature (plain code spans here, not
intra-doc links, so this page renders link-clean without it).
Pre-0.2.16 the plain ConvertPlan::new silently routed HDR→SDR
through the linear intermediate with no tone-mapping, producing
semantically wrong pixels. This variant replaces that with a
loud refusal.
NeedsCms
The conversion requires a color management plugin but none was provided.
Returned when one (or both) sides use a non-native color model — CMYK,
Lab, XYZ, spot inks, or any future device-dependent space — that
zenpixels-convert cannot resolve with its built-in kernels. Attach
a plugin via
RowConverter::new_explicit_with_cms
(e.g. Some(&MoxCms) under the cms-moxcms feature) and the plan
will dispatch the full row work to it.
Distinct from NoPath: NeedsCms says “a path
exists, but requires CMS dispatch”; NoPath says “no architecturally
possible conversion.” Callers that want to route to a CMS should
match on NeedsCms and re-issue the call with a plugin attached.
Pre-0.2.16: the same descriptors caused a process-aborting
assert_not_cmyk panic — replaced by this typed variant so the
documented Some(&MoxCms) escape hatch is actually reachable.
Trait Implementations§
Source§impl Clone for ConvertError
impl Clone for ConvertError
Source§fn clone(&self) -> ConvertError
fn clone(&self) -> ConvertError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConvertError
impl Debug for ConvertError
Source§impl Display for ConvertError
impl Display for ConvertError
Source§impl Error for ConvertError
Available on crate feature std only.
impl Error for ConvertError
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<BufferError> for ConvertError
impl From<BufferError> for ConvertError
Source§fn from(err: BufferError) -> Self
fn from(err: BufferError) -> Self
Wrap a buffer-construction failure’s real cause into
ConvertError::Buffer. Pair with map_err_at at the call sites so the
At location trace is preserved alongside the classified cause.