Class ColorUtils

java.lang.Object
com.itextpdf.kernel.utils.ColorUtils

public final class ColorUtils extends Object
Utility methods for color calculations.
  • Method Details

    • toDeviceGrayForSvgLuminanceMode

      public static Color toDeviceGrayForSvgLuminanceMode (Color color)
      Converts a DeviceRgb color to DeviceGray using the SVG mask luminance coefficients. Colors of other types and null are returned unchanged.
      Parameters:
      color - the color to convert
      Returns:
      the grayscale color for an RGB input, otherwise the original color
    • calculateSvgLuminance

      public static float calculateSvgLuminance (float[] rgb)
      Calculates luminance using the SVG mask coefficients without gamma correction.
      Parameters:
      rgb - the red, green and blue components, each in the range [0, 1]
      Returns:
      the luminance of the RGB color