pub struct Vector {
pub shape: VectorShape,
pub fill: Option<Fill>,
pub stroke: Option<VectorStroke>,
pub opacity: f32,
pub transform: Transform,
}Expand description
Full vector primitive — shape + fill + stroke + opacity + transform. The “what” + the “how it paints.”
fill and stroke are optional so a Vector can be a fill-only
silhouette, a stroke-only outline, or both. For mask use cases
neither is consulted — only Vector::shape matters.
Fields§
§shape: VectorShapeGeometry.
fill: Option<Fill>Optional fill paint. None means no fill (stroke-only).
stroke: Option<VectorStroke>Optional stroke paint. None means no stroke (fill-only).
opacity: f32Multiplicative opacity in [0, 1]. Combines with any alpha
already present in fill / stroke.
transform: TransformLocal transform applied to the shape before rasterization.
Implementations§
Source§impl Vector
impl Vector
Sourcepub fn new(shape: VectorShape) -> Self
pub fn new(shape: VectorShape) -> Self
Construct a Vector from a shape; no fill, no stroke, full
opacity, identity transform. Builder methods set the rest.
Sourcepub fn with_stroke(self, stroke: VectorStroke) -> Self
pub fn with_stroke(self, stroke: VectorStroke) -> Self
Builder: set the stroke paint.
Sourcepub fn with_opacity(self, opacity: f32) -> Self
pub fn with_opacity(self, opacity: f32) -> Self
Builder: set the opacity. Clamped to [0, 1] at apply-time
(the renderer uses f32::clamp when reading).
Sourcepub fn with_transform(self, transform: Transform) -> Self
pub fn with_transform(self, transform: Transform) -> Self
Builder: set the local transform.
Sourcepub fn to_graphics(&self) -> Option<Graphics>
pub fn to_graphics(&self) -> Option<Graphics>
Convert this vector primitive to a Graphics
node ready to add to the stage. Honors fill / stroke /
opacity / transform. Returns None for VectorShape::Path
— visible path rendering is deferred to M-VEC.10 / AUT-62;
today, paths can only drive masks via the path-clip primitives.
opacity is folded into the fill + stroke colors as an alpha
multiplier (the renderer doesn’t yet have a per-node opacity
channel; this is the practical equivalent for V1).
Trait Implementations§
impl StructuralPartialEq for Vector
Auto Trait Implementations§
impl Freeze for Vector
impl RefUnwindSafe for Vector
impl Send for Vector
impl Sync for Vector
impl Unpin for Vector
impl UnsafeUnpin for Vector
impl UnwindSafe for Vector
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<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