pub struct ToneCurve(/* private fields */);
Expand description
Tone curves are powerful constructs that can contain curves specified in diverse ways.
The curve is stored in segments, where each segment can be sampled or specified by parameters. A 16.bit simplification of the whole curve is kept for optimization purposes. For float operation, each segment is evaluated separately. Plug-ins may be used to define new parametric schemes.
Owned version of ToneCurveRef
Implementations§
source§impl ToneCurve
impl ToneCurve
sourcepub fn new(gamma: f64) -> Self
pub fn new(gamma: f64) -> Self
Simplified wrapper to new_parametric
. Builds a parametric curve of type 1.
sourcepub fn new_tabulated(values: &[u16]) -> Self
pub fn new_tabulated(values: &[u16]) -> Self
Builds a tone curve based on a table of 16-bit values. Tone curves built with this function are restricted to 0…1.0 domain.
sourcepub fn new_tabulated_float(values: &[f32]) -> Self
pub fn new_tabulated_float(values: &[f32]) -> Self
Builds a tone curve based on a table of floating point values. Tone curves built with this function are not restricted to 0…1.0 domain.
sourcepub fn new_parametric(curve_type: i16, params: &[f64]) -> LCMSResult<Self>
pub fn new_parametric(curve_type: i16, params: &[f64]) -> LCMSResult<Self>
See Table 52 in LCMS documentation for descriptino of the types.
- Exponential
- CIE 122-1966
- IEC 61966-3
- IEC 61966-2.1 (sRGB)
- See PDF
- Identical to 5, unbounded.
- See PDF
- See PDF
- (108) S-Shaped sigmoidal
Always use 10-parameter slice for plug-in types.
If curve_type
is negative, then the curve is analytically inverted.
Methods from Deref<Target = ToneCurveRef>§
sourcepub fn reversed(&self) -> ToneCurve
pub fn reversed(&self) -> ToneCurve
Creates a tone curve that is the inverse of given tone curve.
sourcepub fn reversed_samples(&self, samples: usize) -> ToneCurve
pub fn reversed_samples(&self, samples: usize) -> ToneCurve
Creates a tone curve that is the inverse of given tone curve. In the case it couldn’t be analytically reversed, a tablulated curve of nResultSamples
is created.
sourcepub fn join(&self, y: &ToneCurveRef, points: usize) -> ToneCurve
pub fn join(&self, y: &ToneCurveRef, points: usize) -> ToneCurve
Composites two tone curves in the form Y^-1(X(t)) (self is X, the argument is Y)
sourcepub fn is_multisegment(&self) -> bool
pub fn is_multisegment(&self) -> bool
Returns TRUE if the tone curve contains more than one segment, FALSE if it has only one segment.
sourcepub fn is_linear(&self) -> bool
pub fn is_linear(&self) -> bool
Returns an estimation of cube being an identity (1:1) in the [0..1] domain. Does not take unbounded parts into account. This is just a coarse approximation, with no mathematical validity.
sourcepub fn is_monotonic(&self) -> bool
pub fn is_monotonic(&self) -> bool
Returns an estimation of monotonicity of curve in the [0..1] domain. Does not take unbounded parts into account. This is just a coarse approximation, with no mathematical validity.
sourcepub fn is_descending(&self) -> bool
pub fn is_descending(&self) -> bool
Does not take unbounded parts into account.
pub fn parametric_type(&self) -> i32
sourcepub fn estimated_gamma(&self, precision: f64) -> Option<f64>
pub fn estimated_gamma(&self, precision: f64) -> Option<f64>
Estimates the apparent gamma of the tone curve by using least squares fitting. Precision: The maximum standard deviation allowed on the residuals, 0.01 is a fair value, set it to a big number to fit any curve, mo matter how good is the fit.
sourcepub fn smooth(&mut self, lambda: f64) -> bool
pub fn smooth(&mut self, lambda: f64) -> bool
Smoothes tone curve according to the lambda parameter. From: Eilers, P.H.C. (1994) Smoothing and interpolation with finite differences. in: Graphic Gems IV, Heckbert, P.S. (ed.), Academic press.
sourcepub fn estimated_entries(&self) -> &[u16]
pub fn estimated_entries(&self) -> &[u16]
Tone curves do maintain a shadow low-resolution tabulated representation of the curve. This function returns a pointer to this table.