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 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>

Source

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

Source

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

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

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.