Struct kludgine::shapes::Shape

source ·
pub struct Shape<Unit, const TEXTURED: bool> { /* private fields */ }
Expand description

A tesselated shape.

This structure contains geometry that has been divided into triangles, ready to upload to the GPU. To render the shape, it must first be prepared.

Implementations§

source§

impl<Unit: PixelScaling> Shape<Unit, false>

source

pub fn filled_circle( radius: Unit, color: Color, origin: Origin<Unit> ) -> Shape<Unit, false>
where Unit: Default + Neg<Output = Unit> + Add<Output = Unit> + Ord + FloatConversion<Float = f32> + Copy,

Returns a circle that is filled solid with color.

source

pub fn stroked_circle( radius: Unit, origin: Origin<Unit>, options: impl Into<StrokeOptions<Unit>> ) -> Shape<Unit, false>
where Unit: Default + Neg<Output = Unit> + Add<Output = Unit> + Ord + FloatConversion<Float = f32> + Copy,

Returns a circle that is stroked with color and options.

source

pub fn filled_rect(rect: Rect<Unit>, color: Color) -> Shape<Unit, false>
where Unit: Add<Output = Unit> + Ord + FloatConversion<Float = f32> + Copy,

Returns a rectangle that is filled solid with color.

source

pub fn stroked_rect( rect: Rect<Unit>, options: impl Into<StrokeOptions<Unit>> ) -> Shape<Unit, false>
where Unit: Add<Output = Unit> + Ord + FloatConversion<Float = f32> + Copy,

Returns a rectangle that has its outline stroked with color and options.

source

pub fn filled_round_rect( rect: Rect<Unit>, corner_radius: impl Into<CornerRadii<Unit>>, color: Color ) -> Shape<Unit, false>
where Unit: Add<Output = Unit> + Sub<Output = Unit> + Div<Output = Unit> + Mul<f32, Output = Unit> + TryFrom<i32> + Ord + FloatConversion<Float = f32> + Copy, Unit::Error: Debug,

Returns a rounded rectangle with the specified corner radii that is filled solid with color.

source

pub fn stroked_round_rect( rect: Rect<Unit>, corner_radius: impl Into<CornerRadii<Unit>>, options: impl Into<StrokeOptions<Unit>> ) -> Shape<Unit, false>
where Unit: Add<Output = Unit> + Sub<Output = Unit> + Div<Output = Unit> + Mul<f32, Output = Unit> + TryFrom<i32> + Ord + FloatConversion<Float = f32> + Copy, Unit::Error: Debug,

Returns a rounded rectangle with the specified corner radii that has its outline stroked with color and options.

source

pub fn prepare(&self, graphics: &Graphics<'_>) -> PreparedGraphic<Unit>
where Unit: Copy, Vertex<Unit>: Pod,

Uploads the shape to the GPU.

source§

impl<Unit> Shape<Unit, true>

source

pub fn prepare( &self, texture: &impl TextureSource, graphics: &Graphics<'_> ) -> PreparedGraphic<Unit>
where Unit: Copy, Vertex<Unit>: Pod,

Uploads the shape to the GPU, applying texture to the polygons.

Trait Implementations§

source§

impl<Unit: Clone, const TEXTURED: bool> Clone for Shape<Unit, TEXTURED>

source§

fn clone(&self) -> Shape<Unit, TEXTURED>

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<Unit: Debug, const TEXTURED: bool> Debug for Shape<Unit, TEXTURED>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Unit, const TEXTURED: bool> Default for Shape<Unit, TEXTURED>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<Unit: PartialEq, const TEXTURED: bool> PartialEq for Shape<Unit, TEXTURED>

source§

fn eq(&self, other: &Shape<Unit, TEXTURED>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Unit, const TEXTURED: bool> DrawableSource for Shape<Unit, TEXTURED>
where Unit: Copy,

source§

impl<Unit, const TEXTURED: bool> ShapeSource<Unit, TEXTURED> for Shape<Unit, TEXTURED>
where Unit: Copy,

source§

impl<Unit, const TEXTURED: bool> StructuralPartialEq for Shape<Unit, TEXTURED>

Auto Trait Implementations§

§

impl<Unit, const TEXTURED: bool> RefUnwindSafe for Shape<Unit, TEXTURED>
where Unit: RefUnwindSafe,

§

impl<Unit, const TEXTURED: bool> Send for Shape<Unit, TEXTURED>
where Unit: Send,

§

impl<Unit, const TEXTURED: bool> Sync for Shape<Unit, TEXTURED>
where Unit: Sync,

§

impl<Unit, const TEXTURED: bool> Unpin for Shape<Unit, TEXTURED>
where Unit: Unpin,

§

impl<Unit, const TEXTURED: bool> UnwindSafe for Shape<Unit, TEXTURED>
where Unit: UnwindSafe + RefUnwindSafe,

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<A> Cast for A

source§

fn cast<To>(self) -> To
where To: CastFrom<A>,

Casts self to the To type. This may be a lossy operation.
source§

impl<A> CastFrom<A> for A

source§

fn from_cast(from: A) -> A

Returns from as Self.
source§

impl<A, B> CastInto<A> for B
where A: CastFrom<B>,

source§

fn cast_into(self) -> A

Returns self as To.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

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.
§

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.
§

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.
§

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.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

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

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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,

§

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>,

§

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>,

§

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSync for T
where T: Sync,