Class: HexaPDF::Content::ColorSpace::DeviceGray::Color
- Inherits:
-
Object
- Object
- HexaPDF::Content::ColorSpace::DeviceGray::Color
- Includes:
- ColorUtils
- Defined in:
- lib/hexapdf/content/color_space.rb
Overview
A color in the DeviceGray color space.
Color values can either be integers in the range from 0 to 255 or floating point numbers between 0.0 and 1.0. The integer color values are automatically normalized to the DeviceGray color value range of 0.0 to 1.0.
See: PDF1.7 s8.6.4.2
Instance Method Summary collapse
-
#color_space ⇒ Object
Returns the DeviceGray color space module.
-
#components ⇒ Object
Returns the normalized gray value as an array.
-
#initialize(gray) ⇒ Color
constructor
Initializes the color with the
gray
component.
Methods included from ColorUtils
Constructor Details
#initialize(gray) ⇒ Color
Initializes the color with the gray
component.
The argument gray
has to be either an integer between 0 and 255 or a float between 0.0 and 1.0.
343 344 345 |
# File 'lib/hexapdf/content/color_space.rb', line 343 def initialize(gray) @gray = normalize_value(gray, 255) end |
Instance Method Details
#color_space ⇒ Object
Returns the DeviceGray color space module.
348 349 350 |
# File 'lib/hexapdf/content/color_space.rb', line 348 def color_space DeviceGray::DEFAULT end |
#components ⇒ Object
Returns the normalized gray value as an array.
353 354 355 |
# File 'lib/hexapdf/content/color_space.rb', line 353 def components [@gray] end |