[−][src]Struct widgetry::geom::GeomBatch
A mutable builder for a group of colored polygons.
Fields
list: Vec<(Fill, Polygon, f64)>
autocrop_dims: bool
Implementations
impl GeomBatch
[src]
pub fn new() -> GeomBatch
[src]
Creates an empty batch.
pub fn push<F: Into<Fill>>(&mut self, fill: F, p: Polygon)
[src]
pub fn push_with_z<F: Into<Fill>>(&mut self, fill: F, p: Polygon, z_offset: f64)
[src]
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.
pub fn extend<F: Into<Fill>>(&mut self, fill: F, polys: Vec<Polygon>)
[src]
Applies one Fill 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<(Fill, Polygon, f64)>
[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.
pub fn set_z_offset(self, offset: f64) -> GeomBatch
[src]
Overrides the Z-ordering offset for the batch. Must be in (-1, 0], with values closer to -1 rendering on top.
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,