pub struct GraphicsState {
pub ctm: Matrix,
pub text_matrix: Matrix,
pub text_line_matrix: Matrix,
pub text_state: TextState,
pub fill_color: Vec<f64>,
pub stroke_color: Vec<f64>,
pub fill_color_space_components: u8,
pub stroke_color_space_components: u8,
pub fill_pattern: Option<Vec<u8>>,
pub stroke_pattern: Option<Vec<u8>>,
}Expand description
Full graphics state for PDF content stream processing.
Fields§
§ctm: MatrixCurrent transformation matrix
text_matrix: MatrixText matrix (set by BT and text positioning operators)
text_line_matrix: MatrixText line matrix (set by text line positioning operators)
text_state: TextStateText state parameters
fill_color: Vec<f64>Fill color — original PDF color components (1=Gray, 3=RGB, 4=CMYK)
stroke_color: Vec<f64>Stroke color — original PDF color components
fill_color_space_components: u8Number of components in current non-stroking color space (1=Gray, 3=RGB, 4=CMYK).
0 means Pattern (no numeric components).
stroke_color_space_components: u8Number of components in current stroking color space.
0 means Pattern (no numeric components).
fill_pattern: Option<Vec<u8>>Active non-stroking Pattern resource name (from scn with a name operand).
stroke_pattern: Option<Vec<u8>>Active stroking Pattern resource name (from SCN with a name operand).
Implementations§
Source§impl GraphicsState
impl GraphicsState
Sourcepub fn begin_text(&mut self)
pub fn begin_text(&mut self)
Begin text object: reset text matrix and text line matrix.
Sourcepub fn text_rendering_matrix(&self) -> Matrix
pub fn text_rendering_matrix(&self) -> Matrix
Get the combined text rendering matrix: text_state.font_size × text_matrix × CTM.
Sourcepub fn text_position(&self) -> (f64, f64)
pub fn text_position(&self) -> (f64, f64)
Get the current text position in user space.
Sourcepub fn effective_font_size(&self) -> f64
pub fn effective_font_size(&self) -> f64
Get the effective font size in user space.
Sourcepub fn translate_text(&mut self, tx: f64, ty: f64)
pub fn translate_text(&mut self, tx: f64, ty: f64)
Apply Td (translate text position).
Sourcepub fn set_text_matrix(
&mut self,
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64,
)
pub fn set_text_matrix( &mut self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64, )
Apply Tm (set text matrix directly).
Sourcepub fn advance_text(&mut self, displacement: f64)
pub fn advance_text(&mut self, displacement: f64)
Advance the text position after showing text (Tj displacement).
Trait Implementations§
Source§impl Clone for GraphicsState
impl Clone for GraphicsState
Source§impl Debug for GraphicsState
impl Debug for GraphicsState
Auto Trait Implementations§
impl Freeze for GraphicsState
impl RefUnwindSafe for GraphicsState
impl Send for GraphicsState
impl Sync for GraphicsState
impl Unpin for GraphicsState
impl UnsafeUnpin for GraphicsState
impl UnwindSafe for GraphicsState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().