Struct Colors
pub struct Colors<'a> { /* private fields */ }Expand description
Specification for the colors in a gradient.
Holds color data, positions, tile mode, and color space for gradient construction. All references must outlive any shader created from it.
Implementations§
§impl<'a> Colors<'a>
impl<'a> Colors<'a>
pub fn new(
colors: &'a [Color4f],
pos: Option<&'a [f32]>,
tile_mode: SkTileMode,
color_space: impl Into<Option<RCHandle<SkColorSpace>>>,
) -> Colors<'a>
pub fn new( colors: &'a [Color4f], pos: Option<&'a [f32]>, tile_mode: SkTileMode, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Colors<'a>
Create gradient colors with explicit positions.
colors: The colors for the gradient.pos: Relative positions of each color (0.0 to 1.0). Must be strictly increasing. IfNone, colors are distributed evenly.tile_mode: Tiling mode for the gradient.color_space: Optional color space. IfNone, colors are treated as sRGB.
pub fn new_evenly_spaced(
colors: &'a [Color4f],
tile_mode: SkTileMode,
color_space: impl Into<Option<RCHandle<SkColorSpace>>>,
) -> Colors<'a>
pub fn new_evenly_spaced( colors: &'a [Color4f], tile_mode: SkTileMode, color_space: impl Into<Option<RCHandle<SkColorSpace>>>, ) -> Colors<'a>
Create gradient colors with evenly distributed positions.
pub fn color_space(&self) -> Option<&RCHandle<SkColorSpace>>
pub fn color_space(&self) -> Option<&RCHandle<SkColorSpace>>
Returns a reference to the color space.
pub fn tile_mode(&self) -> SkTileMode
pub fn tile_mode(&self) -> SkTileMode
Returns the tile mode.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Colors<'a>
impl<'a> RefUnwindSafe for Colors<'a>
impl<'a> Send for Colors<'a>
impl<'a> Sync for Colors<'a>
impl<'a> Unpin for Colors<'a>
impl<'a> UnwindSafe for Colors<'a>
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