Skip to main content

PaintCtx

Struct PaintCtx 

Source
pub struct PaintCtx<'surface, Size> {
    pub clip: Option<Region>,
    /* private fields */
}
Expand description

Paint context used by the widgets to paint. It works in local coordinates, translated to screen position.

Fields§

§clip: Option<Region>

Implementations§

Source§

impl<'surface> PaintCtx<'surface, Unsized>

Source

pub fn new( surface: &'surface mut dyn WidgetRenderer, clip: Option<Region>, glyph_map: &'surface mut GlyphMap, ) -> Self

Source

pub fn into_sized( self, size: Size, global_pos: Pos, ) -> PaintCtx<'surface, SizePos>

Create a sized context at a given position

Source§

impl<'screen> PaintCtx<'screen, SizePos>

Source

pub fn to_unsized(&mut self) -> PaintCtx<'_, Unsized>

Source

pub fn update(&mut self, new_size: Size, new_pos: Pos)

Source

pub fn set_clip_region(&mut self, region: Region)

This will create an intersection with any previous regions

Source

pub fn create_region(&self) -> Region

Source

pub fn translate_to_global(&self, local: LocalPos) -> Option<Pos>

Source

pub fn to_glyphs<'a>(&mut self, s: &'a str) -> Glyphs<'a>

Source

pub fn place_glyphs( &mut self, glyphs: Glyphs<'_>, pos: LocalPos, ) -> Option<LocalPos>

Source

pub fn set_style(&mut self, style: Style, pos: LocalPos)

Source

pub fn set_attributes(&mut self, attrs: &Attributes<'_>, pos: LocalPos)

Source

pub fn place_glyph( &mut self, glyph: Glyph, input_pos: LocalPos, ) -> Option<LocalPos>

Trait Implementations§

Source§

impl<'surface> Deref for PaintCtx<'surface, SizePos>

Source§

type Target = SizePos

The resulting type after dereferencing.
Source§

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

Dereferences the value.

Auto Trait Implementations§

§

impl<'surface, Size> Freeze for PaintCtx<'surface, Size>
where Size: Freeze,

§

impl<'surface, Size> !RefUnwindSafe for PaintCtx<'surface, Size>

§

impl<'surface, Size> !Send for PaintCtx<'surface, Size>

§

impl<'surface, Size> !Sync for PaintCtx<'surface, Size>

§

impl<'surface, Size> Unpin for PaintCtx<'surface, Size>
where Size: Unpin,

§

impl<'surface, Size> UnsafeUnpin for PaintCtx<'surface, Size>
where Size: UnsafeUnpin,

§

impl<'surface, Size> !UnwindSafe for PaintCtx<'surface, Size>

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