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
impl CompositorDrawingContextProxy
pub fn new(inner: Box<dyn IDrawingContextImpl>) -> Self
Sourcepub fn into_inner(self) -> Box<dyn IDrawingContextImpl>
pub fn into_inner(self) -> Box<dyn IDrawingContextImpl>
Flushes the pending commands and returns the wrapped context.
pub fn post_transform(&self) -> Option<Matrix>
pub fn set_post_transform(&mut self, value: Option<Matrix>)
pub fn auto_flush(&self) -> bool
pub fn set_auto_flush(&mut self, value: bool)
pub fn flush(&mut self)
Trait Implementations§
Source§impl IDrawingContextImpl for CompositorDrawingContextProxy
impl IDrawingContextImpl for CompositorDrawingContextProxy
Source§fn set_transform(&mut self, value: Matrix)
fn set_transform(&mut self, value: Matrix)
Sets the current transform of the drawing context.
Source§fn draw_bitmap(
&mut self,
source: &dyn IBitmapImpl,
opacity: f64,
source_rect: Rect,
dest_rect: Rect,
)
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,
)
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_geometry(
&mut self,
brush: Option<&dyn IBrush>,
pen: Option<&dyn IPen>,
geometry: &dyn IGeometryImpl,
)
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,
)
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,
)
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,
)
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,
)
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>
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_rounded(&mut self, clip: RoundedRect)
fn push_clip_rounded(&mut self, clip: RoundedRect)
Pushes a rounded clip rectangle.
Source§fn push_clip_region(&mut self, region: &dyn IPlatformRenderInterfaceRegion)
fn push_clip_region(&mut self, region: &dyn IPlatformRenderInterfaceRegion)
Pushes a clip region.
Source§fn push_layer(&mut self, bounds: Rect)
fn push_layer(&mut self, bounds: Rect)
Enforces rendering to happen on an intermediate surface.
Source§fn pop_opacity(&mut self)
fn pop_opacity(&mut self)
Pops the latest pushed opacity value.
Source§fn push_opacity_mask(&mut self, mask: &dyn IBrush, bounds: Rect)
fn push_opacity_mask(&mut self, mask: &dyn IBrush, bounds: Rect)
Pushes an opacity mask.
Source§fn pop_opacity_mask(&mut self)
fn pop_opacity_mask(&mut self)
Pops the latest pushed opacity mask.
Source§fn push_geometry_clip(&mut self, clip: &dyn IGeometryImpl)
fn push_geometry_clip(&mut self, clip: &dyn IGeometryImpl)
Pushes a clip geometry.
Source§fn pop_geometry_clip(&mut self)
fn pop_geometry_clip(&mut self)
Pops the latest pushed geometry clip.
Source§fn push_render_options(&mut self, render_options: RenderOptions)
fn push_render_options(&mut self, render_options: RenderOptions)
Pushes render options.
Source§fn pop_render_options(&mut self)
fn pop_render_options(&mut self)
Pops the latest pushed render options.
Source§fn push_text_options(&mut self, text_options: TextOptions)
fn push_text_options(&mut self, text_options: TextOptions)
Pushes text options for the drawing context.
Source§fn pop_text_options(&mut self)
fn pop_text_options(&mut self)
Pops the latest text options.
Source§fn get_feature(&mut self, feature_type: TypeId) -> Option<Rc<dyn Any>>
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
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)
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>
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>
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>
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>
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
fn as_any_mut(&mut self) -> &mut dyn Any
Lets the backend recover its concrete type.
Source§impl IDrawingContextImplWithEffects for CompositorDrawingContextProxy
impl IDrawingContextImplWithEffects for CompositorDrawingContextProxy
Source§fn push_effect(&mut self, clip_rect: Option<Rect>, effect: &dyn IEffect)
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)
fn pop_effect(&mut self)
Pops the latest pushed effect.
Source§impl IDrawingContextImplWithFragments for CompositorDrawingContextProxy
impl IDrawingContextImplWithFragments for CompositorDrawingContextProxy
Source§fn begin_fragment(&mut self)
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>>
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
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
impl IDrawingContextImplWithLayerEffects for CompositorDrawingContextProxy
Source§fn push_blend_layer(&mut self, bounds: Rect, mode: BitmapBlendingMode)
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)
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,
)
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)
fn pop_color_matrix_layer(&mut self)
Pops the latest colour matrix layer.
Source§fn push_multiply_layer(&mut self, bounds: Rect, factors: &MultiplyLayerFactors)
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)
fn pop_multiply_layer(&mut self)
Pops the latest multiply layer.
Source§impl IDrawingContextWithAcrylicLikeSupport for CompositorDrawingContextProxy
impl IDrawingContextWithAcrylicLikeSupport for CompositorDrawingContextProxy
Source§fn draw_rectangle_with_material(
&mut self,
material: &dyn IExperimentalAcrylicMaterial,
rect: RoundedRect,
)
fn draw_rectangle_with_material( &mut self, material: &dyn IExperimentalAcrylicMaterial, rect: RoundedRect, )
Draws a rectangle filled with an acrylic-like material.
Auto Trait Implementations§
impl !RefUnwindSafe for CompositorDrawingContextProxy
impl !Send for CompositorDrawingContextProxy
impl !Sync for CompositorDrawingContextProxy
impl !UnwindSafe for CompositorDrawingContextProxy
impl Freeze for CompositorDrawingContextProxy
impl Unpin for CompositorDrawingContextProxy
impl UnsafeUnpin for CompositorDrawingContextProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
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