pub struct InputMapping {
pub input: BrushInput,
pub points: Vec<(f32, f32)>,
}Fields§
§input: BrushInput§points: Vec<(f32, f32)>(input_value, output_offset) knots. libmypaint requires x strictly
ascending. Output is added to base_value after summing all inputs.
Implementations§
Source§impl InputMapping
impl InputMapping
pub fn new(input: BrushInput) -> InputMapping
Sourcepub fn eval(&self, x: f32) -> f32
pub fn eval(&self, x: f32) -> f32
Evaluate the piecewise-linear curve at x. Mirrors libmypaint’s
mypaint_mapping_calculate (mypaint-mapping.c): starts with the
first two knots, walks forward while x > x1, and if the resulting
bracket has x0 == x1 or y0 == y1 returns y0 directly to dodge
division by zero on duplicate-x knots (Dieterle/Posterizer’s
opaque_multiply curve has [(0,0),(0,1),(1,1)] exactly).
Trait Implementations§
Source§impl Clone for InputMapping
impl Clone for InputMapping
Source§fn clone(&self) -> InputMapping
fn clone(&self) -> InputMapping
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InputMapping
impl Debug for InputMapping
Source§impl Default for InputMapping
impl Default for InputMapping
Source§fn default() -> InputMapping
fn default() -> InputMapping
Returns the “default value” for a type. Read more
Source§impl PartialEq for InputMapping
impl PartialEq for InputMapping
Source§fn eq(&self, other: &InputMapping) -> bool
fn eq(&self, other: &InputMapping) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for InputMapping
Auto Trait Implementations§
impl Freeze for InputMapping
impl RefUnwindSafe for InputMapping
impl Send for InputMapping
impl Sync for InputMapping
impl Unpin for InputMapping
impl UnsafeUnpin for InputMapping
impl UnwindSafe for InputMapping
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
Mutably borrows from an owned value. Read more