#[repr(C)]pub struct GradientKey {
pub color: Color128,
pub position: f32,
}
Expand description
A color/position pair for Gradient values! https://stereokit.net/Pages/StereoKit/GradientKey.html
see Gradient
§Examples
use stereokit_rust::util::{GradientKey, Color128, named_colors};
let key0 = GradientKey::new(named_colors::GOLD, 0.75);
let key1 = GradientKey::new( Color128::new(1.0, 0.84313726, 0.0, 1.0), 0.75);
let key2 = GradientKey{ color: Color128::new(1.0, 0.84313726, 0.0, 1.0), position: 0.75 };
assert_eq!(key0, key1);
assert_eq!(key1, key2);
Fields§
§color: Color128
The color for this item, preferably in some form of linear color space. Gamma corrected colors will definitely not math correctly.
position: f32
Typically a value between 0-1! This is the position of the color along the ‘x-axis’ of the gradient.
Implementations§
Source§impl GradientKey
impl GradientKey
Sourcepub fn new(color_linear: impl Into<Color128>, position: f32) -> Self
pub fn new(color_linear: impl Into<Color128>, position: f32) -> Self
A basic copy constructor for GradientKey. https://stereokit.net/Pages/StereoKit/GradientKey/GradientKey.html
color_linear
- The color for this item, preferably in some form of linear color space. Gamma corrected colors will definitely not math correctly.position
- Typically a value between 0-1! This is the position of the color along the ‘x-axis’ of the gradient.
Trait Implementations§
Source§impl Clone for GradientKey
impl Clone for GradientKey
Source§fn clone(&self) -> GradientKey
fn clone(&self) -> GradientKey
Returns a duplicate of the value. Read more
1.0.0 · 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 GradientKey
impl Debug for GradientKey
Source§impl PartialEq for GradientKey
impl PartialEq for GradientKey
impl Copy for GradientKey
impl StructuralPartialEq for GradientKey
Auto Trait Implementations§
impl Freeze for GradientKey
impl RefUnwindSafe for GradientKey
impl Send for GradientKey
impl Sync for GradientKey
impl Unpin for GradientKey
impl UnwindSafe for GradientKey
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.