Skip to main content

Lut1d

Struct Lut1d 

Source
pub struct Lut1d { /* private fields */ }
Expand description

Immutable per-channel linear shaper with 2..=65536 samples.

use motion_core::{Cdl, ColorWheels, Lut1d};
let shaper = Lut1d::new([0.0; 3], [16.0; 3], vec![[0.0; 3], [0.8; 3], [1.0; 3]])?;
let look = ColorWheels::default().bake(2, 1.0, Cdl::default())?.with_shaper(shaper);
assert!((look.sample([8.0; 3])[0] - 0.8).abs() < 1e-6);

Implementations§

Source§

impl Lut1d

Source

pub fn new( domain_min: [f32; 3], domain_max: [f32; 3], data: Vec<[f32; 3]>, ) -> Result<Self, ValidationError>

Freezes finite samples and strictly increasing per-channel input domains.

Source

pub fn domain_min(&self) -> [f32; 3]

Minimum input domain.

Source

pub fn domain_max(&self) -> [f32; 3]

Maximum input domain.

Source

pub fn data(&self) -> &[[f32; 3]]

Immutable RGB rows, one sample per channel in each row.

Source

pub fn from_cube(text: &str) -> Result<Self, ValidationError>

Parses a standalone 1D .cube; combined files belong to Lut3d::from_cube.

Source

pub fn sample(&self, rgb: [f32; 3]) -> [f32; 3]

Samples channels independently, clamping input but not output.

Trait Implementations§

Source§

impl Clone for Lut1d

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Lut1d

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Lut1d

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Lut1d

Auto Trait Implementations§

§

impl Forget for Lut1d

§

impl Freeze for Lut1d

§

impl Move for Lut1d

§

impl RefUnwindSafe for Lut1d

§

impl Send for Lut1d

§

impl Sync for Lut1d

§

impl Unpin for Lut1d

§

impl UnsafeUnpin for Lut1d

§

impl UnwindSafe for Lut1d

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.