Skip to main content

DrawSink

Trait DrawSink 

Source
pub trait DrawSink {
    // Required methods
    fn set_transform(&mut self, t: Affine);
    fn set_paint(&mut self, paint: AtlasPaint);
    fn set_paint_transform(&mut self, t: Affine);
    fn fill_path(&mut self, path: &BezPath);
    fn fill_rect(&mut self, rect: &Rect);
    fn push_clip_layer(&mut self, clip: &BezPath);
    fn push_blend_layer(&mut self, blend_mode: BlendMode);
    fn pop_layer(&mut self);
    fn width(&self) -> u16;
    fn height(&self) -> u16;

    // Provided methods
    fn push_clip_path(&mut self, clip: &BezPath) { ... }
    fn pop_clip_path(&mut self) { ... }
}
Expand description

A sink for low-level glyph drawing commands.

Required Methods§

Source

fn set_transform(&mut self, t: Affine)

Set the current transform.

Source

fn set_paint(&mut self, paint: AtlasPaint)

Set the current paint.

Source

fn set_paint_transform(&mut self, t: Affine)

Set the paint transform.

Source

fn fill_path(&mut self, path: &BezPath)

Fill a path with the current paint and transform.

Source

fn fill_rect(&mut self, rect: &Rect)

Fill a rectangle with the current paint and transform.

Source

fn push_clip_layer(&mut self, clip: &BezPath)

Push a clip layer defined by a path.

Source

fn push_blend_layer(&mut self, blend_mode: BlendMode)

Push a blend/compositing layer.

Source

fn pop_layer(&mut self)

Pop the most recent clip or blend layer.

Source

fn width(&self) -> u16

Width of the surface.

Source

fn height(&self) -> u16

Height of the surface.

Provided Methods§

Source

fn push_clip_path(&mut self, clip: &BezPath)

Push a clip path.

This method can be implemented in terms of push_clip_layer without losing correctness. However, clients are allowed to choose a more efficient clipping implementation that doesn’t require pushing an isolated layer.

When providing a custom implementation of this method, the pop_clip_path method also needs to be overridden correspondingly.

Source

fn pop_clip_path(&mut self)

Pop the most recent clip path.

See the documentation for DrawSink::push_clip_path.

Implementors§