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

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

Overview

Implementation of the ‘RG’ operator.

See: PDF2.0 s8.6.8

Instance Attribute Summary

Attributes inherited from BaseOperator

#name

Instance Method Summary collapse

Constructor Details

#initializeSetDeviceRGBStrokingColor

Creates the operator.



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

def initialize
  super('RG')
end

Instance Method Details

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

:nodoc:



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

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:



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

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