pub struct ComponentTransfer { /* private fields */ }
v4_20
only.Expand description
Specifies a transfer function for a color component to be applied while rendering.
The available functions include linear, piecewise-linear, gamma and step functions.
Note that the transfer function is applied to un-premultiplied values, and all results are clamped to the [0, 1] range.
GLib type: Boxed type with copy-on-clone semantics.
Implementations§
Source§impl ComponentTransfer
impl ComponentTransfer
Sourcepub fn as_ptr(&self) -> *mut GskComponentTransfer
pub fn as_ptr(&self) -> *mut GskComponentTransfer
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GskComponentTransfer) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GskComponentTransfer) -> &Self
Borrows the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow_mut(
ptr: &mut *mut GskComponentTransfer,
) -> &mut Self
pub unsafe fn from_glib_ptr_borrow_mut( ptr: &mut *mut GskComponentTransfer, ) -> &mut Self
Borrows the underlying C value mutably.
Source§impl ComponentTransfer
impl ComponentTransfer
Sourcepub fn new_discrete(values: &[f32]) -> ComponentTransfer
pub fn new_discrete(values: &[f32]) -> ComponentTransfer
Creates a new component transfer that applies a step function.
The new value is computed as
C' = values[k]
where k is the smallest value such that
k / n <= C < (k + 1) / n
§values
Values
§Returns
a new ComponentTransfer
Sourcepub fn new_gamma(amp: f32, exp: f32, ofs: f32) -> ComponentTransfer
pub fn new_gamma(amp: f32, exp: f32, ofs: f32) -> ComponentTransfer
Creates a new component transfer that applies a gamma transform.
The new value is computed as
C' = amp * pow (C, exp) + ofs
§amp
Amplitude
§exp
Exponent
§ofs
Offset
§Returns
a new ComponentTransfer
Sourcepub fn new_identity() -> ComponentTransfer
pub fn new_identity() -> ComponentTransfer
Creates a new component transfer that doesn’t change the component value.
§Returns
a new ComponentTransfer
Sourcepub fn new_levels(n: f32) -> ComponentTransfer
pub fn new_levels(n: f32) -> ComponentTransfer
Creates a new component transfer that limits
the values of the component to n
levels.
The new value is computed as
C' = floor (C * n) / n
§n
Number of levels
§Returns
a new ComponentTransfer
Sourcepub fn new_linear(m: f32, b: f32) -> ComponentTransfer
pub fn new_linear(m: f32, b: f32) -> ComponentTransfer
Creates a new component transfer that applies a linear transform.
The new value is computed as
C' = C * m + b
§m
Slope
§b
Offset
§Returns
a new ComponentTransfer
Sourcepub fn new_table(values: &[f32]) -> ComponentTransfer
pub fn new_table(values: &[f32]) -> ComponentTransfer
Creates a new component transfer that applies a piecewise linear function.
The new value is computed as
C' = values[k] + (C - k / n) * n * (values[k + 1] - values[k])
where k is the smallest value such that
k / n <= C < (k + 1) / n
§values
Values
§Returns
a new ComponentTransfer
Trait Implementations§
Source§impl Clone for ComponentTransfer
impl Clone for ComponentTransfer
Source§impl Debug for ComponentTransfer
impl Debug for ComponentTransfer
Source§impl From<ComponentTransfer> for Value
impl From<ComponentTransfer> for Value
Source§fn from(o: ComponentTransfer) -> Self
fn from(o: ComponentTransfer) -> Self
Source§impl HasParamSpec for ComponentTransfer
impl HasParamSpec for ComponentTransfer
type ParamSpec = ParamSpecBoxed
Source§type SetValue = ComponentTransfer
type SetValue = ComponentTransfer
type BuilderFn = fn(&str) -> ParamSpecBoxedBuilder<'_, ComponentTransfer>
fn param_spec_builder() -> Self::BuilderFn
Source§impl Hash for ComponentTransfer
impl Hash for ComponentTransfer
Source§impl Ord for ComponentTransfer
impl Ord for ComponentTransfer
Source§fn cmp(&self, other: &ComponentTransfer) -> Ordering
fn cmp(&self, other: &ComponentTransfer) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ComponentTransfer
impl PartialEq for ComponentTransfer
Source§impl PartialOrd for ComponentTransfer
impl PartialOrd for ComponentTransfer
Source§impl StaticType for ComponentTransfer
impl StaticType for ComponentTransfer
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.