Enum raqote::draw_target::Source

source ·
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>

source

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.

source

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.

source

pub fn new_two_circle_radial_gradient( gradient: Gradient, center1: Point, radius1: f32, center2: Point, radius2: f32, spread: Spread, ) -> Source<'a>

Creates a new radial gradient that is centered at the given point and has the given radius.

source

pub fn new_sweep_gradient( gradient: Gradient, center: Point, start_angle: f32, end_angle: f32, spread: Spread, ) -> Source<'a>

Creates a new sweep gradient that is centered at the given point with start_angle and end_angle.

Trait Implementations§

source§

impl<'a> Clone for Source<'a>

source§

fn clone(&self) -> Source<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl From<Color> for Source<'_>

source§

fn from(color: Color) -> Self

Converts to this type from the input type.
source§

impl From<SolidSource> for Source<'_>

source§

fn from(other: SolidSource) -> Self

Converts to this type from the input type.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.