Class: Pdfrb::Content::Operator::Base
- Inherits:
-
Object
- Object
- Pdfrb::Content::Operator::Base
- Defined in:
- lib/pdfrb/content/operator.rb
Overview
Base class. Subclasses override name and optionally
invoke (read-side effect on the Processor) and serialize
(write-side emit).
Direct Known Subclasses
ApplyExtGState, BeginMarkedContent, BeginMarkedContentWithProperties, CharSpacing, ConcatMatrix, CurveTo, CurveToFirstReflected, CurveToLastEqual, DashPattern, FillCMYK, FillGray, FillRGB, Flatness, Font, HorizontalScaling, InvokeXObject, Leading, LineCap, LineJoin, LineTo, LineWidth, MarkedContentPoint, MarkedContentPointWithProperties, MiterLimit, MoveTo, MoveToNextLineShowText, NoArg, NonStrokeAlpha, Rectangle, RenderingIntent, RenderingMode, Rise, SetFillColor, SetFillColorN, SetFillColorSpace, SetSpacingMoveToShowText, SetStrokeColor, SetStrokeColorN, SetStrokeColorSpace, SetTextMatrix, ShowText, ShowTextWithSpacing, StrokeAlpha, StrokeCMYK, StrokeGray, StrokeRGB, TextTranslate, TextTranslateSetLeading, Unknown, WordSpacing
Class Method Summary collapse
-
.invoke(_processor, *_operands) ⇒ Object
Read-side: default no-op.
- .name ⇒ Object
- .register ⇒ Object
-
.serialize(serializer, *operands) ⇒ Object
Default serialize: join operands with spaces and append the operator keyword.
Class Method Details
.invoke(_processor, *_operands) ⇒ Object
Read-side: default no-op. Subclasses override to mutate processor.graphics_state (or do painting / text / etc.).
77 |
# File 'lib/pdfrb/content/operator.rb', line 77 def invoke(_processor, *_operands); end |
.name ⇒ Object
56 57 58 |
# File 'lib/pdfrb/content/operator.rb', line 56 def name raise NotImplementedError, "#{self} must define self.name" end |
.register ⇒ Object
60 61 62 |
# File 'lib/pdfrb/content/operator.rb', line 60 def register Operator.register(self.name, self) end |
.serialize(serializer, *operands) ⇒ Object
Default serialize: join operands with spaces and append the operator keyword.
66 67 68 69 70 71 72 73 |
# File 'lib/pdfrb/content/operator.rb', line 66 def serialize(serializer, *operands) prefix = operands.empty? ? +"#{name}\n" : +"" unless operands.empty? prefix << operands.map { |o| serializer.serialize(o) }.join(" ") prefix << " #{name}\n" end prefix end |