Skip to main content

PaintCtx

Struct PaintCtx 

Source
pub struct PaintCtx { /* private fields */ }

Implementations§

Source§

impl PaintCtx

Source

pub const fn window_id(&self) -> WindowId

Source

pub const fn widget_id(&self) -> WidgetId

Source

pub fn observe<T, O>(&self, observable: &O) -> T
where O: Observable<T> + ?Sized,

Read an observable whose changes affect painting.

Source

pub fn observe_with<T, O>(&self, observable: &O, kind: InvalidationKind) -> T
where O: Observable<T> + ?Sized,

Read an observable and explicitly declare the resulting invalidation.

Source

pub const fn focused_widget_id(&self) -> Option<WidgetId>

Source

pub fn is_focused(&self) -> bool

Source

pub const fn bounds(&self) -> Rect

Source

pub const fn dpi(&self) -> DpiInfo

Source

pub fn measure_text( &self, text: impl Into<String>, style: TextStyle, ) -> Result<TextMeasurement, Error>

Source

pub fn shape_text( &self, text: impl Into<String>, box_size: Size, style: TextStyle, ) -> Result<TextLayout, Error>

Source

pub fn layout_text_document( &self, request: TextLayoutRequest, ) -> Result<TextLayout, Error>

Source

pub fn clear(&mut self, color: Color)

Source

pub fn fill(&mut self, path: impl Into<Path>, brush: impl Into<Brush>)

Source

pub fn fill_rect(&mut self, rect: Rect, brush: impl Into<Brush>)

Source

pub fn fill_bounds(&mut self, brush: impl Into<Brush>)

Source

pub fn stroke( &mut self, path: impl Into<Path>, brush: impl Into<Brush>, stroke: StrokeStyle, )

Source

pub fn stroke_rect( &mut self, rect: Rect, brush: impl Into<Brush>, stroke: StrokeStyle, )

Source

pub fn stroke_bounds(&mut self, brush: impl Into<Brush>, stroke: StrokeStyle)

Source

pub fn draw_text( &mut self, rect: Rect, text: impl Into<String>, style: TextStyle, )

Source

pub fn draw_text_layout(&mut self, origin: Point, layout: &TextLayout)

Source

pub fn draw_text_layout_with_color( &mut self, origin: Point, layout: &TextLayout, color: Color, )

Source

pub fn draw_persistent_text_layout( &mut self, origin: Point, layout: &PersistentTextLayout, )

Source

pub fn draw_persistent_text_layout_with_color( &mut self, origin: Point, layout: &PersistentTextLayout, color: Color, )

Source

pub fn draw_persistent_text_layout_window( &mut self, origin: Point, layout: &PersistentTextLayout, line_range: Range<usize>, )

Source

pub fn draw_persistent_text_layout_window_with_color( &mut self, origin: Point, layout: &PersistentTextLayout, line_range: Range<usize>, color: Color, )

Source

pub fn label(&mut self, rect: Rect, text: impl Into<String>, color: Color)

Source

pub fn push_text_render_policy(&mut self, policy: TextRenderPolicy)

Source

pub fn pop_text_render_policy(&mut self)

Source

pub fn draw_image(&mut self, rect: Rect, image: ImageHandle)

Source

pub fn image_registered(&self, image: ImageHandle) -> bool

Source

pub fn draw_image_source(&mut self, rect: Rect, source: ImageSource)

Source

pub fn draw_image_quad(&mut self, points: [Point; 4], image: ImageHandle)

Source

pub fn draw_image_quad_source( &mut self, points: [Point; 4], source: ImageSource, )

Source

pub fn widget_image_handle(&self, slot: u64) -> ImageHandle

Source

pub fn register_image(&mut self, handle: ImageHandle, image: RegisteredImage)

Source

pub fn register_external_image( &mut self, handle: ImageHandle, image: RegisteredExternalImage, )

Register renderer-neutral metadata for an externally owned image.

The active renderer must have a matching backend resource registered for handle. The external resource remains app-owned; this only makes its dimensions available to layout and scene construction for the current frame.

Source

pub fn draw_shader_rect(&mut self, rect: Rect, shader: WidgetShader)

Source

pub fn fill_rrect( &mut self, rect: Rect, radii: [f32; 4], brush: impl Into<Brush>, )

Fill a rounded rectangle (per-corner radii [tl, tr, br, bl]) with a brush.

Source

pub fn fill_rrect_bordered( &mut self, rect: Rect, radii: [f32; 4], brush: impl Into<Brush>, border: Border, )

Fill a rounded rectangle with a brush and stroke an inset border.

Source

pub fn draw_shadow(&mut self, rect: Rect, radii: [f32; 4], shadow: ShadowParams)

Paint just a soft drop shadow for a rounded rectangle (no fill).

Source

pub fn fill_rrect_with_shadow( &mut self, rect: Rect, radii: [f32; 4], brush: impl Into<Brush>, shadow: ShadowParams, )

Fill a rounded rectangle with a brush behind a soft drop shadow.

Source

pub fn push_clip(&mut self, path: impl Into<Path>)

Source

pub fn push_clip_rect(&mut self, rect: Rect)

Source

pub fn pop_clip(&mut self)

Source

pub fn push_transform(&mut self, transform: Transform)

Source

pub fn translate(&mut self, delta: Vector)

Source

pub fn pop_transform(&mut self)

Source

pub fn push(&mut self, command: SceneCommand)

Source

pub fn scene(&self) -> &Scene

Source

pub fn scene_mut(&mut self) -> &mut Scene

Source

pub fn request(&mut self, request: InvalidationRequest)

Source

pub fn request_paint(&mut self)

Source

pub fn request_paint_rect(&mut self, rect: Rect)

Source

pub fn invalidations(&self) -> &[InvalidationRequest]

Source

pub fn set_ime_composition_rect(&mut self, rect: Rect)

Source

pub fn clear_ime_composition_rect(&mut self)

Source

pub const fn ime_composition_rect(&self) -> Option<Rect>

Trait Implementations§

Source§

impl Clone for PaintCtx

Source§

fn clone(&self) -> PaintCtx

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PaintCtx

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ThemeExtension for T
where T: Any + Send + Sync,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

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