class HexaPDF::Content::ColorSpace::DeviceGray

The DeviceGray color space.

Constants

DEFAULT

The one (and only) DeviceGray color space.

Public Class Methods

new(_definition = nil) click to toggle source

Returns the DeviceGray color space object.

# File lib/hexapdf/content/color_space.rb, line 378
def self.new(_definition = nil)
  DEFAULT
end

Public Instance Methods

color(gray) click to toggle source

Returns the color object for the given gray component.

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.

# File lib/hexapdf/content/color_space.rb, line 392
def color(gray)
  Color.new(ColorUtils.normalize_value(gray, 255))
end
default_color() click to toggle source

Returns the default color for the DeviceGray color space.

# File lib/hexapdf/content/color_space.rb, line 383
def default_color
  Color.new(0.0)
end
definition()
Alias for: family
family() click to toggle source

Returns :DeviceGray.

# File lib/hexapdf/content/color_space.rb, line 404
def family
  :DeviceGray
end
Also aliased as: definition
prenormalized_color(gray) click to toggle source

Returns the color object for the gray component without applying value normalization.

See: color

# File lib/hexapdf/content/color_space.rb, line 399
def prenormalized_color(gray)
  Color.new(gray)
end