module HexaPDF::Content::ColorSpace::ColorUtils
def ==(other)
Compares this color to another one by looking at their associated color spaces and their
def ==(other) other.respond_to?(:components) && other.respond_to?(:color_space) && components == other.components && color_space == other.color_space end
def normalize_value(value, upper)
* If the color value is greater than 1.0, it is set to 1.0.
* If the color value is an Integer, it is converted to a float and divided by +upper+.
The conversion is done in the following way:
Normalizes the given color value so that it is in the range from 0.0 to 1.0.
def normalize_value(value, upper) value = value.to_f / upper if value.kind_of?(Integer) value.clamp(0, 1) end