- java.lang.Object
-
- com.github.weisj.jsvg.util.ColorUtil
-
public final class ColorUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static int[]LinearRGBtoSRGBprivate static int[][]LinearRGBtoSRGBPreprivate static int[]SRGBtoLinearRGBprivate static int[][]SRGBtoLinearRGBPreColor space conversion lookup tables.
-
Constructor Summary
Constructors Modifier Constructor Description privateColorUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intclampColor(int v)static intcomputeLuminance(int r, int g, int b)private static intconvertLinearRGBtoSRGB(int color, float alpha)Helper function to convert a color component in linear RGB space to SRGB space.private static intconvertSRGBtoLinearRGB(int color, float alpha)Helper function to convert a color component in sRGB space to linear RGB space.static intdiv255(int x)static voidHSLtoRGB(float h, float s, float l, int @NotNull [] rgb)private static floathue2RGB(float v1, float v2, float vH)static intlinearRGBtoSRGB(int argb)static intlinearRGBtoSRGBBand(int value)static voidlinearRGBtoSRGBinPlace(int @NotNull [] argb)static voidlinearRGBtoSRGBPreInPlace(int @NotNull [] argb)static voidRGBPretoHSL(int r, int g, int b, int a, float @NotNull [] hsl)static intsRGBtoLinearRGB(int argb)static intsRGBtoLinearRGBBand(int value)static voidsRGBtoLinearRGBinPlace(int @NotNull [] argb)static voidsRGBtoLinearRGBPreInPlace(int @NotNull [] argb)static inttoRgbRange(double value)static java.lang.StringtoString(@Nullable java.awt.Color c)static java.awt.ColorwithAlpha(@NotNull java.awt.Color c, float alpha)
-
-
-
Field Detail
-
SRGBtoLinearRGBPre
private static final int[][] SRGBtoLinearRGBPre
Color space conversion lookup tables.
-
SRGBtoLinearRGB
private static final int[] SRGBtoLinearRGB
-
LinearRGBtoSRGBPre
private static final int[][] LinearRGBtoSRGBPre
-
LinearRGBtoSRGB
private static final int[] LinearRGBtoSRGB
-
-
Method Detail
-
div255
public static int div255(int x)
-
computeLuminance
public static int computeLuminance(int r, int g, int b)
-
toRgbRange
public static int toRgbRange(double value)
-
withAlpha
public static java.awt.Color withAlpha(@NotNull @NotNull java.awt.Color c, float alpha)
-
toString
public static java.lang.String toString(@Nullable @Nullable java.awt.Color c)
-
RGBPretoHSL
public static void RGBPretoHSL(int r, int g, int b, int a, float @NotNull [] hsl)
-
HSLtoRGB
public static void HSLtoRGB(float h, float s, float l, int @NotNull [] rgb)
-
hue2RGB
private static float hue2RGB(float v1, float v2, float vH)
-
sRGBtoLinearRGBinPlace
public static void sRGBtoLinearRGBinPlace(int @NotNull [] argb)
-
linearRGBtoSRGBinPlace
public static void linearRGBtoSRGBinPlace(int @NotNull [] argb)
-
sRGBtoLinearRGBPreInPlace
public static void sRGBtoLinearRGBPreInPlace(int @NotNull [] argb)
-
linearRGBtoSRGBPreInPlace
public static void linearRGBtoSRGBPreInPlace(int @NotNull [] argb)
-
sRGBtoLinearRGBBand
public static int sRGBtoLinearRGBBand(int value)
-
sRGBtoLinearRGB
public static int sRGBtoLinearRGB(int argb)
-
linearRGBtoSRGBBand
public static int linearRGBtoSRGBBand(int value)
-
linearRGBtoSRGB
public static int linearRGBtoSRGB(int argb)
-
convertSRGBtoLinearRGB
private static int convertSRGBtoLinearRGB(int color, float alpha)Helper function to convert a color component in sRGB space to linear RGB space. Used to build a static lookup table.
-
convertLinearRGBtoSRGB
private static int convertLinearRGBtoSRGB(int color, float alpha)Helper function to convert a color component in linear RGB space to SRGB space. Used to build a static lookup table.
-
clampColor
public static int clampColor(int v)
-
-