Class: HexaPDF::Content::ColorSpace::DeviceRGB::Color

Inherits:
Object
  • Object
show all
Includes:
ColorUtils
Defined in:
lib/hexapdf/content/color_space.rb

Overview

A color in the DeviceRGB color space.

See: PDF2.0 s8.6.4.3

Instance Method Summary collapse

Methods included from ColorUtils

#==, normalize_value

Constructor Details

#initialize(r, g, b) ⇒ Color

Initializes the color with the r (red), g (green) and b (blue) components.

Each argument has to be a float between 0.0 and 1.0.



528
529
530
531
532
# File 'lib/hexapdf/content/color_space.rb', line 528

def initialize(r, g, b)
  @r = r
  @g = g
  @b = b
end

Instance Method Details

#color_spaceObject

Returns the DeviceRGB color space module.



535
536
537
# File 'lib/hexapdf/content/color_space.rb', line 535

def color_space
  DeviceRGB::DEFAULT
end

#componentsObject

Returns the RGB color as an array of normalized color values.



540
541
542
# File 'lib/hexapdf/content/color_space.rb', line 540

def components
  [@r, @g, @b]
end