Skip to main content

EncodeCapabilities

Struct EncodeCapabilities 

Source
#[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

Source

pub const EMPTY: Self

Empty capabilities (everything disabled, single-threaded).

Source

pub const fn new() -> Self

Create capabilities with everything disabled.

Source

pub const fn icc(&self) -> bool

Whether the encoder embeds ICC color profiles from with_metadata.

Source

pub const fn exif(&self) -> bool

Whether the encoder embeds EXIF data from with_metadata.

Source

pub const fn xmp(&self) -> bool

Whether the encoder embeds XMP data from with_metadata.

Source

pub const fn cicp(&self) -> bool

Whether the encoder embeds CICP color description from with_metadata.

Source

pub const fn stop(&self) -> bool

Whether with_stop on encode jobs is respected (not a no-op).

Source

pub const fn animation(&self) -> bool

Whether the codec supports encoding animation (multiple frames).

Source

pub const fn push_rows(&self) -> bool

Whether push_rows() / finish() work (row-level encode).

Source

pub const fn encode_from(&self) -> bool

Whether encode_from() works (pull-from-source encode).

Source

pub const fn lossy(&self) -> bool

Whether the codec supports lossy encoding.

Source

pub const fn lossless(&self) -> bool

Whether the codec supports mathematically lossless encoding.

Source

pub const fn hdr(&self) -> bool

Whether the codec supports HDR content.

Source

pub const fn gain_map(&self) -> bool

Whether the codec supports gain map (HDR/SDR) embedding.

Source

pub const fn native_gray(&self) -> bool

Whether the codec supports grayscale natively.

Source

pub const fn native_16bit(&self) -> bool

Whether the codec supports 16-bit per channel natively.

Source

pub const fn native_f32(&self) -> bool

Whether the codec handles f32 pixel data natively.

Source

pub const fn native_alpha(&self) -> bool

Whether the codec handles alpha channel natively.

Source

pub const fn enforces_max_pixels(&self) -> bool

Whether the codec enforces max_pixels limits.

Source

pub const fn enforces_max_memory(&self) -> bool

Whether the codec enforces max_memory_bytes limits.

Source

pub const fn effort_range(&self) -> Option<[i32; 2]>

Meaningful effort range [min, max].

None means the codec has no effort tuning.

Source

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.

Source

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.

Source

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));
Source

pub const fn with_icc(self, v: bool) -> Self

Set whether the encoder embeds ICC color profiles.

Source

pub const fn with_exif(self, v: bool) -> Self

Set whether the encoder embeds EXIF data.

Source

pub const fn with_xmp(self, v: bool) -> Self

Set whether the encoder embeds XMP data.

Source

pub const fn with_cicp(self, v: bool) -> Self

Set whether the encoder embeds CICP color description.

Source

pub const fn with_stop(self, v: bool) -> Self

Set whether cooperative cancellation via Stop is supported.

Source

pub const fn with_animation(self, v: bool) -> Self

Set whether animation encoding is supported.

Source

pub const fn with_push_rows(self, v: bool) -> Self

Set whether row-level (push_rows/finish) encoding is supported.

Source

pub const fn with_encode_from(self, v: bool) -> Self

Set whether pull-from-source (encode_from) encoding is supported.

Source

pub const fn with_lossy(self, v: bool) -> Self

Set whether lossy encoding is supported.

Source

pub const fn with_lossless(self, v: bool) -> Self

Set whether lossless encoding is supported.

Source

pub const fn with_hdr(self, v: bool) -> Self

Set whether HDR content is supported.

Source

pub const fn with_gain_map(self, v: bool) -> Self

Set whether gain map (HDR/SDR) embedding is supported.

Source

pub const fn with_native_gray(self, v: bool) -> Self

Set whether native grayscale encoding is supported.

Source

pub const fn with_native_16bit(self, v: bool) -> Self

Set whether native 16-bit per channel encoding is supported.

Source

pub const fn with_native_f32(self, v: bool) -> Self

Set whether native f32 pixel data is supported.

Source

pub const fn with_native_alpha(self, v: bool) -> Self

Set whether native alpha channel is supported.

Source

pub const fn with_enforces_max_pixels(self, v: bool) -> Self

Set whether the encoder enforces max_pixels limits.

Source

pub const fn with_enforces_max_memory(self, v: bool) -> Self

Set whether the encoder enforces max_memory_bytes limits.

Source

pub const fn with_effort_range(self, min: i32, max: i32) -> Self

Set the meaningful effort range [min, max].

Source

pub const fn with_quality_range(self, min: f32, max: f32) -> Self

Set the meaningful quality range [min, max].

Source

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

Source§

fn clone(&self) -> EncodeCapabilities

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for EncodeCapabilities

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for EncodeCapabilities

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for EncodeCapabilities

Source§

fn eq(&self, other: &EncodeCapabilities) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for EncodeCapabilities

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.