pub trait ShapePieceBuilder: Sized {
// Required methods
fn fill<M>(self, p: impl IntoReactive<Color, M>) -> Self;
fn fill_linear<M>(self, g: impl IntoReactive<LinearGradient, M>) -> Self;
fn fill_radial<M>(self, g: impl IntoReactive<RadialGradient, M>) -> Self;
fn stroke<M1, M2>(
self,
color: impl IntoReactive<Color, M1>,
width: impl IntoReactive<f64, M2>,
) -> Self;
fn inset<M>(self, v: impl IntoReactive<f64, M>) -> Self;
fn rotate<M>(self, deg: impl IntoReactive<f64, M>) -> Self;
fn scale<M>(self, s: impl IntoReactive<f64, M>) -> Self;
fn offset<M1, M2>(
self,
x: impl IntoReactive<f64, M1>,
y: impl IntoReactive<f64, M2>,
) -> Self;
fn at(self, fx: f64, fy: f64, fw: f64, fh: f64) -> Self;
fn on_tap(self, f: impl Fn() + 'static) -> Self;
fn on_drag(self, f: impl Fn(Drag) + 'static) -> Self;
}Expand description
Builder methods of ShapePiece, reachable through a Decorated (docs/api-style.md “Typed builders and erasure”): generic modifiers and typed ones chain in any order.
Required Methods§
fn fill<M>(self, p: impl IntoReactive<Color, M>) -> Self
Sourcefn fill_linear<M>(self, g: impl IntoReactive<LinearGradient, M>) -> Self
fn fill_linear<M>(self, g: impl IntoReactive<LinearGradient, M>) -> Self
Fill with a LinearGradient (unit points resolve against the shape’s bounds). Takes
precedence over Self::fill when both are set; reactive like every other property:
rectangle().fill_linear(move || sky_gradient(state.get())).
Sourcefn fill_radial<M>(self, g: impl IntoReactive<RadialGradient, M>) -> Self
fn fill_radial<M>(self, g: impl IntoReactive<RadialGradient, M>) -> Self
Fill with a RadialGradient (center + radius in the unit space of the shape’s bounds,
stretching elliptically in non-square bounds). Precedence: radial over linear over solid.
fn stroke<M1, M2>( self, color: impl IntoReactive<Color, M1>, width: impl IntoReactive<f64, M2>, ) -> Self
Sourcefn inset<M>(self, v: impl IntoReactive<f64, M>) -> Self
fn inset<M>(self, v: impl IntoReactive<f64, M>) -> Self
Uniform inset applied before resolving geometry (keeps strokes inside the frame).
Sourcefn rotate<M>(self, deg: impl IntoReactive<f64, M>) -> Self
fn rotate<M>(self, deg: impl IntoReactive<f64, M>) -> Self
Rotate the drawn shape about its center, in degrees.
Sourcefn scale<M>(self, s: impl IntoReactive<f64, M>) -> Self
fn scale<M>(self, s: impl IntoReactive<f64, M>) -> Self
Scale the drawn shape about its center (uniform).
Sourcefn offset<M1, M2>(
self,
x: impl IntoReactive<f64, M1>,
y: impl IntoReactive<f64, M2>,
) -> Self
fn offset<M1, M2>( self, x: impl IntoReactive<f64, M1>, y: impl IntoReactive<f64, M2>, ) -> Self
Translate the drawn shape within its frame.
Sourcefn at(self, fx: f64, fy: f64, fw: f64, fh: f64) -> Self
fn at(self, fx: f64, fy: f64, fw: f64, fh: f64) -> Self
Resolve this shape inside the fractional sub-rect (fx, fy, fw, fh) of its bounds
(unit-space, applied before Self::inset). The workhorse for composing glyphs in a
shape_group, mirroring hand-drawn Rect::new(ox + fx * s, oy + fy * s, …) canvas code.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".