radiant_rs::support

Struct DrawBuilder

Source
pub struct DrawBuilder<'a, T: 'a> { /* private fields */ }
Expand description

A rectangle builder.

Obtained from Renderer::rect() or Renderer::fill()

Implementations§

Source§

impl<'a, T> DrawBuilder<'a, T>

The following implementations are available when drawing with Renderer::rect() or Renderer::fill().

Source

pub fn color(self, color: Color) -> Self

Sets a color for drawing. Defaults to white. If a texture is supplied in addtion to the color, each fragment will be computed from texel color * color.

Source

pub fn texture(self, texture: &'a Texture) -> Self

Sets the texture for drawing. If a color is supplied in addtion to the texture, each fragment will be computed from texel color * color.

Source

pub fn blendmode(self, blendmode: BlendMode) -> Self

Sets the blendmode used to blend the source with the target.

Source

pub fn program(self, program: &'a Program) -> Self

Sets the fragment shader program used to draw.

Source

pub fn model_matrix(self, model_matrix: [[f32; 4]; 4]) -> Self

Sets a model matrix for drawing.

Source

pub fn draw(self)

Draws the rectangle.

Source§

impl<'a> DrawBuilder<'a, DrawBuilderRect>

The following implementations are only available when drawing with Renderer::rect()

Source

pub fn view_matrix(self, view_matrix: [[f32; 4]; 4]) -> Self

Sets a view matrix for drawing.

Source

pub fn view_target(self) -> Self

Uses a view matrix that maps the dimensions of the target to the pixel-size of the target.

This is the default setting. It means that a point, e.g. (12., 34.) is mapped to the pixel (12, 34) on the target.

Source

pub fn view_display(self) -> Self

Uses a view matrix that maps the dimensions of the display to the pixel-size of the target.

Source

pub fn view_source(self) -> Self

Uses a view matrix that maps the dimensions of the source to the pixel-size of the target.

Source

pub fn view_one(self) -> Self

Uses a matrix that maps the entire target to a rectangle of (0., 0., 1., 1.)

Trait Implementations§

Source§

impl<'a, T: Clone + 'a> Clone for DrawBuilder<'a, T>

Source§

fn clone(&self) -> DrawBuilder<'a, T>

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

Auto Trait Implementations§

§

impl<'a, T> Freeze for DrawBuilder<'a, T>

§

impl<'a, T> !RefUnwindSafe for DrawBuilder<'a, T>

§

impl<'a, T> !Send for DrawBuilder<'a, T>

§

impl<'a, T> !Sync for DrawBuilder<'a, T>

§

impl<'a, T> Unpin for DrawBuilder<'a, T>

§

impl<'a, T> !UnwindSafe for DrawBuilder<'a, T>

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Float, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<Swp, Dwp, T>,

Convert the source color to the destination color using the specified method
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> SetParameter for T

Source§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result
where T: Parameter<Self>,

Sets value as a parameter of self.
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.
Source§

impl<T> Erased for T