public class ColorConverter
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static ColorConverter |
ABGR
The ABGR color format (
0xAA_BB_GG_RR). |
static ColorConverter |
ARGB
The ARGB color format (
0xAA_RR_GG_BB). |
static ColorConverter |
BGR
The BGR color format (
0xBB_GG_RR). |
static ColorConverter |
BGRA
The BGRA color format (
0xBB_GG_RR_AA). |
static ColorConverter |
RGB
The RGB color format (
0xRR_GG_BB). |
static ColorConverter |
RGBA
The RGBA color format (
0xRR_GG_BB_AA). |
| Constructor and Description |
|---|
ColorConverter(int rShift,
int gShift,
int bShift)
Create a new color converter.
|
ColorConverter(int rShift,
int gShift,
int bShift,
int aShift)
Create a new color converter.
|
| Modifier and Type | Method and Description |
|---|---|
static float[] |
convert(float[] color,
ColorConverter from,
ColorConverter to)
Convert a color from one format to another.
|
static int |
convert(int color,
ColorConverter from,
ColorConverter to)
Convert a color from one format to another.
|
static float[] |
convertToFloats(int color,
ColorConverter from,
ColorConverter to)
Convert an int color representation to a float color representation.
|
static int |
convertToInt(float[] color,
ColorConverter from,
ColorConverter to)
Convert a float color representation to an int color representation.
|
java.awt.Color |
from(float[] color)
Convert the float representation of a color to a color.
|
java.awt.Color |
from(float r,
float g,
float b)
Convert the float representation of a color to a color.
|
java.awt.Color |
from(float r,
float g,
float b,
float a)
Convert the float representation of a color to a color.
|
java.awt.Color |
from(int color)
Convert the int representation of a color to a color.
|
float |
getAlpha(float[] color)
Get the alpha value of a color.
|
int |
getAlpha(int color)
Get the alpha value of a color.
|
float |
getBlue(float[] color)
Get the blue value of a color.
|
int |
getBlue(int color)
Get the blue value of a color.
|
float |
getGreen(float[] color)
Get the green value of a color.
|
int |
getGreen(int color)
Get the green value of a color.
|
float |
getRed(float[] color)
Get the red value of a color.
|
int |
getRed(int color)
Get the red value of a color.
|
float[] |
setAlpha(float[] color,
float a)
Set the alpha value of a color.
|
int |
setAlpha(int color,
int a)
Set the alpha value of a color.
|
float[] |
setBlue(float[] color,
float b)
Set the blue value of a color.
|
int |
setBlue(int color,
int b)
Set the blue value of a color.
|
float[] |
setGreen(float[] color,
float g)
Set the green value of a color.
|
int |
setGreen(int color,
int g)
Set the green value of a color.
|
float[] |
setRed(float[] color,
float r)
Set the red value of a color.
|
int |
setRed(int color,
int r)
Set the red value of a color.
|
int |
to(java.awt.Color color)
Convert a color to its int representation.
|
int |
to(float r,
float g,
float b,
float a)
Convert a color to its int representation.
|
int |
to(int r,
int g,
int b,
int a)
Convert a color to its int representation.
|
float[] |
toFloats(java.awt.Color color)
Convert a color to its float representation.
|
float[] |
toFloats(float r,
float g,
float b,
float a)
Convert a color to its float representation.
|
float[] |
toFloats(int r,
int g,
int b)
Convert a color to its float representation.
|
float[] |
toFloats(int r,
int g,
int b,
int a)
Convert a color to its float representation.
|
public static final ColorConverter RGB
0xRR_GG_BB).public static final ColorConverter ARGB
0xAA_RR_GG_BB).public static final ColorConverter RGBA
0xRR_GG_BB_AA).public static final ColorConverter BGR
0xBB_GG_RR).public static final ColorConverter ABGR
0xAA_BB_GG_RR).public static final ColorConverter BGRA
0xBB_GG_RR_AA).public ColorConverter(int rShift,
int gShift,
int bShift)
rShift - The shift for the red valuegShift - The shift for the green valuebShift - The shift for the blue valuepublic ColorConverter(int rShift,
int gShift,
int bShift,
int aShift)
rShift - The shift for the red valuegShift - The shift for the green valuebShift - The shift for the blue valueaShift - The shift for the alpha valuepublic static int convert(int color,
ColorConverter from,
ColorConverter to)
color - The color to convertfrom - The format the color is into - The format to convert the color topublic static float[] convert(float[] color,
ColorConverter from,
ColorConverter to)
color - The color to convertfrom - The format the color is into - The format to convert the color topublic static int convertToInt(float[] color,
ColorConverter from,
ColorConverter to)
color - The color to convertfrom - The format the color is into - The format to convert the color topublic static float[] convertToFloats(int color,
ColorConverter from,
ColorConverter to)
color - The color to convertfrom - The format the color is into - The format to convert the color topublic int getRed(int color)
color - The colorpublic float getRed(float[] color)
color - The colorpublic int setRed(int color,
int r)
color - The color to modifyr - The red valuepublic float[] setRed(float[] color,
float r)
color - The color to modifyr - The red valuepublic int getGreen(int color)
color - The colorpublic float getGreen(float[] color)
color - The colorpublic int setGreen(int color,
int g)
color - The color to modifyg - The green valuepublic float[] setGreen(float[] color,
float g)
color - The color to modifyg - The green valuepublic int getBlue(int color)
color - The colorpublic float getBlue(float[] color)
color - The colorpublic int setBlue(int color,
int b)
color - The color to modifyb - The blue valuepublic float[] setBlue(float[] color,
float b)
color - The color to modifyb - The blue valuepublic int getAlpha(int color)
color - The colorpublic float getAlpha(float[] color)
color - The colorpublic int setAlpha(int color,
int a)
color - The color to modifya - The alpha valuepublic float[] setAlpha(float[] color,
float a)
color - The color to modifya - The alpha valuepublic int to(java.awt.Color color)
color - The colorpublic int to(int r,
int g,
int b,
int a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic int to(float r,
float g,
float b,
float a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic float[] toFloats(java.awt.Color color)
color - The colorpublic float[] toFloats(int r,
int g,
int b)
r - The red valueg - The green valueb - The blue valuepublic float[] toFloats(int r,
int g,
int b,
int a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic float[] toFloats(float r,
float g,
float b,
float a)
r - The red valueg - The green valueb - The blue valuea - The alpha valuepublic java.awt.Color from(int color)
color - The int representationpublic java.awt.Color from(float[] color)
color - The float representationpublic java.awt.Color from(float r,
float g,
float b)
r - The red valueg - The green valueb - The blue valuepublic java.awt.Color from(float r,
float g,
float b,
float a)
r - The red valueg - The green valueb - The blue valuea - The alpha value