Class: HexaPDF::Content::ColorSpace::DeviceRGB
- Inherits:
-
Object
- Object
- HexaPDF::Content::ColorSpace::DeviceRGB
- Defined in:
- lib/hexapdf/content/color_space.rb
Overview
The DeviceRGB color space.
Defined Under Namespace
Classes: Color
Constant Summary collapse
- DEFAULT =
The one (and only) DeviceRGB color space.
new
Class Method Summary collapse
-
.new(_definition = nil) ⇒ Object
Returns the DeviceRGB color space object.
Instance Method Summary collapse
-
#color(r, g, b) ⇒ Object
Returns the color object for the red, green and blue components.
-
#default_color ⇒ Object
Returns the default color for the DeviceRGB color space.
-
#family ⇒ Object
(also: #definition)
Returns
:DeviceRGB. -
#prenormalized_color(r, g, b) ⇒ Object
Returns the color object for the red, green and blue components without applying value normalization.
Class Method Details
Instance Method Details
#color(r, g, b) ⇒ Object
Returns the color object for the red, green and blue components.
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 DeviceRGB color value range of 0.0 to 1.0.
416 417 418 419 420 |
# File 'lib/hexapdf/content/color_space.rb', line 416 def color(r, g, b) Color.new(ColorUtils.normalize_value(r, 255), ColorUtils.normalize_value(g, 255), ColorUtils.normalize_value(b, 255)) end |
#default_color ⇒ Object
Returns the default color for the DeviceRGB color space.
407 408 409 |
# File 'lib/hexapdf/content/color_space.rb', line 407 def default_color Color.new(0.0, 0.0, 0.0) end |
#family ⇒ Object Also known as: definition
Returns :DeviceRGB.
431 432 433 |
# File 'lib/hexapdf/content/color_space.rb', line 431 def family :DeviceRGB end |