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<'_>
impl TransferSet<'_>
Sourcepub fn is_identity_rgb(&self) -> bool
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.
Sourcepub fn identity_rgb() -> TransferSet<'static>
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>
impl<'a> Clone for TransferSet<'a>
Source§fn clone(&self) -> TransferSet<'a>
fn clone(&self) -> TransferSet<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more