pub enum PdfFunction {
Sampled {
domain: Vec<[f64; 2]>,
range: Vec<[f64; 2]>,
size: Vec<u32>,
bps: u32,
encode: Vec<[f64; 2]>,
decode: Vec<[f64; 2]>,
samples: Vec<f64>,
n_outputs: usize,
},
Exponential {
domain: Vec<[f64; 2]>,
range: Vec<[f64; 2]>,
c0: Vec<f64>,
c1: Vec<f64>,
n: f64,
},
Stitching {
domain: Vec<[f64; 2]>,
range: Vec<[f64; 2]>,
functions: Vec<PdfFunction>,
bounds: Vec<f64>,
encode: Vec<[f64; 2]>,
},
Calculator {
domain: Vec<[f64; 2]>,
range: Vec<[f64; 2]>,
tokens: Vec<CalcToken>,
},
Composite {
functions: Vec<PdfFunction>,
},
}Expand description
A parsed PDF function.
Variants§
Sampled
Type 0: Sampled function.
Fields
Exponential
Type 2: Exponential interpolation.
Stitching
Type 3: Stitching function.
Fields
functions: Vec<PdfFunction>Calculator
Type 4: PostScript calculator.
Composite
Array of functions whose outputs are concatenated. Used when a shading’s /Function is an array of per-component functions.
Fields
functions: Vec<PdfFunction>Implementations§
Source§impl PdfFunction
impl PdfFunction
Sourcepub fn parse(obj: &PdfObj, resolver: &Resolver<'_>) -> Result<Self, PdfError>
pub fn parse(obj: &PdfObj, resolver: &Resolver<'_>) -> Result<Self, PdfError>
Parse a PDF function from a dict/stream object.
Sourcepub fn composite(functions: Vec<PdfFunction>) -> Self
pub fn composite(functions: Vec<PdfFunction>) -> Self
Create a composite function from an array of per-component functions.
Sourcepub fn discontinuity_positions(&self) -> Vec<f64>
pub fn discontinuity_positions(&self) -> Vec<f64>
Collect input values where this function has discontinuities (stitching bounds).
Returns values in the function’s input domain, NOT normalized to [0,1].
Sourcepub fn min_samples(&self) -> usize
pub fn min_samples(&self) -> usize
Minimum number of samples needed to faithfully reproduce this function. For Type 0 (sampled) functions, returns the first dimension’s sample count. For stitching functions, sums the sub-functions’ sample counts. For other types, returns 0 (use caller’s default).
Trait Implementations§
Source§impl Clone for PdfFunction
impl Clone for PdfFunction
Source§fn clone(&self) -> PdfFunction
fn clone(&self) -> PdfFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PdfFunction
impl RefUnwindSafe for PdfFunction
impl Send for PdfFunction
impl Sync for PdfFunction
impl Unpin for PdfFunction
impl UnsafeUnpin for PdfFunction
impl UnwindSafe for PdfFunction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more