Skip to main content

ICustomDrawOperation

Trait ICustomDrawOperation 

Source
pub trait ICustomDrawOperation:
    Send
    + Sync
    + 'static {
    // Required methods
    fn bounds(&self) -> Rect;
    fn hit_test(&self, p: Point) -> bool;
    fn render(&self, context: &mut ImmediateDrawingContext<'_>);
    fn equals(&self, other: &dyn ICustomDrawOperation) -> bool;
    fn dispose(&self);

    // Provided method
    fn hit_test_geometry(&self, _geometry: &Ref<Geometry>) -> IntersectionResult { ... }
}
Expand description

Represents a custom draw operation in the low-level scene graph.

An operation is created on the UI thread and rendered on the render thread, so it is Send + Sync: what it draws with is captured by value or in thread-safe form.

Required Methods§

Source

fn bounds(&self) -> Rect

The bounds of the visible content in the node in global coordinates.

Source

fn hit_test(&self, p: Point) -> bool

Hit tests the node against a point, in global coordinates.

The implementation is responsible for checking transforms and geometry clips if necessary.

Source

fn render(&self, context: &mut ImmediateDrawingContext<'_>)

Renders the node to a drawing context.

Source

fn equals(&self, other: &dyn ICustomDrawOperation) -> bool

Value equality between operations (C# IEquatable<ICustomDrawOperation>).

Source

fn dispose(&self)

Releases the operation’s resources.

Provided Methods§

Source

fn hit_test_geometry(&self, _geometry: &Ref<Geometry>) -> IntersectionResult

Hit tests the node against a geometry.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§