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
.new(_definition = nil) ⇒ Object
Returns the DeviceRGB color space object.
236 237 238 |
# File 'lib/hexapdf/content/color_space.rb', line 236 def self.new(_definition = nil) DEFAULT end |
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.
250 251 252 253 254 |
# File 'lib/hexapdf/content/color_space.rb', line 250 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.
241 242 243 |
# File 'lib/hexapdf/content/color_space.rb', line 241 def default_color Color.new(0.0, 0.0, 0.0) end |
#family ⇒ Object Also known as: definition
Returns :DeviceRGB
.
265 266 267 |
# File 'lib/hexapdf/content/color_space.rb', line 265 def family :DeviceRGB end |
#prenormalized_color(r, g, b) ⇒ Object
Returns the color object for the red, green and blue components without applying value normalization.
See: #color
260 261 262 |
# File 'lib/hexapdf/content/color_space.rb', line 260 def prenormalized_color(r, g, b) Color.new(r, g, b) end |