#[non_exhaustive]pub struct EncodeCapabilities { /* private fields */ }Expand description
Describes what an encoder supports.
Returned by EncoderConfig::capabilities()
as a &'static reference. Uses getter methods so fields can be added
without breaking changes.
§Example
use zencodec::encode::EncodeCapabilities;
static CAPS: EncodeCapabilities = EncodeCapabilities::new()
.with_icc(true)
.with_exif(true)
.with_xmp(true)
.with_stop(true)
.with_native_gray(true);
assert!(CAPS.icc());
assert!(CAPS.native_gray());Implementations§
Source§impl EncodeCapabilities
impl EncodeCapabilities
Sourcepub const fn icc(&self) -> bool
pub const fn icc(&self) -> bool
Whether the encoder embeds ICC color profiles from with_metadata.
Sourcepub const fn cicp(&self) -> bool
pub const fn cicp(&self) -> bool
Whether the encoder embeds CICP color description from with_metadata.
Sourcepub const fn animation(&self) -> bool
pub const fn animation(&self) -> bool
Whether the codec supports encoding animation (multiple frames).
Sourcepub const fn encode_from(&self) -> bool
pub const fn encode_from(&self) -> bool
Whether encode_from() works (pull-from-source encode).
Sourcepub const fn lossless(&self) -> bool
pub const fn lossless(&self) -> bool
Whether the codec supports mathematically lossless encoding.
Sourcepub const fn native_gray(&self) -> bool
pub const fn native_gray(&self) -> bool
Whether the codec supports grayscale natively.
Sourcepub const fn native_16bit(&self) -> bool
pub const fn native_16bit(&self) -> bool
Whether the codec supports 16-bit per channel natively.
Sourcepub const fn native_f32(&self) -> bool
pub const fn native_f32(&self) -> bool
Whether the codec handles f32 pixel data natively.
Sourcepub const fn native_alpha(&self) -> bool
pub const fn native_alpha(&self) -> bool
Whether the codec handles alpha channel natively.
Sourcepub const fn enforces_max_pixels(&self) -> bool
pub const fn enforces_max_pixels(&self) -> bool
Whether the codec enforces max_pixels limits.
Sourcepub const fn enforces_max_memory(&self) -> bool
pub const fn enforces_max_memory(&self) -> bool
Whether the codec enforces max_memory_bytes limits.
Sourcepub const fn effort_range(&self) -> Option<[i32; 2]>
pub const fn effort_range(&self) -> Option<[i32; 2]>
Meaningful effort range [min, max].
None means the codec has no effort tuning.
Sourcepub const fn quality_range(&self) -> Option<[f32; 2]>
pub const fn quality_range(&self) -> Option<[f32; 2]>
Meaningful quality range [min, max] on the calibrated 0.0–100.0 scale.
None means the codec is lossless-only.
Sourcepub const fn threads_supported_range(&self) -> (u16, u16)
pub const fn threads_supported_range(&self) -> (u16, u16)
Supported thread count range (min, max).
(1, 1) means single-threaded only.
(1, 16) means the encoder can use 1 to 16 threads.
Sourcepub const fn supports(&self, op: UnsupportedOperation) -> bool
pub const fn supports(&self, op: UnsupportedOperation) -> bool
Check whether this encoder supports a given operation.
Returns true if the capability flag corresponding to op is set.
Returns false for decode-only operations or PixelFormat
(which depends on the specific format, not a static flag).
§Example
use zencodec::UnsupportedOperation;
use zencodec::encode::EncodeCapabilities;
static CAPS: EncodeCapabilities = EncodeCapabilities::new()
.with_animation(true)
.with_push_rows(true);
assert!(CAPS.supports(UnsupportedOperation::AnimationEncode));
assert!(CAPS.supports(UnsupportedOperation::RowLevelEncode));
assert!(!CAPS.supports(UnsupportedOperation::PullEncode));
assert!(!CAPS.supports(UnsupportedOperation::DecodeInto));Sourcepub const fn with_icc(self, v: bool) -> Self
pub const fn with_icc(self, v: bool) -> Self
Set whether the encoder embeds ICC color profiles.
Sourcepub const fn with_cicp(self, v: bool) -> Self
pub const fn with_cicp(self, v: bool) -> Self
Set whether the encoder embeds CICP color description.
Sourcepub const fn with_stop(self, v: bool) -> Self
pub const fn with_stop(self, v: bool) -> Self
Set whether cooperative cancellation via Stop is supported.
Sourcepub const fn with_animation(self, v: bool) -> Self
pub const fn with_animation(self, v: bool) -> Self
Set whether animation encoding is supported.
Sourcepub const fn with_push_rows(self, v: bool) -> Self
pub const fn with_push_rows(self, v: bool) -> Self
Set whether row-level (push_rows/finish) encoding is supported.
Sourcepub const fn with_encode_from(self, v: bool) -> Self
pub const fn with_encode_from(self, v: bool) -> Self
Set whether pull-from-source (encode_from) encoding is supported.
Sourcepub const fn with_lossy(self, v: bool) -> Self
pub const fn with_lossy(self, v: bool) -> Self
Set whether lossy encoding is supported.
Sourcepub const fn with_lossless(self, v: bool) -> Self
pub const fn with_lossless(self, v: bool) -> Self
Set whether lossless encoding is supported.
Sourcepub const fn with_gain_map(self, v: bool) -> Self
pub const fn with_gain_map(self, v: bool) -> Self
Set whether gain map (HDR/SDR) embedding is supported.
Sourcepub const fn with_native_gray(self, v: bool) -> Self
pub const fn with_native_gray(self, v: bool) -> Self
Set whether native grayscale encoding is supported.
Sourcepub const fn with_native_16bit(self, v: bool) -> Self
pub const fn with_native_16bit(self, v: bool) -> Self
Set whether native 16-bit per channel encoding is supported.
Sourcepub const fn with_native_f32(self, v: bool) -> Self
pub const fn with_native_f32(self, v: bool) -> Self
Set whether native f32 pixel data is supported.
Sourcepub const fn with_native_alpha(self, v: bool) -> Self
pub const fn with_native_alpha(self, v: bool) -> Self
Set whether native alpha channel is supported.
Sourcepub const fn with_enforces_max_pixels(self, v: bool) -> Self
pub const fn with_enforces_max_pixels(self, v: bool) -> Self
Set whether the encoder enforces max_pixels limits.
Sourcepub const fn with_enforces_max_memory(self, v: bool) -> Self
pub const fn with_enforces_max_memory(self, v: bool) -> Self
Set whether the encoder enforces max_memory_bytes limits.
Sourcepub const fn with_effort_range(self, min: i32, max: i32) -> Self
pub const fn with_effort_range(self, min: i32, max: i32) -> Self
Set the meaningful effort range [min, max].
Sourcepub const fn with_quality_range(self, min: f32, max: f32) -> Self
pub const fn with_quality_range(self, min: f32, max: f32) -> Self
Set the meaningful quality range [min, max].
Sourcepub const fn with_threads_supported_range(self, min: u16, max: u16) -> Self
pub const fn with_threads_supported_range(self, min: u16, max: u16) -> Self
Set supported thread count range.
Trait Implementations§
Source§impl Clone for EncodeCapabilities
impl Clone for EncodeCapabilities
Source§fn clone(&self) -> EncodeCapabilities
fn clone(&self) -> EncodeCapabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more