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

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

#initializeSetDeviceRGBNonStrokingColor

Creates the operator.



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

def initialize
  super('rg')
end

Instance Method Details

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

:nodoc:



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

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

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

:nodoc:



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

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