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.



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

def initialize
  super('RG')
end

Instance Method Details

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

:nodoc:



460
461
462
463
# File 'lib/hexapdf/content/operator.rb', line 460

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

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

:nodoc:



465
466
467
468
# File 'lib/hexapdf/content/operator.rb', line 465

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