#[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