Skip to main content

TransferSet

Struct TransferSet 

Source
pub struct TransferSet<'a> {
    pub rgb: [&'a [u8; 256]; 3],
    pub gray: &'a [u8; 256],
    pub cmyk: [&'a [u8; 256]; 4],
    pub device_n: &'a [[u8; 256]],
}
Expand description

Borrowed references to all transfer LUTs from a GraphicsState.

Constructed via GraphicsState::transfer_set and stored in crate::PipeState. Avoids cloning the tables for each paint operation.

Fields§

§rgb: [&'a [u8; 256]; 3]

RGB transfer tables: [R, G, B], each 256 bytes.

§gray: &'a [u8; 256]

Gray transfer table, 256 bytes.

§cmyk: [&'a [u8; 256]; 4]

CMYK transfer tables: [C, M, Y, K], each 256 bytes.

§device_n: &'a [[u8; 256]]

DeviceN transfer tables: SPOT_NCOMPS + 4 tables of 256 bytes each, as a slice.

Shape is intentionally &[[u8; 256]] (slice of owned arrays) rather than &[&[u8; 256]] (slice of references). Production stores these as Vec<[u8; 256]> on GraphicsState because custom transfer functions from PDF /TR produce owned tables; a slice-of-references view would require either rebuilding a Vec<&[u8; 256]> per transfer_set() call (per-paint allocation) or maintaining a parallel index that stays in sync with the owned storage. The owned-array shape keeps the hot path allocation-free at the cost of needing a separate static DN: [[u8; 256]; 8] declaration in each test site.

Implementations§

Source§

impl TransferSet<'_>

Source

pub fn is_identity_rgb(&self) -> bool

Return true if all three RGB transfer tables are the identity v → v.

Used by the AA fast path to skip the transfer step entirely when it would be a no-op. Checking pointer equality against the static identity table is O(1) and covers the common case; a full element-by-element comparison is the fallback for non-static tables that happen to be identity.

Source

pub fn identity_rgb() -> TransferSet<'static>

Return a TransferSet backed by identity (pass-through) arrays.

Useful in tests and for the initial no-transfer state. The returned value borrows from static memory.

Trait Implementations§

Source§

impl<'a> Clone for TransferSet<'a>

Source§

fn clone(&self) -> TransferSet<'a>

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<'a> Debug for TransferSet<'a>

Source§

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

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

impl<'a> Copy for TransferSet<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for TransferSet<'a>

§

impl<'a> RefUnwindSafe for TransferSet<'a>

§

impl<'a> Send for TransferSet<'a>

§

impl<'a> Sync for TransferSet<'a>

§

impl<'a> Unpin for TransferSet<'a>

§

impl<'a> UnsafeUnpin for TransferSet<'a>

§

impl<'a> UnwindSafe for TransferSet<'a>

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.