pub struct ClipStack { /* private fields */ }Expand description
A push-down stack of intersecting clip rectangles.
Each push intersects the new rect with the current top and stores the
result. Callers are therefore always looking at the effective clip, never
the raw per-layer rect.
Implementations§
Source§impl ClipStack
impl ClipStack
Sourcepub fn push(&mut self, rect: ClipRect)
pub fn push(&mut self, rect: ClipRect)
Push a new clip rect, intersecting it with the current top.
If the stack is empty, rect is pushed directly. If the intersection
with the current top is empty, nothing is pushed and the stack is
unchanged (the new layer would clip everything away anyway; the caller
should balance pushes with pops regardless).
Sourcepub fn pop(&mut self)
pub fn pop(&mut self)
Pop the topmost clip rect. Does nothing (no panic) if the stack is empty.
Sourcepub fn current(&self) -> Option<&ClipRect>
pub fn current(&self) -> Option<&ClipRect>
Return the current (topmost, effective) clip rect, or None if the
stack is empty.
Sourcepub fn as_scissor(&self) -> Option<[u32; 4]>
pub fn as_scissor(&self) -> Option<[u32; 4]>
Return the current clip as integer [x, y, w, h] rounded outward
(floor on origin, ceil on extent).
Returns None if the stack is empty. Negative components are clamped
to zero before the conversion.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClipStack
impl RefUnwindSafe for ClipStack
impl Send for ClipStack
impl Sync for ClipStack
impl Unpin for ClipStack
impl UnsafeUnpin for ClipStack
impl UnwindSafe for ClipStack
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> 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