Skip to main content

Op

Enum Op 

Source
#[non_exhaustive]
pub enum Op {
Show 75 variants SaveState(), RestoreState(), Concat(Affine), SetLineWidth(f32), SetLineCap(LineCap), SetLineJoin(LineJoin), SetMiterLimit(f32), SetDash(DashPattern), SetRenderIntent(Name), SetFlatness(f32), SetExtGState(Name), MoveTo(Point), LineTo(Point), CurveTo(Point, Point, Point), CurveToV(Point, Point), CurveToY(Point, Point), ClosePath(), Rectangle(f32, f32, f32, f32), Stroke(), CloseStroke(), Fill(), FillObsolete(), FillEvenOdd(), FillStroke(), FillStrokeEvenOdd(), CloseFillStroke(), CloseFillStrokeEvenOdd(), EndPath(), Clip(), ClipEvenOdd(), BeginText(), EndText(), TextMove(f32, f32), TextMoveSetLeading(f32, f32), SetTextMatrix(Affine), TextNextLine(), SetLeading(f32), SetTextRise(f32), SetHorzScale(f32), SetCharSpace(f32), SetWordSpace(f32), SetFont(Name, f32), SetTextRenderMode(i64), ShowText(PdfString), NextLineShowText(PdfString), SetSpacingShowText(f32, f32, PdfString), ShowTextAdjusted(TextArray), Type3Width(f32, f32), Type3WidthBBox(f32, f32, f32, f32, f32, f32), SetStrokeColorSpace(Name), SetFillColorSpace(Name), SetStrokeColor(Components), SetFillColor(Components), SetStrokeColorN(PatternComponents), SetFillColorN(PatternComponents), SetStrokeGray(f32), SetFillGray(f32), SetStrokeRgb(f32, f32, f32), SetFillRgb(f32, f32, f32), SetStrokeCmyk(f32, f32, f32, f32), SetFillCmyk(f32, f32, f32, f32), DoXObject(Name), ShadeFill(Name), BeginInlineImage(), InlineImageData(), EndInlineImage(), BeginMarkedContent(Name), BeginMarkedContentDict(Name, MarkProps), EndMarkedContent(), MarkPoint(Name), MarkPointDict(Name, MarkProps), BeginCompat(), EndCompat(), InlineImage(Box<InlineImage>), Unknown(Box<[u8]>),
}
Expand description

One content-stream operator with its operands already extracted.

Generated from the table in this module, which is the only place operator spellings appear.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SaveState()

q — push a copy of the graphics state.

§

RestoreState()

Q — pop the graphics state; a no-op on an empty stack.

§

Concat(Affine)

cm — pre-concatenate a matrix onto the CTM.

§

SetLineWidth(f32)

w — set the line width. Negative and zero widths are stored as-is.

§

SetLineCap(LineCap)

J — set the line cap.

§

SetLineJoin(LineJoin)

j — set the line join.

§

SetMiterLimit(f32)

M — set the miter limit.

§

SetDash(DashPattern)

d — set the dash pattern and phase.

§

SetRenderIntent(Name)

ri — set the rendering intent. PDFium discards it outright; only the /RI ExtGState key is stored.

§

SetFlatness(f32)

i — set the flatness tolerance. Stored, never used.

§

SetExtGState(Name)

gs — apply a named /ExtGState dictionary.

§

MoveTo(Point)

m — begin a new subpath at a point.

§

LineTo(Point)

l — append a straight segment.

§

CurveTo(Point, Point, Point)

c — append a cubic Bézier with both control points given.

§

CurveToV(Point, Point)

v — append a cubic Bézier whose first control point is the current point.

§

CurveToY(Point, Point)

y — append a cubic Bézier whose second control point is its endpoint.

§

ClosePath()

h — close the current subpath.

§

Rectangle(f32, f32, f32, f32)

re — append a complete rectangle as a new subpath: x, y, width, height, oldest first.

§

Stroke()

S — stroke the path.

§

CloseStroke()

s — close and stroke.

§

Fill()

f — fill with the nonzero winding rule.

§

FillObsolete()

F — the obsolete spelling of f, handled identically.

§

FillEvenOdd()

f* — fill with the even-odd rule.

§

FillStroke()

B — fill then stroke, nonzero winding.

§

FillStrokeEvenOdd()

B* — fill then stroke, even-odd.

§

CloseFillStroke()

b — close, fill and stroke, nonzero winding.

§

CloseFillStrokeEvenOdd()

b* — close, fill and stroke, even-odd. Unlike b, this appends the closing segment unconditionally.

§

EndPath()

n — end the path without painting; only a pending clip survives.

§

Clip()

W — intersect the clip with the current path, nonzero winding.

§

ClipEvenOdd()

W* — intersect the clip with the current path, even-odd.

§

BeginText()

BT — begin a text object, resetting both text matrices.

§

EndText()

ET — end a text object, flushing any pending text clip.

§

TextMove(f32, f32)

Td — move to the start of the next line, offset from the current line start.

§

TextMoveSetLeading(f32, f32)

TDTd plus setting the leading to the negated y offset.

§

SetTextMatrix(Affine)

Tm — set the text matrix and the line matrix.

§

TextNextLine()

T* — move to the start of the next line.

§

SetLeading(f32)

TL — set the leading.

§

SetTextRise(f32)

Ts — set the text rise.

§

SetHorzScale(f32)

Tz — set the horizontal scale, stored as the percentage over 100.

§

SetCharSpace(f32)

Tc — set the character spacing.

§

SetWordSpace(f32)

Tw — set the word spacing.

§

SetFont(Name, f32)

Tf — set the font and size. The size is always taken; the font only when the name resolves.

§

SetTextRenderMode(i64)

Tr — set the text rendering mode. Values outside 0..=7 leave the mode unchanged, so the operand arrives raw.

§

ShowText(PdfString)

Tj — show a string.

§

NextLineShowText(PdfString)

' — move to the next line and show a string.

§

SetSpacingShowText(f32, f32, PdfString)

" — set word and character spacing, then '. The string is the newest operand.

§

ShowTextAdjusted(TextArray)

TJ — show strings with individual position adjustments.

§

Type3Width(f32, f32)

d0 — declare a coloured Type 3 glyph’s advance.

§

Type3WidthBBox(f32, f32, f32, f32, f32, f32)

d1 — declare an uncoloured Type 3 glyph’s advance and bounding box, oldest first.

§

SetStrokeColorSpace(Name)

CS — set the stroking colorspace, resetting the colour to its default.

§

SetFillColorSpace(Name)

cs — set the non-stroking colorspace.

§

SetStrokeColor(Components)

SC — set stroking colour components, at most four.

§

SetFillColor(Components)

sc — set non-stroking colour components, at most four.

§

SetStrokeColorN(PatternComponents)

SCN — set stroking colour components, optionally naming a pattern.

§

SetFillColorN(PatternComponents)

scn — set non-stroking colour components, optionally naming a pattern.

§

SetStrokeGray(f32)

G — set the stroking colour to a DeviceGray level.

§

SetFillGray(f32)

g — set the non-stroking colour to a DeviceGray level.

§

SetStrokeRgb(f32, f32, f32)

RG — set the stroking colour to a DeviceRGB triple.

§

SetFillRgb(f32, f32, f32)

rg — set the non-stroking colour to a DeviceRGB triple.

§

SetStrokeCmyk(f32, f32, f32, f32)

K — set the stroking colour to a DeviceCMYK quadruple.

§

SetFillCmyk(f32, f32, f32, f32)

k — set the non-stroking colour to a DeviceCMYK quadruple.

§

DoXObject(Name)

Do — paint a named form or image XObject.

§

ShadeFill(Name)

sh — paint a named shading across the clip region.

§

BeginInlineImage()

BI — begin an inline image. Reaching dispatch means the tokenizer abandoned the image, so the operator itself does nothing.

§

InlineImageData()

ID — a stray ID outside a BI. A no-op.

§

EndInlineImage()

EI — a stray EI outside a BI. A no-op.

§

BeginMarkedContent(Name)

BMC — begin a marked-content sequence with no properties.

§

BeginMarkedContentDict(Name, MarkProps)

BDC — begin a marked-content sequence with a property list.

§

EndMarkedContent()

EMC — end a marked-content sequence; never pops past the sentinel.

§

MarkPoint(Name)

MP — a marked-content point with no properties. A no-op.

§

MarkPointDict(Name, MarkProps)

DP — a marked-content point with a property list. A no-op.

§

BeginCompat()

BX — begin a compatibility section. PDFium never registers this, so it falls through as an unknown keyword and is ignored; we name it so the enum is complete.

§

EndCompat()

EX — end a compatibility section. Ignored, like BX.

§

InlineImage(Box<InlineImage>)

An inline image, consumed whole by the tokenizer.

§

Unknown(Box<[u8]>)

A keyword that names no operator. PDFium drops it silently after clearing the operands; we keep the spelling so a diagnostic and a dump can name it.

Implementations§

Source§

impl Op

Source

pub fn keyword(&self) -> &[u8]

The operator’s spelling as it appears in a content stream.

Source

pub fn is_operator(word: &[u8]) -> bool

Whether word names a registered operator.

BI/ID/EI are registered but never reach dispatch — the tokenizer consumes an inline image whole.

Trait Implementations§

Source§

impl Clone for Op

Source§

fn clone(&self) -> Op

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 Op

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Op

Source§

fn eq(&self, other: &Op) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Op

Auto Trait Implementations§

§

impl Freeze for Op

§

impl RefUnwindSafe for Op

§

impl Send for Op

§

impl Sync for Op

§

impl Unpin for Op

§

impl UnsafeUnpin for Op

§

impl UnwindSafe for Op

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> 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, !>

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.