Struct widgetry::GeomBatch[][src]

pub struct GeomBatch {
    pub(crate) list: Vec<(Fill, Polygon, f64)>,
    pub autocrop_dims: bool,
}
Expand description

A mutable builder for a group of colored polygons.

Fields

list: Vec<(Fill, Polygon, f64)>autocrop_dims: bool

Implementations

Creates an empty batch.

Adds a single polygon, painted according to Fill

Offset z value to render above/below other polygons. z must be in (-1, 0] to ensure we don’t traverse layers of the UI - to make sure we don’t inadvertently render something above a tooltip, etc.

Adds a single polygon to the front of the batch, painted according to Fill

Applies one Fill to many polygons.

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

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

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

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

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

Wrap in a Widget, so the batch can be drawn as part of a Panel.

Compute the bounds of all polygons in this batch.

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

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

True when the batch is empty.

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

Returns a batch containing an SVG from a file.

Returns a GeomBatch from the bytes of a utf8 encoded SVG string.

Returns a GeomBatch from the bytes of a utf8 encoded SVG string.

Prefer to use load_svg_bytes, which caches the parsed SVG, unless the SVG was dynamically generated, or is otherwise unlikely to be reused.

Transforms all colors in a batch.

Translates the batch to be centered on some point.

Translates the batch by some offset.

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

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

Scales the batch by some factor.

Overrides the Z-ordering offset for the batch. Must be in (-1, 0], with values closer to -1 rendering on top.

Exports the batch to a list of GeoJSON features, labeling each colored polygon. Z-values, alpha values from the color, and non-RGB fill patterns are lost. If the polygon isn’t a ring, it’s skipped. The world-space coordinates are optionally translated back to GPS.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Creates a batch of filled polygons.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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. Read more

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

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

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

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

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.