Skip to main content

CompositorDrawingContextProxy

Struct CompositorDrawingContextProxy 

Source
pub struct CompositorDrawingContextProxy { /* private fields */ }
Expand description

A drawing context that forwards to another one, postponing state changes until they are needed and applying an optional post transform.

Implementations§

Source§

impl CompositorDrawingContextProxy

Source

pub fn new(inner: Box<dyn IDrawingContextImpl>) -> Self

Source

pub fn into_inner(self) -> Box<dyn IDrawingContextImpl>

Flushes the pending commands and returns the wrapped context.

Source

pub fn post_transform(&self) -> Option<Matrix>

Source

pub fn set_post_transform(&mut self, value: Option<Matrix>)

Source

pub fn auto_flush(&self) -> bool

Source

pub fn set_auto_flush(&mut self, value: bool)

Source

pub fn flush(&mut self)

Trait Implementations§

Source§

impl IDrawingContextImpl for CompositorDrawingContextProxy

Source§

fn transform(&self) -> Matrix

The current transform of the drawing context.
Source§

fn set_transform(&mut self, value: Matrix)

Sets the current transform of the drawing context.
Source§

fn clear(&mut self, color: Color)

Clears the render target to the specified color.
Source§

fn draw_bitmap( &mut self, source: &dyn IBitmapImpl, opacity: f64, source_rect: Rect, dest_rect: Rect, )

Draws a bitmap image.
Source§

fn draw_bitmap_with_mask( &mut self, source: &dyn IBitmapImpl, opacity_mask: &dyn IBrush, opacity_mask_rect: Rect, dest_rect: Rect, )

Draws a bitmap image through an opacity mask.
Source§

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

Draws a line.
Source§

fn draw_geometry( &mut self, brush: Option<&dyn IBrush>, pen: Option<&dyn IPen>, geometry: &dyn IGeometryImpl, )

Draws a geometry.
Source§

fn draw_rectangle( &mut self, brush: Option<&dyn IBrush>, pen: Option<&dyn IPen>, rect: RoundedRect, box_shadows: &BoxShadows, )

Draws a rectangle with the specified brush and pen. Read more
Source§

fn draw_region( &mut self, brush: Option<&dyn IBrush>, pen: Option<&dyn IPen>, region: &dyn IPlatformRenderInterfaceRegion, )

Draws a region with the specified brush and pen.
Source§

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

Draws an ellipse with the specified brush and pen.
Source§

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

Draws a glyph run.
Source§

fn create_layer(&mut self, size: PixelSize) -> Rc<dyn IDrawingContextLayerImpl>

Creates a new layer: an offscreen render target compatible with this drawing context that can be blitted back onto it.
Source§

fn push_clip(&mut self, clip: Rect)

Pushes a clip rectangle.
Source§

fn push_clip_rounded(&mut self, clip: RoundedRect)

Pushes a rounded clip rectangle.
Source§

fn push_clip_region(&mut self, region: &dyn IPlatformRenderInterfaceRegion)

Pushes a clip region.
Source§

fn pop_clip(&mut self)

Pops the latest pushed clip rectangle or region.
Source§

fn push_layer(&mut self, bounds: Rect)

Enforces rendering to happen on an intermediate surface.
Source§

fn pop_layer(&mut self)

Pops the latest pushed intermediate surface layer.
Source§

fn push_opacity(&mut self, opacity: f64, bounds: Option<Rect>)

Pushes an opacity value.
Source§

fn pop_opacity(&mut self)

Pops the latest pushed opacity value.
Source§

fn push_opacity_mask(&mut self, mask: &dyn IBrush, bounds: Rect)

Pushes an opacity mask.
Source§

fn pop_opacity_mask(&mut self)

Pops the latest pushed opacity mask.
Source§

fn push_geometry_clip(&mut self, clip: &dyn IGeometryImpl)

Pushes a clip geometry.
Source§

fn pop_geometry_clip(&mut self)

Pops the latest pushed geometry clip.
Source§

fn push_render_options(&mut self, render_options: RenderOptions)

Pushes render options.
Source§

fn pop_render_options(&mut self)

Pops the latest pushed render options.
Source§

fn push_text_options(&mut self, text_options: TextOptions)

Pushes text options for the drawing context.
Source§

fn pop_text_options(&mut self)

Pops the latest text options.
Source§

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

Attempts to get an optional feature from the drawing context implementation; see IOptionalFeatureProvider.
Source§

fn try_push_compositing_layer( &mut self, blend: BitmapBlendingMode, opacity: f64, bounds: Rect, ) -> bool

Begins one isolated group for vectors, text and images, composed with blend and multiplied by opacity when popped. Bounds are in the current coordinate space and are an allocation hint, not a clip. Returning false leaves every drawing state unchanged.
Source§

fn pop_compositing_layer(&mut self)

Pops a successful try_push_compositing_layer and restores its state.
Source§

fn as_drawing_context_impl_with_effects( &mut self, ) -> Option<&mut dyn IDrawingContextImplWithEffects>

The context viewed as IDrawingContextImplWithEffects, when the backend can apply bitmap effects. This replaces the interface cast (impl as IDrawingContextImplWithEffects): a backend that implements the trait overrides this to return itself.
Source§

fn as_drawing_context_with_acrylic_like_support( &mut self, ) -> Option<&mut dyn IDrawingContextWithAcrylicLikeSupport>

The context viewed as IDrawingContextWithAcrylicLikeSupport, when the backend can draw acrylic-like materials. This replaces the interface cast: a backend that implements the trait overrides this to return itself.
Source§

fn as_drawing_context_impl_with_layer_effects( &mut self, ) -> Option<&mut dyn IDrawingContextImplWithLayerEffects>

The context viewed as IDrawingContextImplWithLayerEffects, when the backend can compose a layer with a blend mode or through a colour matrix. A backend that implements the trait overrides this to return itself.
Source§

fn as_drawing_context_impl_with_fragments( &mut self, ) -> Option<&mut dyn IDrawingContextImplWithFragments>

The context viewed as IDrawingContextImplWithFragments, when the backend can keep what is drawn as fragments and draw them again. A backend that implements the trait overrides this to return itself.
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Lets the backend recover its concrete type.
Source§

fn dispose(&mut self)

Finishes drawing and releases the context (presenting the frame where the context was created by a render target).
Source§

impl IDrawingContextImplWithEffects for CompositorDrawingContextProxy

Source§

fn push_effect(&mut self, clip_rect: Option<Rect>, effect: &dyn IEffect)

Pushes an effect: everything drawn until the matching pop_effect is drawn through it. clip_rect bounds the output of the effect, when known.
Source§

fn pop_effect(&mut self)

Pops the latest pushed effect.
Source§

impl IDrawingContextImplWithFragments for CompositorDrawingContextProxy

Source§

fn begin_fragment(&mut self)

Starts a fragment: what is drawn until the matching end_fragment is drawn as usual and also kept. Fragments do not nest; pushes and pops in between are balanced.
Source§

fn end_fragment(&mut self) -> Option<Rc<dyn IDrawingFragment>>

Ends the fragment that was started last. What was drawn stays drawn. Returns the fragment, or None when what was drawn cannot be drawn again from a fragment.
Source§

fn draw_fragment(&mut self, fragment: &Rc<dyn IDrawingFragment>) -> bool

Draws a fragment that this context’s backend made in an earlier frame, when doing so at the current state gives the pixels the commands it was made of would give. Returns false without drawing anything otherwise.
Source§

impl IDrawingContextImplWithLayerEffects for CompositorDrawingContextProxy

Source§

fn push_blend_layer(&mut self, bounds: Rect, mode: BitmapBlendingMode)

Pushes a layer: what is drawn until the matching pop_blend_layer is composed onto what is under it with mode (the Porter-Duff modes compose, the others mix and compose source-over). bounds is the area drawn into, in the coordinates of the context.
Source§

fn pop_blend_layer(&mut self)

Pops the latest blend layer.
Source§

fn push_color_matrix_layer( &mut self, bounds: Rect, matrix: &ColorMatrix, alpha_mode: ColorMatrixAlphaMode, )

Pushes a layer: what is drawn until the matching pop_color_matrix_layer is transformed by matrix (applied to premultiplied or straight colours, as alpha_mode says) and composed source-over onto what is under it. bounds is the area drawn into, in the coordinates of the context; nothing outside it is kept.
Source§

fn pop_color_matrix_layer(&mut self)

Pops the latest colour matrix layer.
Source§

fn push_multiply_layer(&mut self, bounds: Rect, factors: &MultiplyLayerFactors)

Pushes a layer: each colour channel of what is drawn until the matching pop_multiply_layer is multiplied by the factor factors has at that point (stretched over bounds, sampled bilinearly), the alpha is kept, and the result is composed source-over onto what is under it. A factor can exceed 1 (up to MultiplyLayerFactors::scale); the result is clamped to the alpha. bounds is the area drawn into, in the coordinates of the context; nothing outside it is kept. What the lights of WinUI’s composition are drawn with (winui-materials.md).
Source§

fn pop_multiply_layer(&mut self)

Pops the latest multiply layer.
Source§

impl IDrawingContextWithAcrylicLikeSupport for CompositorDrawingContextProxy

Source§

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

Draws a rectangle filled with an acrylic-like material.

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.