Skip to main content

PushedScope

Struct PushedScope 

Source
pub struct PushedScope<'c, 'a> { /* private fields */ }
Expand description

A pushed state that is popped when the guard goes out of scope. Derefs to the drawing context.

Methods from Deref<Target = DrawingContext<'a>>§

Source

pub fn draw_image(&mut self, source: &dyn IImage, rect: Rect)

Draws an image into rect.

Source

pub fn draw_image_with_rects( &mut self, source: &dyn IImage, source_rect: Rect, dest_rect: Rect, )

Draws the part of an image inside source_rect into dest_rect.

Source

pub fn draw_bitmap( &mut self, source: &RefCounted<SharedBitmapImpl>, opacity: f64, source_rect: Rect, dest_rect: Rect, )

Draws a platform bitmap.

Source

pub fn draw_line(&mut self, pen: &Rc<dyn IPen>, p1: Point, p2: Point)

Draws a line.

Source

pub fn draw_geometry( &mut self, brush: Option<&Rc<dyn IBrush>>, pen: Option<&Rc<dyn IPen>>, geometry: &Ref<Geometry>, )

Draws a geometry.

Source

pub fn draw_geometry_impl( &mut self, brush: Option<&Rc<dyn IBrush>>, pen: Option<&Rc<dyn IPen>>, geometry: &Arc<dyn IGeometryImpl>, )

Draws a platform geometry.

Source

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

Draws a rectangle with the specified brush and pen.

The brush and the pen can both be None. If the brush is None, no fill is performed. If the pen is None, no stroke is performed. If both are None and there are no box shadows, the call is a no-op.

Source

pub fn draw_rounded_rectangle( &mut self, brush: Option<&Rc<dyn IBrush>>, pen: Option<&Rc<dyn IPen>>, rrect: RoundedRect, box_shadows: &BoxShadows, )

Draws a rounded rectangle with the specified brush and pen.

Source

pub fn draw_rectangle_outline( &mut self, pen: &Rc<dyn IPen>, rect: Rect, corner_radius: f32, )

Draws the outline of a rectangle.

Source

pub fn fill_rectangle( &mut self, brush: &Rc<dyn IBrush>, rect: Rect, corner_radius: f32, )

Draws a filled rectangle.

Source

pub fn draw_ellipse_at( &mut self, brush: Option<&Rc<dyn IBrush>>, pen: Option<&Rc<dyn IPen>>, center: Point, radius_x: f64, radius_y: f64, )

Draws an ellipse given its center and radii.

Source

pub fn draw_ellipse( &mut self, brush: Option<&Rc<dyn IBrush>>, pen: Option<&Rc<dyn IPen>>, rect: Rect, )

Draws an ellipse inscribed in a rectangle.

Source

pub fn custom(&mut self, custom: &Arc<dyn ICustomDrawOperation>)

Draws a custom drawing operation.

Source

pub fn draw_text(&mut self, text: &FormattedText, origin: Point)

Draws text. origin is the upper-left corner of the text.

Source

pub fn draw_glyph_run( &mut self, foreground: Option<&Rc<dyn IBrush>>, glyph_run: &Rc<GlyphRun>, )

Draws a glyph run.

Source

pub fn draw_rectangle_acrylic( &mut self, material: &dyn IExperimentalAcrylicMaterial, rect: RoundedRect, )

Draws a rectangle filled with an acrylic-like material. A core without acrylic support fills the rectangle with the fallback color of the material; see IDrawingContextCore::draw_rectangle_acrylic_core.

Source

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

Pops a pushed state (C# PushedState.Dispose).

Panics if the state is not the most recently pushed one. Popping PushedState::NONE, or any state after the context has been disposed, does nothing.

Source

pub fn scope(&mut self, state: PushedState) -> PushedScope<'_, 'a>

Turns a pushed state into a guard that derefs to the context and pops the state when dropped.

Source

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

Pushes a rounded clip rectangle.

Source

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

Pushes a clip rectangle.

Source

pub fn push_geometry_clip(&mut self, clip: &Ref<Geometry>) -> PushedState

Pushes a clip geometry.

Source

pub fn push_opacity(&mut self, opacity: f64) -> PushedState

Pushes an opacity value.

Source

pub fn push_opacity_mask( &mut self, mask: &Rc<dyn IBrush>, bounds: Rect, ) -> PushedState

Pushes an opacity mask.

bounds are the bounds of the control, used to place brushes correctly.

Source

pub fn push_transform(&mut self, matrix: Matrix) -> PushedState

Pushes a matrix transformation.

Source

pub fn push_render_options( &mut self, render_options: RenderOptions, ) -> PushedState

Pushes render options.

Source

pub fn push_text_options(&mut self, text_options: TextOptions) -> PushedState

Pushes text options.

Source

pub fn push_effect( &mut self, effect: &Rc<dyn IEffect>, bounds: Rect, ) -> PushedState

Pushes an effect applied to everything drawn until the state is popped. bounds are the bounds of the affected content.

Trait Implementations§

Source§

impl<'a> Deref for PushedScope<'_, 'a>

Source§

type Target = DrawingContext<'a>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl DerefMut for PushedScope<'_, '_>

Source§

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

Mutably dereferences the value.
Source§

impl Drop for PushedScope<'_, '_>

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§

§

impl<'c, 'a> !RefUnwindSafe for PushedScope<'c, 'a>

§

impl<'c, 'a> !Send for PushedScope<'c, 'a>

§

impl<'c, 'a> !Sync for PushedScope<'c, 'a>

§

impl<'c, 'a> !UnwindSafe for PushedScope<'c, 'a>

§

impl<'c, 'a> Freeze for PushedScope<'c, 'a>

§

impl<'c, 'a> Unpin for PushedScope<'c, 'a>

§

impl<'c, 'a> UnsafeUnpin for PushedScope<'c, '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> 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<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 = !

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.