pub struct ClippedShape {
pub clip_rect: Rect,
pub shape: Shape,
pub transform_after_tessellation: TSTransform,
}Expand description
A Shape within a clip rectangle.
Everything is using logical points.
Fields§
§clip_rect: RectClip / scissor rectangle.
Only show the part of the Shape that falls within this.
shape: ShapeThe shape
transform_after_tessellation: TSTransformApplied to the tessellated result of shape, after it has been snapped to the pixel grid.
emath::TSTransform::IDENTITY means “no transform”, which is what you want most of the
time.
Snapping in the shape’s own coordinates makes the rendering converge on the untransformed
one, so this suits a transform that animates towards emath::TSTransform::IDENTITY, such
as a popup scaling into place: it doesn’t end with a jump of up to a pixel. The cost is
that the rendering is resampled, and so slightly blurrier, while the transform is not the
identity. For a lasting transform, such as a pan/zoom canvas, transform the shape itself.
Note that clip_rect is in the space this transform maps to.
Implementations§
Source§impl ClippedShape
impl ClippedShape
Sourcepub fn new(clip_rect: Rect, shape: impl Into<Shape>) -> ClippedShape
pub fn new(clip_rect: Rect, shape: impl Into<Shape>) -> ClippedShape
A shape with no Self::transform_after_tessellation.
Sourcepub fn transform(&mut self, transform: TSTransform)
pub fn transform(&mut self, transform: TSTransform)
Transform (move/scale) the shape in-place.
If using a PaintCallback, note that only the rect is scaled as opposed
to other shapes where the stroke is also scaled.
Trait Implementations§
Source§impl Clone for ClippedShape
impl Clone for ClippedShape
Source§fn clone(&self) -> ClippedShape
fn clone(&self) -> ClippedShape
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClippedShape
impl Debug for ClippedShape
Source§impl PartialEq for ClippedShape
impl PartialEq for ClippedShape
impl StructuralPartialEq for ClippedShape
Auto Trait Implementations§
impl !RefUnwindSafe for ClippedShape
impl !UnwindSafe for ClippedShape
impl Forget for ClippedShape
impl Freeze for ClippedShape
impl Move for ClippedShape
impl Send for ClippedShape
impl Sync for ClippedShape
impl Unpin for ClippedShape
impl UnsafeUnpin for ClippedShape
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