Skip to main content

Device

Trait Device 

Source
pub trait Device {
    // Provided methods
    fn fill_path(
        &mut self,
        path: &[PathSegment],
        rule: FillRule,
        state: &GraphicsState,
    ) { ... }
    fn stroke_path(&mut self, path: &[PathSegment], state: &GraphicsState) { ... }
    fn clip(
        &mut self,
        path: &[PathSegment],
        rule: FillRule,
        state: &GraphicsState,
    ) { ... }
    fn draw_glyph(&mut self, glyph: &Glyph, state: &GraphicsState) { ... }
    fn draw_image(&mut self, image: &Image, state: &GraphicsState) { ... }
    fn begin_marked_content(&mut self, tag: &Name, properties: Option<&Dict>) { ... }
    fn end_marked_content(&mut self) { ... }
    fn begin_group(
        &mut self,
        form: Option<ObjId>,
        dict: &Dict,
        state: &GraphicsState,
    ) { ... }
    fn end_group(&mut self) { ... }
}
Expand description

Receives what a content stream draws. Every method has an empty default, so a device implements only what it needs: text extraction takes glyphs and marked content; a renderer takes everything.

Provided Methods§

Source

fn fill_path( &mut self, path: &[PathSegment], rule: FillRule, state: &GraphicsState, )

Fills path (user space) with the current fill colour.

Source

fn stroke_path(&mut self, path: &[PathSegment], state: &GraphicsState)

Strokes path (user space).

Source

fn clip(&mut self, path: &[PathSegment], rule: FillRule, state: &GraphicsState)

Intersects the clip with path.

Source

fn draw_glyph(&mut self, glyph: &Glyph, state: &GraphicsState)

Draws one glyph.

Source

fn draw_image(&mut self, image: &Image, state: &GraphicsState)

Draws an image into the unit square of state.ctm.

Source

fn begin_marked_content(&mut self, tag: &Name, properties: Option<&Dict>)

Starts a marked-content sequence (BMC/BDC).

Source

fn end_marked_content(&mut self)

Ends the innermost marked-content sequence (EMC).

Source

fn begin_group( &mut self, form: Option<ObjId>, dict: &Dict, state: &GraphicsState, )

Starts a Form XObject (a group when it has /Group).

Source

fn end_group(&mut self)

Ends the Form XObject started last.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§