Skip to main content

ImmediateDrawingContext

Struct ImmediateDrawingContext 

Source
pub struct ImmediateDrawingContext<'a> { /* private fields */ }
Expand description

A drawing context that draws immediately to a platform drawing context implementation, using immutable resources only. This is what custom draw operations render with.

Implementations§

Source§

impl<'a> ImmediateDrawingContext<'a>

Source

pub fn new(platform_impl: Box<dyn IDrawingContextImpl + 'a>) -> Self

Creates a context that owns platform_impl and disposes it with the context.

Source

pub fn borrowed(platform_impl: &'a mut dyn IDrawingContextImpl) -> Self

Creates a context over a borrowed implementation.

Source

pub fn borrowed_with_transform( platform_impl: &'a mut dyn IDrawingContextImpl, transform: Matrix, ) -> Self

Creates a context over a borrowed implementation with an explicit container transform.

Source

pub fn platform_impl(&mut self) -> &mut (dyn IDrawingContextImpl + 'a)

The platform drawing context implementation.

Source

pub fn current_transform(&self) -> Matrix

The current transform of the drawing context.

Source

pub fn draw_bitmap(&mut self, source: &Bitmap, rect: Rect)

Draws a bitmap into rect.

Source

pub fn draw_bitmap_rects( &mut self, source: &Bitmap, source_rect: Rect, dest_rect: Rect, )

Draws the part of a bitmap inside source_rect into dest_rect.

Source

pub fn draw_bitmap_impl( &mut self, source: &dyn IBitmapImpl, source_rect: Rect, dest_rect: Rect, )

Draws a platform bitmap: draw_bitmap_rects for callers that hold the platform implementation only.

Source

pub fn draw_line(&mut self, pen: &ImmutablePen, p1: Point, p2: Point)

Draws a line.

Source

pub fn draw_rectangle( &mut self, brush: Option<&dyn IImmutableBrush>, pen: Option<&ImmutablePen>, rect: Rect, radius_x: f64, radius_y: f64, box_shadows: &BoxShadows, )

Draws a rectangle with the specified brush and pen.

Source

pub fn draw_rectangle_outline( &mut self, pen: &ImmutablePen, rect: Rect, corner_radius: f32, )

Draws the outline of a rectangle.

Source

pub fn draw_ellipse( &mut self, brush: Option<&dyn IImmutableBrush>, pen: Option<&ImmutablePen>, center: Point, radius_x: f64, radius_y: f64, )

Draws an ellipse with the specified brush and pen.

Source

pub fn draw_glyph_run( &mut self, foreground: &dyn IImmutableBrush, glyph_run: &dyn IImmutableGlyphRunReference, )

Draws a glyph run, if the reference still holds its platform glyph run.

Source

pub fn fill_rectangle( &mut self, brush: &dyn IImmutableBrush, rect: Rect, corner_radius: f32, )

Draws a filled rectangle.

Source

pub fn pop(&mut self, state: ImmediatePushedState)

Pops a pushed state (C# PushedState.Dispose). Panics if the state is not the most recently pushed one.

Source

pub fn push_rounded_clip(&mut self, clip: RoundedRect) -> ImmediatePushedState

Pushes a rounded clip rectangle.

Source

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

Pushes a clip rectangle.

Source

pub fn push_opacity( &mut self, opacity: f64, bounds: Rect, ) -> ImmediatePushedState

Pushes an opacity value.

Source

pub fn push_opacity_mask( &mut self, mask: &dyn IImmutableBrush, bounds: Rect, ) -> ImmediatePushedState

Pushes an opacity mask.

Source

pub fn push_post_transform(&mut self, matrix: Matrix) -> ImmediatePushedState

Pushes a matrix post-transformation.

Source

pub fn push_pre_transform(&mut self, matrix: Matrix) -> ImmediatePushedState

Pushes a matrix pre-transformation.

Source

pub fn push_set_transform(&mut self, matrix: Matrix) -> ImmediatePushedState

Sets the current matrix transformation.

Source

pub fn push_transform_container(&mut self) -> ImmediatePushedState

Pushes a new transform context.

Source

pub fn dispose(self)

Pops every state still pushed and releases the context (and the platform implementation, if the context owns it).

Source

pub fn try_get_feature(&mut self, feature_type: TypeId) -> Option<Rc<dyn Any>>

Queries the platform drawing context implementation for an optional feature.

Trait Implementations§

Source§

impl Drop for ImmediateDrawingContext<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.