Package com.itextpdf.kernel.utils
Class ColorUtils
java.lang.Object
com.itextpdf.kernel.utils.ColorUtils
Utility methods for color calculations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic floatcalculateSvgLuminance(float[] rgb) Calculates luminance using the SVG mask coefficients without gamma correction.static ColorConverts aDeviceRgbcolor toDeviceGrayusing the SVG mask luminance coefficients.
-
Method Details
-
toDeviceGrayForSvgLuminanceMode
Converts aDeviceRgbcolor toDeviceGrayusing the SVG mask luminance coefficients. Colors of other types andnullare 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
-