pub struct ShapeStyle {
pub kind: ShapeKind,
pub fill: [u8; 4],
pub stroke: [u8; 4],
pub stroke_width: f32,
pub corner: f32,
pub sides: u32,
pub points: Vec<(f32, f32)>,
pub w: Animated,
pub h: Animated,
pub strokes: Vec<Stroke>,
pub draw_rate: f32,
pub page: [u8; 4],
}Fields§
§kind: ShapeKind§fill: [u8; 4]§stroke: [u8; 4]§stroke_width: f32§corner: f32Rect corner radius / Arrow head size (project px).
sides: u32Polygon / Star sides.
points: Vec<(f32, f32)>Explicit Polygon vertices in project px relative to the shape centre (the Polygon tool places
and drags these). Empty = the regular sides-gon, so old projects keep their shape.
w: AnimatedHalf-size in project px (Rect/Ellipse/…) or the offset of the far end (Line/Arrow).
h: Animated§strokes: Vec<Stroke>Free-hand strokes for ShapeKind::Draw.
draw_rate: f32Playback rate of a recorded drawing (1 = as recorded, 2 = twice as fast, 0 = all at once).
page: [u8; 4]Page behind a drawing (alpha 0 = transparent, e.g. a white sketch page).
Implementations§
Source§impl ShapeStyle
impl ShapeStyle
pub fn new(kind: ShapeKind) -> Self
Sourcepub fn poly_points(&self) -> Option<&[(f32, f32)]>
pub fn poly_points(&self) -> Option<&[(f32, f32)]>
The explicit vertex list, or None when the regular sides-gon applies (fewer than 3 points
cannot enclose anything, so a half-placed path still draws as the n-gon).
Sourcepub fn path_points(&self) -> Vec<(f32, f32, f32)>
pub fn path_points(&self) -> Vec<(f32, f32, f32)>
The outline as a timed path, ready to drive an animation: a drawing’s strokes end to end, or an explicit polygon’s vertices (one per second, so a closed shape still has a direction).
Sourcepub fn draw_duration(&self) -> f64
pub fn draw_duration(&self) -> f64
Recorded length of a drawing in seconds.
pub fn cache_key(&self) -> u64
Trait Implementations§
Source§impl Clone for ShapeStyle
impl Clone for ShapeStyle
Source§fn clone(&self) -> ShapeStyle
fn clone(&self) -> ShapeStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ShapeStyle
impl Debug for ShapeStyle
Source§impl Default for ShapeStyle
impl Default for ShapeStyle
Source§impl<'de> Deserialize<'de> for ShapeStylewhere
ShapeStyle: Default,
impl<'de> Deserialize<'de> for ShapeStylewhere
ShapeStyle: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ShapeStyle
impl PartialEq for ShapeStyle
Source§impl Serialize for ShapeStyle
impl Serialize for ShapeStyle
impl StructuralPartialEq for ShapeStyle
Auto Trait Implementations§
impl Freeze for ShapeStyle
impl RefUnwindSafe for ShapeStyle
impl Send for ShapeStyle
impl Sync for ShapeStyle
impl Unpin for ShapeStyle
impl UnwindSafe for ShapeStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more