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, Leading, LineCap, LineJoin, LineTo, LineWidth, MarkedContentPoint, MarkedContentPointWithProperties, MiterLimit, MoveTo, MoveToNextLineShowText, NoArg, Rectangle, RenderingIntent, RenderingMode, Rise, SetFillColor, SetFillColorN, SetFillColorSpace, SetSpacingMoveToShowText, SetStrokeColor, SetStrokeColorN, SetStrokeColorSpace, SetTextMatrix, ShowText, ShowTextWithSpacing, 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.).
57 |
# File 'lib/pdfrb/content/operator.rb', line 57 def invoke(_processor, *_operands); end |
.name ⇒ Object
36 37 38 |
# File 'lib/pdfrb/content/operator.rb', line 36 def name raise NotImplementedError, "#{self} must define self.name" end |
.register ⇒ Object
40 41 42 |
# File 'lib/pdfrb/content/operator.rb', line 40 def register Operator.register(self.name, self) end |
.serialize(serializer, *operands) ⇒ Object
Default serialize: join operands with spaces and append the operator keyword.
46 47 48 49 50 51 52 53 |
# File 'lib/pdfrb/content/operator.rb', line 46 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 |