Struct widgetry::GeomBatch [−][src]
Expand description
A mutable builder for a group of colored polygons.
Fields
list: Vec<(Fill, Polygon, f64)>
autocrop_dims: bool
Implementations
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.
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.
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.
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
Auto Trait Implementations
impl RefUnwindSafe for GeomBatch
impl UnwindSafe for GeomBatch
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: 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
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub 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. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self