Class: HexaPDF::Content::Operator::SetDeviceRGBNonStrokingColor

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

#initializeSetDeviceRGBNonStrokingColor

Creates the operator.



476
477
478
# File 'lib/hexapdf/content/operator.rb', line 476

def initialize
  super('rg')
end

Instance Method Details

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

:nodoc:



480
481
482
483
# File 'lib/hexapdf/content/operator.rb', line 480

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

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

:nodoc:



485
486
487
488
# File 'lib/hexapdf/content/operator.rb', line 485

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