pub struct BandShape {
pub points: Vec<BandPoint>,
pub fill: Color32,
pub stroke: Stroke,
pub stroke_kind: StrokeKind,
pub angle: f32,
}Expand description
A varying-width band along a line segment.
If you want a meandering path of fixed width, use PathShape instead.
min_y
__________
/ \________
______/ |
| ________|
| __________/
|_______/
max_y
x-----x-x---------x-x-------x
Fields§
§points: Vec<BandPoint>The samples that define the lower and upper boundaries, sorted by BandPoint::x.
fill: Color32The fill color of the band.
stroke: StrokeAn optional stroke around the band.
The stroke follows the whole outline, end caps included.
stroke_kind: StrokeKindWhether the stroke is inside, outside, or centered on the band edge.
For anything but StrokeKind::Outside, the stroke color replaces the fill color.
angle: f32Rotate the band by this many radians clockwise around the origin (0, 0).
Implementations§
Source§impl BandShape
impl BandShape
pub fn new( points: Vec<BandPoint>, fill: impl Into<Color32>, stroke: impl Into<Stroke>, ) -> BandShape
pub fn filled(points: Vec<BandPoint>, fill: impl Into<Color32>) -> BandShape
pub fn stroke(points: Vec<BandPoint>, stroke: impl Into<Stroke>) -> BandShape
Sourcepub fn with_stroke_kind(self, stroke_kind: StrokeKind) -> BandShape
pub fn with_stroke_kind(self, stroke_kind: StrokeKind) -> BandShape
Set if the stroke is on the inside, outside, or centered on the band edge.
Sourcepub fn with_angle_and_pivot(self, angle: f32, pivot: Pos2) -> BandShape
pub fn with_angle_and_pivot(self, angle: f32, pivot: Pos2) -> BandShape
Set the rotation of the band (in radians, clockwise) around a custom pivot point.
The band keeps the position it already had at pivot, so calling this again
with a different angle rotates around the same point.
Sourcepub fn transform(&mut self, transform: TSTransform)
pub fn transform(&mut self, transform: TSTransform)
Transform the band in-place.
Sourcepub fn visual_bounding_rect(&self) -> Rect
pub fn visual_bounding_rect(&self) -> Rect
The visual bounding rectangle, including the stroke width.
Trait Implementations§
impl StructuralPartialEq for BandShape
Auto Trait Implementations§
impl Forget for BandShape
impl Freeze for BandShape
impl Move for BandShape
impl RefUnwindSafe for BandShape
impl Send for BandShape
impl Sync for BandShape
impl Unpin for BandShape
impl UnsafeUnpin for BandShape
impl UnwindSafe for BandShape
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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