Class: HexaPDF::Content::Operator::SetDeviceRGBStrokingColor

Inherits:
BaseOperator
  • Object
show all
Defined in:
lib/hexapdf/content/operator.rb

Overview

Implementation of the ‘RG’ operator.

See: PDF1.7 s8.6.8

Instance Attribute Summary

Attributes inherited from BaseOperator

#name

Instance Method Summary collapse

Constructor Details

#initializeSetDeviceRGBStrokingColor

Creates the operator.



453
454
455
# File 'lib/hexapdf/content/operator.rb', line 453

def initialize
  super('RG')
end

Instance Method Details

#invoke(processor, r, g, b) ⇒ Object

:nodoc:



457
458
459
460
# File 'lib/hexapdf/content/operator.rb', line 457

def invoke(processor, r, g, b) #:nodoc:
  processor.graphics_state.stroke_color =
    processor.resources.color_space(:DeviceRGB).color(r, g, b)
end

#serialize(serializer, r, g, b) ⇒ Object

:nodoc:



462
463
464
465
# File 'lib/hexapdf/content/operator.rb', line 462

def serialize(serializer, r, g, b) #:nodoc:
  "#{serializer.serialize_numeric(r)} #{serializer.serialize_numeric(g)} " \
    "#{serializer.serialize_numeric(b)} RG\n".freeze
end