Skip to main content

OutputDevice

Trait OutputDevice 

Source
pub trait OutputDevice {
Show 18 methods // Required methods fn fill_path(&mut self, path: &PsPath, params: &FillParams); fn stroke_path(&mut self, path: &PsPath, params: &StrokeParams); fn clip_path(&mut self, path: &PsPath, params: &ClipParams); fn init_clip(&mut self); fn erase_page(&mut self); fn show_page(&mut self, output_path: &str) -> Result<(), String>; fn draw_image(&mut self, sample_data: &[u8], params: &ImageParams); fn page_size(&self) -> (u32, u32); // Provided methods fn paint_axial_shading(&mut self, _params: &AxialShadingParams) { ... } fn paint_radial_shading(&mut self, _params: &RadialShadingParams) { ... } fn paint_mesh_shading(&mut self, _params: &MeshShadingParams) { ... } fn paint_patch_shading(&mut self, _params: &PatchShadingParams) { ... } fn paint_pattern_fill(&mut self, _params: &PatternFillParams) { ... } fn set_trim_box(&mut self, _llx: f64, _lly: f64, _urx: f64, _ury: f64) { ... } fn replay_and_show( &mut self, list: DisplayList, output_path: &str, ) -> Result<(), String> { ... } fn finish(&mut self) -> Result<(), String> { ... } fn finish_with_context(&mut self, _ctx: &Context) -> Result<(), String> { ... } fn as_any(&self) -> &dyn Any { ... }
}
Expand description

Trait for raster rendering devices.

Operators never see the concrete implementation — they call trait methods. This enables backend swaps (tiny-skia, cairo, etc.) without changing operator code.

Required Methods§

Source

fn fill_path(&mut self, path: &PsPath, params: &FillParams)

Fill a path with the given color.

Source

fn stroke_path(&mut self, path: &PsPath, params: &StrokeParams)

Stroke a path with the given parameters.

Source

fn clip_path(&mut self, path: &PsPath, params: &ClipParams)

Intersect the current clip region with the given path.

Source

fn init_clip(&mut self)

Reset clipping to the full page.

Source

fn erase_page(&mut self)

Erase the page (fill with white).

Source

fn show_page(&mut self, output_path: &str) -> Result<(), String>

Output the current page (e.g., save PNG) and return Ok/Err.

Source

fn draw_image(&mut self, sample_data: &[u8], params: &ImageParams)

Draw an image from raw sample data.

Source

fn page_size(&self) -> (u32, u32)

Page dimensions in device pixels.

Provided Methods§

Source

fn paint_axial_shading(&mut self, _params: &AxialShadingParams)

Paint an axial (linear) gradient shading.

Source

fn paint_radial_shading(&mut self, _params: &RadialShadingParams)

Paint a radial gradient shading.

Source

fn paint_mesh_shading(&mut self, _params: &MeshShadingParams)

Paint a Gouraud-shaded triangle mesh.

Source

fn paint_patch_shading(&mut self, _params: &PatchShadingParams)

Paint a Coons/tensor-product patch mesh.

Source

fn paint_pattern_fill(&mut self, _params: &PatternFillParams)

Paint a tiled pattern fill.

Source

fn set_trim_box(&mut self, _llx: f64, _lly: f64, _urx: f64, _ury: f64)

Set the trim box for the next page (PDF points, lower-left origin). Only meaningful for PDF output; other devices ignore this.

Source

fn replay_and_show( &mut self, list: DisplayList, output_path: &str, ) -> Result<(), String>

Replay a display list and write output in one step.

Source

fn finish(&mut self) -> Result<(), String>

Wait for any pending background render to complete.

Source

fn finish_with_context(&mut self, _ctx: &Context) -> Result<(), String>

Called after interpretation finishes, with access to the interpreter context.

Source

fn as_any(&self) -> &dyn Any

Downcast to a concrete type. Override in implementations that need to be accessed after rendering (e.g., PdfDevice for in-memory output).

Implementors§