Skip to main content

DrawState

Struct DrawState 

Source
pub struct DrawState {
    pub cumulative_matrix: [f32; 6],
    /* private fields */
}
Expand description

Flat draw state tracking clips and transforms. Note: PushLayer and PopLayer commands are intentionally not tracked here; layers are managed outside this struct by the caller.

Fields§

§cumulative_matrix: [f32; 6]

Implementations§

Source§

impl DrawState

Source

pub fn new() -> Self

Source

pub fn push_clip(&mut self, rect: Rect) -> Rect

Pushes rect as a clip, intersected with whatever is already clipping, and returns the effective scissor.

A child clip that does not meet its parent clips away to nothing, and that case is worth spelling out because getting it wrong is invisible in every test that does not scroll: intersect answers None for two rects that do not overlap, and falling back to rect there hands the child its own box as the scissor — outside everything that contains it. A widget that emits a clip of its own (an image does, for a Cover overflow or a corner radius) therefore escaped the scroll area it lived in the moment it scrolled out of view: it went on being drawn at its true position, outside the panel, sliding as the content scrolled, and only looked right once its own box fell back inside the viewport. Nothing without a clip of its own could show the bug, which is why the text and boxes beside it in the same list were always clipped correctly.

Source

pub fn pop_clip(&mut self) -> Option<Rect>

Source

pub fn current_clip(&self) -> Option<Rect>

Source

pub fn push_matrix(&mut self, matrix: [f32; 6])

Source

pub fn pop_matrix(&mut self)

Source

pub fn apply_point(&self, x: f32, y: f32) -> (f32, f32)

Source

pub fn reset(&mut self)

Trait Implementations§

Source§

impl Default for DrawState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more