pub struct GraphicsContext { /* private fields */ }Implementations§
Source§impl GraphicsContext
impl GraphicsContext
pub fn new() -> Self
pub fn move_to(&mut self, x: f64, y: f64) -> &mut Self
pub fn line_to(&mut self, x: f64, y: f64) -> &mut Self
pub fn curve_to( &mut self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64, ) -> &mut Self
pub fn rect(&mut self, x: f64, y: f64, width: f64, height: f64) -> &mut Self
pub fn circle(&mut self, cx: f64, cy: f64, radius: f64) -> &mut Self
pub fn close_path(&mut self) -> &mut Self
pub fn stroke(&mut self) -> &mut Self
pub fn fill(&mut self) -> &mut Self
pub fn fill_stroke(&mut self) -> &mut Self
pub fn set_stroke_color(&mut self, color: Color) -> &mut Self
pub fn set_fill_color(&mut self, color: Color) -> &mut Self
Sourcepub fn set_fill_color_calibrated(&mut self, color: CalibratedColor) -> &mut Self
pub fn set_fill_color_calibrated(&mut self, color: CalibratedColor) -> &mut Self
Set fill color using calibrated color space
Sourcepub fn set_stroke_color_calibrated(
&mut self,
color: CalibratedColor,
) -> &mut Self
pub fn set_stroke_color_calibrated( &mut self, color: CalibratedColor, ) -> &mut Self
Set stroke color using calibrated color space
Sourcepub fn set_fill_color_lab(&mut self, color: LabColor) -> &mut Self
pub fn set_fill_color_lab(&mut self, color: LabColor) -> &mut Self
Set fill color using Lab color space
Sourcepub fn set_stroke_color_lab(&mut self, color: LabColor) -> &mut Self
pub fn set_stroke_color_lab(&mut self, color: LabColor) -> &mut Self
Set stroke color using Lab color space
pub fn set_line_width(&mut self, width: f64) -> &mut Self
pub fn set_line_cap(&mut self, cap: LineCap) -> &mut Self
pub fn set_line_join(&mut self, join: LineJoin) -> &mut Self
Sourcepub fn set_opacity(&mut self, opacity: f64) -> &mut Self
pub fn set_opacity(&mut self, opacity: f64) -> &mut Self
Set the opacity for both fill and stroke operations (0.0 to 1.0)
Sourcepub fn set_fill_opacity(&mut self, opacity: f64) -> &mut Self
pub fn set_fill_opacity(&mut self, opacity: f64) -> &mut Self
Set the fill opacity (0.0 to 1.0)
Sourcepub fn set_stroke_opacity(&mut self, opacity: f64) -> &mut Self
pub fn set_stroke_opacity(&mut self, opacity: f64) -> &mut Self
Set the stroke opacity (0.0 to 1.0)
pub fn save_state(&mut self) -> &mut Self
pub fn restore_state(&mut self) -> &mut Self
Sourcepub fn begin_transparency_group(
&mut self,
group: TransparencyGroup,
) -> &mut Self
pub fn begin_transparency_group( &mut self, group: TransparencyGroup, ) -> &mut Self
Begin a transparency group ISO 32000-1:2008 Section 11.4
Sourcepub fn end_transparency_group(&mut self) -> &mut Self
pub fn end_transparency_group(&mut self) -> &mut Self
End a transparency group
Sourcepub fn in_transparency_group(&self) -> bool
pub fn in_transparency_group(&self) -> bool
Check if we’re currently inside a transparency group
Sourcepub fn current_transparency_group(&self) -> Option<&TransparencyGroup>
pub fn current_transparency_group(&self) -> Option<&TransparencyGroup>
Get the current transparency group (if any)
pub fn translate(&mut self, tx: f64, ty: f64) -> &mut Self
pub fn scale(&mut self, sx: f64, sy: f64) -> &mut Self
pub fn rotate(&mut self, angle: f64) -> &mut Self
pub fn transform( &mut self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64, ) -> &mut Self
pub fn rectangle( &mut self, x: f64, y: f64, width: f64, height: f64, ) -> &mut Self
pub fn draw_image( &mut self, image_name: &str, x: f64, y: f64, width: f64, height: f64, ) -> &mut Self
Sourcepub fn draw_image_with_transparency(
&mut self,
image_name: &str,
x: f64,
y: f64,
width: f64,
height: f64,
mask_name: Option<&str>,
) -> &mut Self
pub fn draw_image_with_transparency( &mut self, image_name: &str, x: f64, y: f64, width: f64, height: f64, mask_name: Option<&str>, ) -> &mut Self
Draw an image with transparency support (soft mask) This method handles images with alpha channels or soft masks
Sourcepub fn uses_transparency(&self) -> bool
pub fn uses_transparency(&self) -> bool
Check if transparency is used (opacity != 1.0)
Sourcepub fn generate_graphics_state_dict(&self) -> Option<String>
pub fn generate_graphics_state_dict(&self) -> Option<String>
Generate the graphics state dictionary for transparency
Sourcepub fn fill_color(&self) -> Color
pub fn fill_color(&self) -> Color
Get the current fill color
Sourcepub fn stroke_color(&self) -> Color
pub fn stroke_color(&self) -> Color
Get the current stroke color
Sourcepub fn line_width(&self) -> f64
pub fn line_width(&self) -> f64
Get the current line width
Sourcepub fn fill_opacity(&self) -> f64
pub fn fill_opacity(&self) -> f64
Get the current fill opacity
Sourcepub fn stroke_opacity(&self) -> f64
pub fn stroke_opacity(&self) -> f64
Get the current stroke opacity
Sourcepub fn operations(&self) -> &str
pub fn operations(&self) -> &str
Get the operations string
Sourcepub fn get_operations(&self) -> &str
pub fn get_operations(&self) -> &str
Get the operations string (alias for testing)
Sourcepub fn begin_text(&mut self) -> &mut Self
pub fn begin_text(&mut self) -> &mut Self
Begin a text object
Sourcepub fn set_text_position(&mut self, x: f64, y: f64) -> &mut Self
pub fn set_text_position(&mut self, x: f64, y: f64) -> &mut Self
Set text position
Sourcepub fn set_word_spacing(&mut self, spacing: f64) -> &mut Self
pub fn set_word_spacing(&mut self, spacing: f64) -> &mut Self
Set word spacing for text justification
Sourcepub fn set_character_spacing(&mut self, spacing: f64) -> &mut Self
pub fn set_character_spacing(&mut self, spacing: f64) -> &mut Self
Set character spacing
Sourcepub fn show_justified_text(
&mut self,
text: &str,
target_width: f64,
) -> Result<&mut Self>
pub fn show_justified_text( &mut self, text: &str, target_width: f64, ) -> Result<&mut Self>
Show justified text with automatic word spacing calculation
Sourcepub fn render_table(&mut self, table: &Table) -> Result<()>
pub fn render_table(&mut self, table: &Table) -> Result<()>
Render a table
Sourcepub fn render_list(&mut self, list: &ListElement) -> Result<()>
pub fn render_list(&mut self, list: &ListElement) -> Result<()>
Render a list
Sourcepub fn render_column_layout(
&mut self,
layout: &ColumnLayout,
content: &ColumnContent,
x: f64,
y: f64,
height: f64,
) -> Result<()>
pub fn render_column_layout( &mut self, layout: &ColumnLayout, content: &ColumnContent, x: f64, y: f64, height: f64, ) -> Result<()>
Render column layout
Sourcepub fn set_line_dash_pattern(&mut self, pattern: LineDashPattern) -> &mut Self
pub fn set_line_dash_pattern(&mut self, pattern: LineDashPattern) -> &mut Self
Set line dash pattern
Sourcepub fn set_line_solid(&mut self) -> &mut Self
pub fn set_line_solid(&mut self) -> &mut Self
Set line dash pattern to solid (no dashes)
Sourcepub fn set_miter_limit(&mut self, limit: f64) -> &mut Self
pub fn set_miter_limit(&mut self, limit: f64) -> &mut Self
Set miter limit
Sourcepub fn set_rendering_intent(&mut self, intent: RenderingIntent) -> &mut Self
pub fn set_rendering_intent(&mut self, intent: RenderingIntent) -> &mut Self
Set rendering intent
Sourcepub fn set_flatness(&mut self, flatness: f64) -> &mut Self
pub fn set_flatness(&mut self, flatness: f64) -> &mut Self
Set flatness tolerance
Sourcepub fn apply_extgstate(&mut self, state: ExtGState) -> Result<&mut Self>
pub fn apply_extgstate(&mut self, state: ExtGState) -> Result<&mut Self>
Apply an ExtGState dictionary immediately
Sourcepub fn with_extgstate<F>(&mut self, builder: F) -> Result<&mut Self>
pub fn with_extgstate<F>(&mut self, builder: F) -> Result<&mut Self>
Create and apply a custom ExtGState
Sourcepub fn set_blend_mode(&mut self, mode: BlendMode) -> Result<&mut Self>
pub fn set_blend_mode(&mut self, mode: BlendMode) -> Result<&mut Self>
Set blend mode for transparency
Sourcepub fn set_alpha(&mut self, alpha: f64) -> Result<&mut Self>
pub fn set_alpha(&mut self, alpha: f64) -> Result<&mut Self>
Set alpha for both stroke and fill operations
Sourcepub fn set_alpha_stroke(&mut self, alpha: f64) -> Result<&mut Self>
pub fn set_alpha_stroke(&mut self, alpha: f64) -> Result<&mut Self>
Set alpha for stroke operations only
Sourcepub fn set_alpha_fill(&mut self, alpha: f64) -> Result<&mut Self>
pub fn set_alpha_fill(&mut self, alpha: f64) -> Result<&mut Self>
Set alpha for fill operations only
Sourcepub fn set_overprint_stroke(&mut self, overprint: bool) -> Result<&mut Self>
pub fn set_overprint_stroke(&mut self, overprint: bool) -> Result<&mut Self>
Set overprint for stroke operations
Sourcepub fn set_overprint_fill(&mut self, overprint: bool) -> Result<&mut Self>
pub fn set_overprint_fill(&mut self, overprint: bool) -> Result<&mut Self>
Set overprint for fill operations
Sourcepub fn set_stroke_adjustment(&mut self, adjustment: bool) -> Result<&mut Self>
pub fn set_stroke_adjustment(&mut self, adjustment: bool) -> Result<&mut Self>
Set stroke adjustment
Sourcepub fn set_smoothness(&mut self, smoothness: f64) -> Result<&mut Self>
pub fn set_smoothness(&mut self, smoothness: f64) -> Result<&mut Self>
Set smoothness tolerance
Sourcepub fn line_dash_pattern(&self) -> Option<&LineDashPattern>
pub fn line_dash_pattern(&self) -> Option<&LineDashPattern>
Get current line dash pattern
Sourcepub fn miter_limit(&self) -> f64
pub fn miter_limit(&self) -> f64
Get current miter limit
Sourcepub fn rendering_intent(&self) -> RenderingIntent
pub fn rendering_intent(&self) -> RenderingIntent
Get current rendering intent
Sourcepub fn smoothness(&self) -> f64
pub fn smoothness(&self) -> f64
Get current smoothness tolerance
Sourcepub fn extgstate_manager(&self) -> &ExtGStateManager
pub fn extgstate_manager(&self) -> &ExtGStateManager
Get the ExtGState manager (for advanced usage)
Sourcepub fn extgstate_manager_mut(&mut self) -> &mut ExtGStateManager
pub fn extgstate_manager_mut(&mut self) -> &mut ExtGStateManager
Get mutable ExtGState manager (for advanced usage)
Sourcepub fn generate_extgstate_resources(&self) -> Result<String>
pub fn generate_extgstate_resources(&self) -> Result<String>
Generate ExtGState resource dictionary for PDF
Sourcepub fn has_extgstates(&self) -> bool
pub fn has_extgstates(&self) -> bool
Check if any extended graphics states are defined
Sourcepub fn add_command(&mut self, command: &str)
pub fn add_command(&mut self, command: &str)
Add a command to the operations
Sourcepub fn clip(&mut self) -> &mut Self
pub fn clip(&mut self) -> &mut Self
Create clipping path from current path using non-zero winding rule
Sourcepub fn clip_even_odd(&mut self) -> &mut Self
pub fn clip_even_odd(&mut self) -> &mut Self
Create clipping path from current path using even-odd rule
Sourcepub fn clip_stroke(&mut self) -> &mut Self
pub fn clip_stroke(&mut self) -> &mut Self
Create clipping path and stroke it
Sourcepub fn set_clipping_path(&mut self, path: ClippingPath) -> Result<&mut Self>
pub fn set_clipping_path(&mut self, path: ClippingPath) -> Result<&mut Self>
Set a custom clipping path
Sourcepub fn clear_clipping(&mut self) -> &mut Self
pub fn clear_clipping(&mut self) -> &mut Self
Clear the current clipping path
Sourcepub fn clip_rect(
&mut self,
x: f64,
y: f64,
width: f64,
height: f64,
) -> Result<&mut Self>
pub fn clip_rect( &mut self, x: f64, y: f64, width: f64, height: f64, ) -> Result<&mut Self>
Create a rectangular clipping region
Sourcepub fn clip_circle(
&mut self,
cx: f64,
cy: f64,
radius: f64,
) -> Result<&mut Self>
pub fn clip_circle( &mut self, cx: f64, cy: f64, radius: f64, ) -> Result<&mut Self>
Create a circular clipping region
Sourcepub fn clip_ellipse(
&mut self,
cx: f64,
cy: f64,
rx: f64,
ry: f64,
) -> Result<&mut Self>
pub fn clip_ellipse( &mut self, cx: f64, cy: f64, rx: f64, ry: f64, ) -> Result<&mut Self>
Create an elliptical clipping region
Sourcepub fn has_clipping(&self) -> bool
pub fn has_clipping(&self) -> bool
Check if a clipping path is active
Sourcepub fn clipping_path(&self) -> Option<&ClippingPath>
pub fn clipping_path(&self) -> Option<&ClippingPath>
Get the current clipping path
Sourcepub fn set_font_manager(&mut self, font_manager: Arc<FontManager>) -> &mut Self
pub fn set_font_manager(&mut self, font_manager: Arc<FontManager>) -> &mut Self
Set the font manager for custom fonts
Sourcepub fn set_custom_font(&mut self, font_name: &str, size: f64) -> &mut Self
pub fn set_custom_font(&mut self, font_name: &str, size: f64) -> &mut Self
Set the current font to a custom font
Sourcepub fn set_glyph_mapping(&mut self, mapping: HashMap<u32, u16>) -> &mut Self
pub fn set_glyph_mapping(&mut self, mapping: HashMap<u32, u16>) -> &mut Self
Set the glyph mapping for Unicode fonts (Unicode -> GlyphID)
Sourcepub fn draw_text(&mut self, text: &str, x: f64, y: f64) -> Result<&mut Self>
pub fn draw_text(&mut self, text: &str, x: f64, y: f64) -> Result<&mut Self>
Draw text at the specified position with automatic encoding detection
Sourcepub fn draw_text_hex(&mut self, text: &str, x: f64, y: f64) -> Result<&mut Self>
👎Deprecated: Use draw_text() which automatically detects encoding
pub fn draw_text_hex(&mut self, text: &str, x: f64, y: f64) -> Result<&mut Self>
Legacy: Draw text with hex encoding (kept for compatibility)
Trait Implementations§
Source§impl Clone for GraphicsContext
impl Clone for GraphicsContext
Source§fn clone(&self) -> GraphicsContext
fn clone(&self) -> GraphicsContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more