Class: HexaPDF::Content::ColorSpace::DeviceCMYK::Color

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

Overview

A color in the DeviceCMYK color space.

Color values can either be integers in the range from 0 to 100 or floating point numbers between 0.0 and 1.0. The integer color values are automatically normalized to the DeviceCMYK color value range of 0.0 to 1.0.

See: PDF1.7 s8.6.4.4

Instance Method Summary collapse

Methods included from ColorUtils

#==

Constructor Details

#initialize(c, m, y, k) ⇒ Color

Initializes the color with the c (cyan), m (magenta), y (yellow) and k (black) components.

Each argument has to be either an integer between 0 and 100 or a float between 0.0 and 1.0.



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

def initialize(c, m, y, k)
  @c = normalize_value(c, 100)
  @m = normalize_value(m, 100)
  @y = normalize_value(y, 100)
  @k = normalize_value(k, 100)
end

Instance Method Details

#color_spaceObject

Returns the DeviceCMYK color space module.



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

def color_space
  DeviceCMYK::DEFAULT
end

#componentsObject

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



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

def components
  [@c, @m, @y, @k]
end