pub struct PdfGraphicsState {Show 54 fields
pub ctm: Matrix,
pub fill_color: DeviceColor,
pub stroke_color: DeviceColor,
pub line_width: f64,
pub line_cap: LineCap,
pub line_join: LineJoin,
pub miter_limit: f64,
pub dash_pattern: DashPattern,
pub rendering_intent: u8,
pub stroke_adjust: bool,
pub overprint: bool,
pub overprint_stroke: bool,
pub overprint_mode: i32,
pub opm_paired: bool,
pub fill_painted_channels: u8,
pub fill_is_device_cmyk: bool,
pub stroke_painted_channels: u8,
pub stroke_is_device_cmyk: bool,
pub flatness: f64,
pub fill_color_space: ColorSpaceRef,
pub stroke_color_space: ColorSpaceRef,
pub pending_clip: Option<(PsPath, FillRule)>,
pub clip_path: Option<PsPath>,
pub clip_stack: Vec<(PsPath, FillRule)>,
pub clip_path_version: u32,
pub fill_alpha: f64,
pub stroke_alpha: f64,
pub fill_spot_color: Option<SpotColor>,
pub stroke_spot_color: Option<SpotColor>,
pub fill_icc_color: Option<IccColor>,
pub stroke_icc_color: Option<IccColor>,
pub fill_is_none: bool,
pub stroke_is_none: bool,
pub blend_mode: u8,
pub alpha_is_shape: bool,
pub text_knockout: bool,
pub text_matrix: Matrix,
pub text_line_matrix: Matrix,
pub font_size: f64,
pub char_spacing: f64,
pub word_spacing: f64,
pub text_leading: f64,
pub text_rise: f64,
pub horizontal_scaling: f64,
pub text_rendering_mode: i32,
pub text_font_name: Vec<u8>,
pub fill_pattern: Option<TilingPattern>,
pub fill_shading_pattern: Option<Box<ShadingPatternDL>>,
pub stroke_pattern: Option<TilingPattern>,
pub stroke_shading_pattern: Option<Box<ShadingPatternDL>>,
pub next_pattern_id: u32,
pub transfer: TransferState,
pub soft_mask: Option<SoftMask>,
pub smask_gen: u64,
}Expand description
PDF graphics state — self-contained, no VM/Context dependencies.
Fields§
§ctm: Matrix§fill_color: DeviceColor§stroke_color: DeviceColor§line_width: f64§line_cap: LineCap§line_join: LineJoin§miter_limit: f64§dash_pattern: DashPattern§rendering_intent: u8§stroke_adjust: bool§overprint: bool§overprint_stroke: bool§overprint_mode: i32Overprint mode: 0 = all components painted, 1 = only non-zero components painted.
opm_paired: boolTrue when the most recent ExtGState dict set BOTH /OPM and (/op or /OP) together. Strict OPM-1 semantics (zero source preserves backdrop) apply only when this is true; otherwise an inherited OPM=1 paired with a separately-set /op falls back to legacy knockout semantics for an all-zero CMYK source — matching Adobe Acrobat’s behavior on real-world PDFs that set /op in isolation without re-asserting /OPM.
fill_painted_channels: u8CMYK channel bitmask for fill overprint (which channels the current fill color space paints).
fill_is_device_cmyk: boolTrue when fill color space is DeviceCMYK or ICCBased(4) — OPM 1 only applies to these.
stroke_painted_channels: u8CMYK channel bitmask for stroke overprint.
stroke_is_device_cmyk: boolTrue when stroke color space is DeviceCMYK or ICCBased(4) — OPM 1 only applies to these.
flatness: f64§fill_color_space: ColorSpaceRef§stroke_color_space: ColorSpaceRef§pending_clip: Option<(PsPath, FillRule)>Pending clip: set by W/W*, applied after next paint op.
clip_path: Option<PsPath>Current clip path (most recent, for bbox estimation).
clip_stack: Vec<(PsPath, FillRule)>Full stack of active clip paths for accurate restoration on Q. Each entry is a (path, fill_rule) pair pushed by W/W*/push_bbox_clip. When Q detects a clip change, it pushes InitClip + replays all saved clips.
clip_path_version: u32Clip version counter — incremented on each W/W* application.
fill_alpha: f64§stroke_alpha: f64§fill_spot_color: Option<SpotColor>Native Separation/DeviceN fill color (preserved for PDF output round-trip).
None when the current fill color space is a device space.
stroke_spot_color: Option<SpotColor>Native Separation/DeviceN stroke color (preserved for PDF output round-trip).
None when the current stroke color space is a device space.
fill_icc_color: Option<IccColor>ICCBased fill color (preserved for PDF output round-trip). None
for device color spaces and for Separation/DeviceN paints.
stroke_icc_color: Option<IccColor>ICCBased stroke color (preserved for PDF output round-trip).
fill_is_none: boolTrue when fill color is Separation/None (produces no visible marks).
stroke_is_none: boolTrue when stroke color is Separation/None (produces no visible marks).
blend_mode: u8Blend mode (0=Normal, 1=Multiply, …, 11=Exclusion).
alpha_is_shape: boolPDF AIS (alpha-is-shape) from ExtGState. Default false.
text_knockout: boolPDF TK (text knockout) from ExtGState. Default true.
text_matrix: Matrix§text_line_matrix: Matrix§font_size: f64§char_spacing: f64§word_spacing: f64§text_leading: f64§text_rise: f64§horizontal_scaling: f64Horizontal scaling factor (Tz / 100). Default 1.0 = 100%.
text_rendering_mode: i32§text_font_name: Vec<u8>§fill_pattern: Option<TilingPattern>Active tiling pattern for fill (set by scn with Pattern color space).
fill_shading_pattern: Option<Box<ShadingPatternDL>>Active shading pattern for fill (PatternType 2).
Stored as Option<Box<DisplayList>> so PdfGraphicsState can derive Debug
(DisplayList doesn’t implement Debug).
stroke_pattern: Option<TilingPattern>Active tiling pattern for stroke (set by SCN with Pattern color space).
stroke_shading_pattern: Option<Box<ShadingPatternDL>>Active shading pattern for stroke (PatternType 2).
next_pattern_id: u32Counter for unique pattern IDs.
transfer: TransferStateTransfer function state.
soft_mask: Option<SoftMask>Active soft mask from ExtGState /SMask.
smask_gen: u64Generation counter: incremented each time a new SMask is set via gs. Used by the Q handler to detect SMask changes within a q/Q block.
Implementations§
Source§impl PdfGraphicsState
impl PdfGraphicsState
Sourcepub fn fill_params(&self, fill_rule: FillRule) -> FillParams
pub fn fill_params(&self, fill_rule: FillRule) -> FillParams
Build FillParams from current state, applying transfer functions to color.
Sourcepub fn stroke_params(&self) -> StrokeParams
pub fn stroke_params(&self) -> StrokeParams
Build StrokeParams from current state with CTM scale applied, applying transfer to color.
Sourcepub fn stroke_params_with_ctm(&self) -> StrokeParams
pub fn stroke_params_with_ctm(&self) -> StrokeParams
Build StrokeParams with the CTM applied by the renderer (not pre-scaled). Used for correct anisotropic strokes where the CTM has non-uniform scaling.
Sourcepub fn ctm_scale_factor(&self) -> f64
pub fn ctm_scale_factor(&self) -> f64
CTM scale factor: sqrt(a^2 + b^2).
Trait Implementations§
Source§impl Clone for PdfGraphicsState
impl Clone for PdfGraphicsState
Source§fn clone(&self) -> PdfGraphicsState
fn clone(&self) -> PdfGraphicsState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PdfGraphicsState
impl RefUnwindSafe for PdfGraphicsState
impl Send for PdfGraphicsState
impl Sync for PdfGraphicsState
impl Unpin for PdfGraphicsState
impl UnsafeUnpin for PdfGraphicsState
impl UnwindSafe for PdfGraphicsState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more