PaintCx

Struct PaintCx 

Source
pub struct PaintCx<'a> {
    pub window_state: &'a mut WindowState,
    pub gpu_resources: Option<GpuResources>,
    pub window: Arc<dyn Window>,
    /* private fields */
}

Fields§

§window_state: &'a mut WindowState§gpu_resources: Option<GpuResources>§window: Arc<dyn Window>

Implementations§

Source§

impl PaintCx<'_>

Source

pub fn save(&mut self)

Source

pub fn restore(&mut self)

Source

pub fn is_drag_paint(&self, id: ViewId) -> bool

Allows a View to determine if it is being called in order to paint a draggable image of itself during a drag (likely draggable() was called on the View or ViewId) as opposed to a normal paint in order to alter the way it renders itself.

Source

pub fn paint_children(&mut self, id: ViewId)

Paint the children of this view using simplified stacking semantics.

In the simplified stacking model:

  • Every view is implicitly a stacking context
  • z-index only competes with siblings
  • Children are always bounded within their parent (no “escaping”)
Source

pub fn paint_view(&mut self, id: ViewId)

The entry point for painting a view. You shouldn’t need to implement this yourself. Instead, implement [View::paint]. It handles the internal work before and after painting [View::paint] implementations. It is responsible for

  • managing hidden status
  • clipping
  • painting computed styles like background color, border, font-styles, and z-index and handling painting requirements of drag and drop
Source

pub fn paint_pending_drag(&mut self)

Paint the drag overlay after the main tree has been painted. This ensures the dragged view always appears on top of all other content.

Source

pub fn paint_overlays(&mut self, root_id: ViewId)

Paint all registered overlays for the given root view.

Overlays are painted at the root level, above all regular content but below drag overlays. They are sorted by z-index (lower z-index painted first).

The overlay views are skipped during normal tree traversal (in collect_stacking_context_items) and painted here at root level so they appear above all other content.

Source

pub fn clip(&mut self, shape: &impl Shape)

Clip the drawing area to the given shape.

Source

pub fn clear_clip(&mut self)

Remove clipping so the entire window can be rendered to.

Source

pub fn offset(&mut self, offset: (f64, f64))

Source

pub fn transform(&mut self, id: ViewId) -> Size

Source

pub fn is_focused(&self, id: ViewId) -> bool

Methods from Deref<Target = Renderer>§

Source

pub fn resize(&mut self, scale: f64, size: Size)

Source

pub fn set_scale(&mut self, scale: f64)

Source

pub fn scale(&self) -> f64

Source

pub fn size(&self) -> Size

Trait Implementations§

Source§

impl Deref for PaintCx<'_>

Source§

type Target = Renderer

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for PaintCx<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for PaintCx<'a>

§

impl<'a> !RefUnwindSafe for PaintCx<'a>

§

impl<'a> !Send for PaintCx<'a>

§

impl<'a> !Sync for PaintCx<'a>

§

impl<'a> Unpin for PaintCx<'a>

§

impl<'a> !UnwindSafe for PaintCx<'a>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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
Source§

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

Source§

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