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: PDF1.7 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.



280
281
282
283
284
# File 'lib/hexapdf/content/color_space.rb', line 280

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

Instance Method Details

#color_spaceObject

Returns the DeviceRGB color space module.



287
288
289
# File 'lib/hexapdf/content/color_space.rb', line 287

def color_space
  DeviceRGB::DEFAULT
end

#componentsObject

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



292
293
294
# File 'lib/hexapdf/content/color_space.rb', line 292

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