Skip to main content

PdfGraphicsState

Struct PdfGraphicsState 

Source
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: i32

Overprint mode: 0 = all components painted, 1 = only non-zero components painted.

§opm_paired: bool

True 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: u8

CMYK channel bitmask for fill overprint (which channels the current fill color space paints).

§fill_is_device_cmyk: bool

True when fill color space is DeviceCMYK or ICCBased(4) — OPM 1 only applies to these.

§stroke_painted_channels: u8

CMYK channel bitmask for stroke overprint.

§stroke_is_device_cmyk: bool

True 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: u32

Clip 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: bool

True when fill color is Separation/None (produces no visible marks).

§stroke_is_none: bool

True when stroke color is Separation/None (produces no visible marks).

§blend_mode: u8

Blend mode (0=Normal, 1=Multiply, …, 11=Exclusion).

§alpha_is_shape: bool

PDF AIS (alpha-is-shape) from ExtGState. Default false.

§text_knockout: bool

PDF 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: f64

Horizontal 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: u32

Counter for unique pattern IDs.

§transfer: TransferState

Transfer function state.

§soft_mask: Option<SoftMask>

Active soft mask from ExtGState /SMask.

§smask_gen: u64

Generation 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

Source

pub fn new(initial_ctm: Matrix) -> Self

Create a new graphics state with PDF defaults.

Source

pub fn fill_params(&self, fill_rule: FillRule) -> FillParams

Build FillParams from current state, applying transfer functions to color.

Source

pub fn stroke_params(&self) -> StrokeParams

Build StrokeParams from current state with CTM scale applied, applying transfer to color.

Source

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.

Source

pub fn ctm_scale_factor(&self) -> f64

CTM scale factor: sqrt(a^2 + b^2).

Trait Implementations§

Source§

impl Clone for PdfGraphicsState

Source§

fn clone(&self) -> PdfGraphicsState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PdfGraphicsState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.