[−][src]Struct blend2d::gradient::Gradient
Methods
impl<T: GradientType> Gradient<T>
[src]
pub fn new<R: AsRef<[GradientStop]>>(
values: &T::ValuesType,
extend_mode: ExtendMode,
stops: R,
m: Option<&Matrix2D>
) -> Self
[src]
values: &T::ValuesType,
extend_mode: ExtendMode,
stops: R,
m: Option<&Matrix2D>
) -> Self
Creates a new gradient with optional initial stops and an optional
transformation Matrix2D
.
pub fn new_from_iter<I: IntoIterator<Item = GradientStop>>(
values: &T::ValuesType,
extend_mode: ExtendMode,
stops: I,
m: Option<&Matrix2D>
) -> Self
[src]
values: &T::ValuesType,
extend_mode: ExtendMode,
stops: I,
m: Option<&Matrix2D>
) -> Self
Creates a new gradient from an iterator of GradientStop
s and an
optional transformation Matrix2D
.
pub fn extend_mode(&self) -> ExtendMode
[src]
The ExtendMode
of this gradient.
pub fn set_extend_mode(&mut self, mode: ExtendMode)
[src]
Sets the gradient's ExtendMode
.
pub fn values(&self) -> &T::ValuesType
[src]
The value struct of this gradient.
pub fn set_values(&mut self, values: &T::ValuesType)
[src]
Sets the value struct of this gradient.
pub fn x0(&self) -> f64
[src]
Returns the x0 value of this gradient.
pub fn y0(&self) -> f64
[src]
Returns the y0 value of this gradient.
pub fn set_x0(&mut self, val: f64)
[src]
Sets the x0 value of this gradient.
pub fn set_y0(&mut self, val: f64)
[src]
Sets the y0 value of this gradient.
pub fn matrix(&self) -> &Matrix2D
[src]
Returns the transformation matrix.
impl<T: GradientType> Gradient<T>
[src]
pub fn reserve(&mut self, n: usize)
[src]
Reserves the capacity of gradient stops for at least n
stops.
Panics
Panics if blend2d returns an OutOfMemory
error.
pub fn try_reserve(&mut self, n: usize) -> Result<(), OutOfMemory>
[src]
Reserves the capacity of gradient stops for at least n
stops.
pub fn shrink_to_fit(&mut self)
[src]
Shrinks the capacity of gradient stops to fit the current usage.
pub fn len(&self) -> usize
[src]
Returns the number of stops in this gradient.
pub fn capacity(&self) -> usize
[src]
Returns the number of stops in this gradient.
pub fn is_empty(&self) -> bool
[src]
Returns true if this gradient is empty, in other words if it has no stops.
pub fn stops(&self) -> &[GradientStop]
[src]
Returns the gradient stops as an immutable slice.
pub fn remove_stop(&mut self, index: usize)
[src]
Removes the stop at the specified index.
pub fn remove_stops<R: RangeBounds<usize>>(&mut self, range: R)
[src]
Removes multiple stops indexed by the given range.
pub fn remove_stop_by_offset(&mut self, offset: f64)
[src]
Removes the first stop that matches the given offset.
pub fn remove_stops_in_range<R: RangeBounds<f64>>(&mut self, range: R)
[src]
Removes a range of stops that lie inside of the given range.
The range specified will always include its upper bound.
pub fn remove_all_stops_by_offset(&mut self, offset: f64)
[src]
Removes all stops matching the given offset.
pub fn index_of_stop(&self, offset: f64) -> Option<usize>
[src]
Returns the index of of the stop with with the given offset, or None if none exist.
pub fn reset_stops(&mut self)
[src]
Clears the stops buffer.
pub fn add_stop(&mut self, stop: GradientStop)
[src]
Adds a gradient stop to the buffer.
pub fn add_stop32(&mut self, offset: f64, rgba: u32)
[src]
Adds a gradient stop to the buffer.
pub fn add_stop64(&mut self, offset: f64, rgba: u64)
[src]
Adds a gradient stop to the buffer.
impl Gradient<Linear>
[src]
pub fn new_linear(
values: &LinearGradientValues,
extend_mode: ExtendMode,
stops: &[GradientStop],
m: Option<&Matrix2D>
) -> Self
[src]
values: &LinearGradientValues,
extend_mode: ExtendMode,
stops: &[GradientStop],
m: Option<&Matrix2D>
) -> Self
pub fn x1(&self) -> f64
[src]
Returns the x1 value of this gradient.
pub fn y1(&self) -> f64
[src]
Returns the y1 value of this gradient.
pub fn set_x1(&mut self, val: f64)
[src]
Sets the x1 value of this gradient.
pub fn set_y1(&mut self, val: f64)
[src]
Sets the y1 value of this gradient.
impl Gradient<Radial>
[src]
pub fn new_radial(
values: &RadialGradientValues,
extend_mode: ExtendMode,
stops: &[GradientStop],
m: Option<&Matrix2D>
) -> Self
[src]
values: &RadialGradientValues,
extend_mode: ExtendMode,
stops: &[GradientStop],
m: Option<&Matrix2D>
) -> Self
pub fn x1(&self) -> f64
[src]
Returns the x1 value of this gradient.
pub fn y1(&self) -> f64
[src]
Returns the y1 value of this gradient.
pub fn r0(&self) -> f64
[src]
Returns the r0 value of this gradient.
pub fn set_x1(&mut self, val: f64)
[src]
Sets the x1 value of this gradient.
pub fn set_y1(&mut self, val: f64)
[src]
Sets the y1 value of this gradient.
pub fn set_r0(&mut self, val: f64)
[src]
Sets the r0 value of this gradient.
impl Gradient<Conical>
[src]
pub fn new_conical(
values: &ConicalGradientValues,
extend_mode: ExtendMode,
stops: &[GradientStop],
m: Option<&Matrix2D>
) -> Self
[src]
values: &ConicalGradientValues,
extend_mode: ExtendMode,
stops: &[GradientStop],
m: Option<&Matrix2D>
) -> Self
pub fn angle(&self) -> f64
[src]
Returns the angle of this gradient.
pub fn set_angle(&mut self, val: f64)
[src]
Sets the angle of this gradient.
Trait Implementations
impl<T: GradientType> MatrixTransform for Gradient<T>
[src]
fn set_matrix(&mut self, m: &Matrix2D)
[src]
Set the transformation matrix of this type to m.
fn reset_matrix(&mut self)
[src]
Reset the transformation matrix.
fn translate(&mut self, x: f64, y: f64)
[src]
Translate the transformation matrix.
fn translate_point<P: Point>(&mut self, p: &P)
[src]
Translate the transformation matrix.
fn scale(&mut self, x: f64, y: f64)
[src]
Scale the transformation matrix.
fn scale_point<P: Point>(&mut self, p: &P)
[src]
Scale the transformation matrix.
fn skew(&mut self, x: f64, y: f64)
[src]
Skew the transformation matrix.
fn skew_point<P: Point>(&mut self, p: &P)
[src]
Skew the transformation matrix.
fn rotate(&mut self, angle: f64)
[src]
Rotate the transformation matrix.
fn rotate_around(&mut self, angle: f64, x: f64, y: f64)
[src]
Rotate the transformation matrix around a point.
fn rotate_around_point<P: Point>(&mut self, angle: f64, p: &P)
[src]
Rotate the transformation matrix around a point.
fn transform(&mut self, mat: &Matrix2D)
[src]
Transform the transformation matrix.
fn post_translate(&mut self, x: f64, y: f64)
[src]
Post-translate the transformation matrix.
fn post_translate_point<P: Point>(&mut self, p: &P)
[src]
Post-translate the transformation matrix.
fn post_scale(&mut self, x: f64, y: f64)
[src]
Post-scale the transformation matrix.
fn post_scale_point<P: Point>(&mut self, p: &P)
[src]
Post-scale the transformation matrix.
fn post_skew(&mut self, x: f64, y: f64)
[src]
Post-skew the transformation matrix.
fn post_skew_point<P: Point>(&mut self, p: &P)
[src]
Post-skew the transformation matrix.
fn post_rotate(&mut self, angle: f64)
[src]
Post-rotate the transformation matrix.
fn post_rotate_around(&mut self, angle: f64, x: f64, y: f64)
[src]
Post-rotate the transformation matrix around a point.
fn post_rotate_around_point<P: Point>(&mut self, angle: f64, p: &P)
[src]
Post-rotate the transformation matrix around a point.
fn post_transform(&mut self, mat: &Matrix2D)
[src]
Post-transform the transformation matrix.
impl From<Gradient<Linear>> for DynamicGradient
[src]
fn from(g: LinearGradient) -> Self
[src]
impl From<Gradient<Conical>> for DynamicGradient
[src]
fn from(g: ConicalGradient) -> Self
[src]
impl From<Gradient<Radial>> for DynamicGradient
[src]
fn from(g: RadialGradient) -> Self
[src]
impl<'a, T: GradientType> From<&'a <T as GradientType>::ValuesType> for Gradient<T>
[src]
fn from(v: &T::ValuesType) -> Self
[src]
impl<T: GradientType> Drop for Gradient<T>
[src]
impl<T: GradientType> PartialEq<Gradient<T>> for Gradient<T>
[src]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T: GradientType> Clone for Gradient<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> Default for Gradient<T> where
T: GradientType,
T::ValuesType: Default,
[src]
T: GradientType,
T::ValuesType: Default,
impl<'a, T: GradientType> IntoIterator for &'a Gradient<T>
[src]
type Item = &'a GradientStop
The type of the elements being iterated over.
type IntoIter = Iter<'a, GradientStop>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: GradientType> AsRef<[GradientStop]> for Gradient<T>
[src]
fn as_ref(&self) -> &[GradientStop]
[src]
impl<T: GradientType> Extend<GradientStop> for Gradient<T>
[src]
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = GradientStop>,
[src]
I: IntoIterator<Item = GradientStop>,
impl<T> Debug for Gradient<T> where
T: GradientType,
T::ValuesType: Debug,
[src]
T: GradientType,
T::ValuesType: Debug,
impl<T: GradientType> Deref for Gradient<T>
[src]
type Target = [GradientStop]
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<T, I> Index<I> for Gradient<T> where
T: GradientType,
I: SliceIndex<[GradientStop]>,
[src]
T: GradientType,
I: SliceIndex<[GradientStop]>,
type Output = I::Output
The returned type after indexing.
fn index(&self, index: I) -> &Self::Output
[src]
impl<T: GradientType> Borrow<[GradientStop]> for Gradient<T>
[src]
fn borrow(&self) -> &[GradientStop]
[src]
Auto Trait Implementations
impl<T> !Send for Gradient<T>
impl<T> Unpin for Gradient<T> where
T: Unpin,
T: Unpin,
impl<T> !Sync for Gradient<T>
impl<T> RefUnwindSafe for Gradient<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> UnwindSafe for Gradient<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> ArrayType for T where
T: WrappedBlCore,
[src]
T: WrappedBlCore,
const IMPL_IDX: usize
[src]
unsafe fn push(&mut BLArrayCore, T)
[src]
unsafe fn insert(&mut BLArrayCore, usize, T)
[src]
unsafe fn replace(&mut BLArrayCore, usize, T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, V> SliceConcat<T> for V where
T: Clone,
V: Borrow<[T]>,
[src]
T: Clone,
V: Borrow<[T]>,
type Output = Vec<T>
slice_concat_trait
)The resulting type after concatenation
fn concat(slice: &[V]) -> Vec<T>
[src]
fn join(slice: &[V], sep: &T) -> Vec<T>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,