[][src]Struct ezgui::GeomBatch

pub struct GeomBatch {
    pub(crate) list: Vec<(FancyColor, Polygon)>,
    pub autocrop_dims: bool,
}

A mutable builder for a group of colored polygons.

Fields

list: Vec<(FancyColor, Polygon)>autocrop_dims: bool

Implementations

impl GeomBatch[src]

pub fn new() -> GeomBatch[src]

Creates an empty batch.

pub fn from(list: Vec<(Color, Polygon)>) -> GeomBatch[src]

Creates a batch of colored polygons.

pub fn push(&mut self, color: Color, p: Polygon)[src]

Adds a single colored polygon.

pub fn fancy_push(&mut self, color: FancyColor, p: Polygon)[src]

pub fn extend(&mut self, color: Color, polys: Vec<Polygon>)[src]

Applies one color to many polygons.

pub fn append(&mut self, other: GeomBatch)[src]

Appends all colored polygons from another batch to the current one.

pub fn consume(self) -> Vec<(FancyColor, Polygon)>[src]

Returns the colored polygons in this batch, destroying the batch.

pub fn draw(self, g: &mut GfxCtx)[src]

Draws the batch, consuming it. Only use this for drawing things once.

pub fn upload(self, ctx: &EventCtx) -> Drawable[src]

Upload the batch of polygons to the GPU, returning something that can be cheaply redrawn many times later.

pub fn batch(self) -> Widget[src]

Wrap in a Widget for layouting, so this batch can become part of a larger one.

pub fn to_btn(self, ctx: &EventCtx) -> BtnBuilder[src]

Turn this batch into a button.

pub fn get_bounds(&self) -> Bounds[src]

Compute the bounds of all polygons in this batch.

pub fn autocrop(self) -> GeomBatch[src]

Sets the top-left to 0, 0. Not sure exactly when this should be used.

pub fn unioned_polygon(&self) -> Polygon[src]

Builds a single polygon covering everything in this batch. Use to create a hitbox.

pub(crate) fn is_empty(&self) -> bool[src]

True when the batch is empty.

pub fn get_dims(&self) -> ScreenDims[src]

Returns the width and height of all geometry contained in the batch.

pub fn from_svg_contents(raw: Vec<u8>) -> GeomBatch[src]

Returns a batch containing a parsed SVG string.

pub fn load_svg(prerender: &Prerender, filename: &str) -> GeomBatch[src]

Returns a batch containing an SVG from a file.

pub fn color(self, transformation: RewriteColor) -> GeomBatch[src]

Transforms all colors in a batch.

pub fn centered_on(self, center: Pt2D) -> GeomBatch[src]

Translates the batch to be centered on some point.

pub fn translate(self, dx: f64, dy: f64) -> GeomBatch[src]

Translates the batch by some offset.

pub fn rotate(self, angle: Angle) -> GeomBatch[src]

Rotates each polygon in the batch relative to the center of that polygon.

pub fn rotate_around_batch_center(self, angle: Angle) -> GeomBatch[src]

Rotates each polygon in the batch relative to the center of the entire batch.

pub fn scale(self, factor: f64) -> GeomBatch[src]

Scales the batch by some factor.

Trait Implementations

impl Clone for GeomBatch[src]

Auto Trait Implementations

impl RefUnwindSafe for GeomBatch

impl Send for GeomBatch

impl Sync for GeomBatch

impl Unpin for GeomBatch

impl UnwindSafe for GeomBatch

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,