pub struct InterpreterState { /* private fields */ }Expand description
Full interpreter state that combines the CTM with the graphics state.
This is the interpreter-level state that tracks everything needed
during content stream processing. The q operator pushes a copy
onto the stack; Q restores from the stack.
Implementations§
Source§impl InterpreterState
impl InterpreterState
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new interpreter state with identity CTM and default graphics state.
Sourcepub fn ctm_array(&self) -> [f64; 6]
pub fn ctm_array(&self) -> [f64; 6]
Get the current CTM as a 6-element array [a, b, c, d, e, f].
Sourcepub fn graphics_state(&self) -> &GraphicsState
pub fn graphics_state(&self) -> &GraphicsState
Get the current graphics state.
Sourcepub fn graphics_state_mut(&mut self) -> &mut GraphicsState
pub fn graphics_state_mut(&mut self) -> &mut GraphicsState
Get a mutable reference to the current graphics state.
Sourcepub fn stack_depth(&self) -> usize
pub fn stack_depth(&self) -> usize
Returns the current stack depth.
Sourcepub fn save_state(&mut self)
pub fn save_state(&mut self)
q operator: save the current graphics state onto the stack.
Sourcepub fn restore_state(&mut self) -> bool
pub fn restore_state(&mut self) -> bool
Q operator: restore the most recently saved graphics state.
Returns false if the stack is empty (unbalanced Q).
Sourcepub fn concat_matrix(&mut self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)
pub fn concat_matrix(&mut self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64)
cm operator: concatenate a matrix with the current CTM.
The new matrix is pre-multiplied: CTM’ = new_matrix × CTM_current.
This follows the PDF spec where cm modifies the CTM by pre-concatenating.
Sourcepub fn set_line_width(&mut self, width: f64)
pub fn set_line_width(&mut self, width: f64)
w operator: set line width.
Sourcepub fn set_dash_pattern(&mut self, dash_array: Vec<f64>, dash_phase: f64)
pub fn set_dash_pattern(&mut self, dash_array: Vec<f64>, dash_phase: f64)
d operator: set dash pattern.
Sourcepub fn set_stroking_gray(&mut self, gray: f32)
pub fn set_stroking_gray(&mut self, gray: f32)
G operator: set stroking color to DeviceGray.
Sourcepub fn set_non_stroking_gray(&mut self, gray: f32)
pub fn set_non_stroking_gray(&mut self, gray: f32)
g operator: set non-stroking color to DeviceGray.
Sourcepub fn set_stroking_rgb(&mut self, r: f32, g: f32, b: f32)
pub fn set_stroking_rgb(&mut self, r: f32, g: f32, b: f32)
RG operator: set stroking color to DeviceRGB.
Sourcepub fn set_non_stroking_rgb(&mut self, r: f32, g: f32, b: f32)
pub fn set_non_stroking_rgb(&mut self, r: f32, g: f32, b: f32)
rg operator: set non-stroking color to DeviceRGB.
Sourcepub fn set_stroking_cmyk(&mut self, c: f32, m: f32, y: f32, k: f32)
pub fn set_stroking_cmyk(&mut self, c: f32, m: f32, y: f32, k: f32)
K operator: set stroking color to DeviceCMYK.
Sourcepub fn set_non_stroking_cmyk(&mut self, c: f32, m: f32, y: f32, k: f32)
pub fn set_non_stroking_cmyk(&mut self, c: f32, m: f32, y: f32, k: f32)
k operator: set non-stroking color to DeviceCMYK.
Sourcepub fn set_stroking_color(&mut self, components: &[f32])
pub fn set_stroking_color(&mut self, components: &[f32])
SC/SCN operator: set stroking color from components.
If a stroking color space has been set (via CS), uses it to resolve the color. Otherwise falls back to inferring from component count.
Sourcepub fn set_non_stroking_color(&mut self, components: &[f32])
pub fn set_non_stroking_color(&mut self, components: &[f32])
sc/scn operator: set non-stroking color from components.
If a non-stroking color space has been set (via cs), uses it to resolve the color. Otherwise falls back to inferring from component count.
Sourcepub fn set_stroking_color_space(&mut self, cs: ResolvedColorSpace)
pub fn set_stroking_color_space(&mut self, cs: ResolvedColorSpace)
CS operator: set the stroking color space.
Sourcepub fn set_non_stroking_color_space(&mut self, cs: ResolvedColorSpace)
pub fn set_non_stroking_color_space(&mut self, cs: ResolvedColorSpace)
cs operator: set the non-stroking color space.
Trait Implementations§
Source§impl Clone for InterpreterState
impl Clone for InterpreterState
Source§fn clone(&self) -> InterpreterState
fn clone(&self) -> InterpreterState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more