pub trait Device<'a> {
Show 13 methods
// Required methods
fn set_soft_mask(&mut self, mask: Option<SoftMask<'a>>);
fn set_blend_mode(&mut self, blend_mode: BlendMode);
fn draw_path(
&mut self,
path: &BezPath,
transform: Affine,
paint: &Paint<'a>,
draw_mode: &PathDrawMode,
);
fn push_clip_path(&mut self, clip_path: &ClipPath);
fn push_transparency_group(
&mut self,
opacity: f32,
mask: Option<SoftMask<'a>>,
blend_mode: BlendMode,
);
fn draw_glyph(
&mut self,
glyph: &Glyph<'a>,
transform: Affine,
glyph_transform: Affine,
paint: &Paint<'a>,
draw_mode: &GlyphDrawMode,
);
fn draw_image(&mut self, image: Image<'a, '_>, transform: Affine);
fn pop_clip_path(&mut self);
fn pop_transparency_group(&mut self);
// Provided methods
fn draw_rect(
&mut self,
rect: &Rect,
transform: Affine,
paint: &Paint<'a>,
draw_mode: &PathDrawMode,
) { ... }
fn begin_marked_content(&mut self, _tag: &[u8], _mcid: Option<i32>) { ... }
fn end_marked_content(&mut self) { ... }
fn text_adjustment(&mut self, _amount: f32) { ... }
}Expand description
A trait for a device that can be used to process PDF drawing instructions.
Required Methods§
Sourcefn set_soft_mask(&mut self, mask: Option<SoftMask<'a>>)
fn set_soft_mask(&mut self, mask: Option<SoftMask<'a>>)
Set the properties for future stroking operations. Set a soft mask to be used for future drawing instructions.
Sourcefn set_blend_mode(&mut self, blend_mode: BlendMode)
fn set_blend_mode(&mut self, blend_mode: BlendMode)
Set the blend mode that should be used for rendering operations.
Sourcefn draw_path(
&mut self,
path: &BezPath,
transform: Affine,
paint: &Paint<'a>,
draw_mode: &PathDrawMode,
)
fn draw_path( &mut self, path: &BezPath, transform: Affine, paint: &Paint<'a>, draw_mode: &PathDrawMode, )
Draw a path.
Sourcefn push_clip_path(&mut self, clip_path: &ClipPath)
fn push_clip_path(&mut self, clip_path: &ClipPath)
Push a new clip path to the clip stack.
Sourcefn push_transparency_group(
&mut self,
opacity: f32,
mask: Option<SoftMask<'a>>,
blend_mode: BlendMode,
)
fn push_transparency_group( &mut self, opacity: f32, mask: Option<SoftMask<'a>>, blend_mode: BlendMode, )
Push a new transparency group to the blend stack.
Sourcefn draw_glyph(
&mut self,
glyph: &Glyph<'a>,
transform: Affine,
glyph_transform: Affine,
paint: &Paint<'a>,
draw_mode: &GlyphDrawMode,
)
fn draw_glyph( &mut self, glyph: &Glyph<'a>, transform: Affine, glyph_transform: Affine, paint: &Paint<'a>, draw_mode: &GlyphDrawMode, )
Draw a glyph.
Sourcefn draw_image(&mut self, image: Image<'a, '_>, transform: Affine)
fn draw_image(&mut self, image: Image<'a, '_>, transform: Affine)
Draw an image.
Sourcefn pop_clip_path(&mut self)
fn pop_clip_path(&mut self)
Pop the last clip path from the clip stack.
Sourcefn pop_transparency_group(&mut self)
fn pop_transparency_group(&mut self)
Pop the last transparency group from the blend stack.
Provided Methods§
Sourcefn draw_rect(
&mut self,
rect: &Rect,
transform: Affine,
paint: &Paint<'a>,
draw_mode: &PathDrawMode,
)
fn draw_rect( &mut self, rect: &Rect, transform: Affine, paint: &Paint<'a>, draw_mode: &PathDrawMode, )
Draw a rectangle directly, without going through the general path pipeline.
Sourcefn begin_marked_content(&mut self, _tag: &[u8], _mcid: Option<i32>)
fn begin_marked_content(&mut self, _tag: &[u8], _mcid: Option<i32>)
Called at the beginning of a marked content sequence (BMC/BDC).
The tag is the marked content tag (e.g. b“P“, b“Span“). The mcid is the marked content identifier from the properties dict, if present.
Sourcefn end_marked_content(&mut self)
fn end_marked_content(&mut self)
Called at the end of a marked content sequence (EMC).
Sourcefn text_adjustment(&mut self, _amount: f32)
fn text_adjustment(&mut self, _amount: f32)
Called when a TJ-array numeric adjustment is encountered between substrings. Positive values shift text backward, negative values shift it forward (1/1000 em units, per PDF §9.4.3). Text extractors use this as a high-confidence word-boundary signal.