pub enum Source<'a> {
Solid(SolidSource),
Image(Image<'a>, ExtendMode, FilterMode, Transform),
RadialGradient(Gradient, Spread, Transform),
TwoCircleRadialGradient(Gradient, Spread, Point, f32, Point, f32, Transform),
LinearGradient(Gradient, Spread, Transform),
SweepGradient(Gradient, Spread, f32, f32, Transform),
}
Expand description
LinearGradients have an implicit start point at 0,0 and an end point at 256,0. The transform
parameter can be used to adjust them to the desired location.
RadialGradients have an implicit center at 0,0 and a radius of 128.
The helper functions: new_linear_gradient
, new_radial_gradient
and new_two_circle_radial_gradient
allow the gradients to be constructed with easier to understand inputs.
The transform
parameter maps user space to source space. This means that setting the same transform
on the draw target as the source will have the effect of canceling out.
These locations are an artifact of the blitter implementation and will probably change in the future to become more ergonomic.
Variants§
Solid(SolidSource)
Image(Image<'a>, ExtendMode, FilterMode, Transform)
RadialGradient(Gradient, Spread, Transform)
TwoCircleRadialGradient(Gradient, Spread, Point, f32, Point, f32, Transform)
LinearGradient(Gradient, Spread, Transform)
SweepGradient(Gradient, Spread, f32, f32, Transform)
Implementations§
source§impl<'a> Source<'a>
impl<'a> Source<'a>
sourcepub fn new_linear_gradient(
gradient: Gradient,
start: Point,
end: Point,
spread: Spread,
) -> Source<'a>
pub fn new_linear_gradient( gradient: Gradient, start: Point, end: Point, spread: Spread, ) -> Source<'a>
Creates a new linear gradient source where the start point corresponds to the gradient stop at position = 0 and the end point corresponds to the gradient stop at position = 1.
sourcepub fn new_radial_gradient(
gradient: Gradient,
center: Point,
radius: f32,
spread: Spread,
) -> Source<'a>
pub fn new_radial_gradient( gradient: Gradient, center: Point, radius: f32, spread: Spread, ) -> Source<'a>
Creates a new radial gradient that is centered at the given point and has the given radius.
Trait Implementations§
source§impl From<SolidSource> for Source<'_>
impl From<SolidSource> for Source<'_>
source§fn from(other: SolidSource) -> Self
fn from(other: SolidSource) -> Self
Auto Trait Implementations§
impl<'a> Freeze for Source<'a>
impl<'a> RefUnwindSafe for Source<'a>
impl<'a> Send for Source<'a>
impl<'a> Sync for Source<'a>
impl<'a> Unpin for Source<'a>
impl<'a> UnwindSafe for Source<'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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)