|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpulpcore.image.Colors
public class Colors
The Colors class provides convenience methods to create packed, 32-bit ARGB colors.
| Field Summary | |
|---|---|
static int |
BLACK
The color black. |
static int |
BLUE
The color blue. |
static int |
CYAN
The color cyan. |
static int |
DARKGRAY
The color dark black. |
static int |
GRAY
The color gray. |
static int |
GREEN
The color green. |
static int |
LIGHTGRAY
The color light gray. |
static int |
MAGENTA
The color magenta. |
static int |
ORANGE
The color orange. |
static int |
PURPLE
The color purple. |
static int |
RED
The color red. |
static int |
TRANSPARENT
Fully transparent color. |
static int |
WHITE
The color white. |
static int |
YELLOW
The color yellow. |
| Method Summary | |
|---|---|
static int |
brighter(int color)
Creates a brighter version of the specified color. |
static int |
darker(int color)
Creates a darker version of the specified color. |
static int |
getAlpha(int color)
Gets the alpha component of a 32-bit ARGB color. |
static int |
getBlue(int color)
Gets the blue component of a 32-bit ARGB color. |
static int |
getBrightness(int color)
Gets the brightness of a 32-bit ARGB color. |
static int |
getGreen(int color)
Gets the green component of a 32-bit ARGB color. |
static int |
getHue(int color)
Gets the hue of a 32-bit ARGB color. |
static int |
getRed(int color)
Gets the red component of a 32-bit ARGB color. |
static int |
getSaturation(int color)
Gets the saturation of a 32-bit ARGB color. |
static int |
gray(int gray)
Creates an opaque gray color. |
static int |
gray(int gray,
int alpha)
Creates a translucent gray color. |
static int |
hsb(int h,
int s,
int b)
Creates an opaque color. |
static int |
hsba(int h,
int s,
int b,
int alpha)
Creates a color with alpha. |
static int |
HSBtoRGB(int ahsbColor)
Converts a packed, 32-bit HSB (hue, saturation, brightness) color to RGB (red, green, blue). |
static int |
hue(int h)
Creates a fully bright, fully saturated opaque color with the specified hue. |
static int |
hue(int h,
int alpha)
Creates a fully bright, fully saturated color with the specified hue. |
static boolean |
isGray(int color)
Checks if a 32-bit ARGB color is a gray color, from 0 (black) to 255 (white). |
static int |
rgb(int rgb)
Creates an opaque color. |
static int |
rgb(int rgb,
boolean hasAlpha)
Creates a color. |
static int |
rgb(int r,
int g,
int b)
Creates an opaque color. |
static int |
rgba(int rgb,
int alpha)
Creates a color with alpha. |
static int |
rgba(int r,
int g,
int b,
int alpha)
Creates a color with alpha. |
static int |
RGBtoHSB(int argbColor)
Converts a a packed, 32-bit RGB (red, green, blue) color to HSB (hue, saturation, brightness). |
static String |
RGBtoString(int color)
Returns a string representation of the specified color. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int TRANSPARENT
gray(0, 0).
public static final int BLACK
gray(0).
public static final int WHITE
gray(255).
public static final int LIGHTGRAY
gray(192).
public static final int GRAY
gray(128).
public static final int DARKGRAY
gray(64).
public static final int RED
rgb(255, 0 0).
public static final int ORANGE
rgb(255, 200, 0).
public static final int YELLOW
rgb(255, 255, 0).
public static final int GREEN
rgb(0, 255, 0).
public static final int CYAN
rgb(0, 255, 255).
public static final int BLUE
rgb(0, 0, 255).
public static final int PURPLE
rgb(162, 0, 255).
public static final int MAGENTA
rgb(255, 0, 255).
| Method Detail |
|---|
public static int gray(int gray)
gray - the gray value from 0 (black) to 255 (white).
public static int gray(int gray,
int alpha)
gray - the gray value from 0 (black) to 255 (white).alpha - the opacity from 0 (transparent) to 255 (opaque).
public static int rgb(int rgb)
rgb - a packed 32-bit ARGB color.
public static int rgb(int rgb,
boolean hasAlpha)
hasAlpha is true, this method returns rgb
without modification. Otherwise, this method sets the alpha to 255 (opaque).
rgb - a packed 32-bit ARGB color.hasAlpha - flag indicating the rgb param has alpha or not.
public static int rgba(int rgb,
int alpha)
rgb - a packed 32-bit ARGB color.alpha - the alpha component, from 0 (transparent) to 255 (opaque).
public static int rgb(int r,
int g,
int b)
r - the red component, from 0 to 255.g - the green component, from 0 to 255.b - the blue component, from 0 to 255.
public static int rgba(int r,
int g,
int b,
int alpha)
r - the red component, from 0 to 255.g - the green component, from 0 to 255.b - the blue component, from 0 to 255.alpha - the alpha component, from 0 (transparent) to 255 (opaque).
public static int hue(int h)
h - the hue, from 0 to 255.
public static int hue(int h,
int alpha)
h - the hue, from 0 to 255.alpha - the alpha component, from 0 (transparent) to 255 (opaque).
public static int hsb(int h,
int s,
int b)
h - the hue, from 0 to 255.s - the saturation, from 0 to 255.b - the brightness, from 0 to 255.
public static int hsba(int h,
int s,
int b,
int alpha)
h - the hue, from 0 to 255.s - the saturation, from 0 to 255.b - the brightness, from 0 to 255.alpha - the alpha component, from 0 (transparent) to 255 (opaque).
public static int getAlpha(int color)
color - a 32-bit ARGB color.
public static int getRed(int color)
color - a 32-bit ARGB color.
public static int getGreen(int color)
color - a 32-bit ARGB color.
public static int getBlue(int color)
color - a 32-bit ARGB color.
public static int getHue(int color)
color - a 32-bit ARGB color.
public static int getSaturation(int color)
color - a 32-bit ARGB color.
public static int getBrightness(int color)
color - a 32-bit ARGB color.
public static boolean isGray(int color)
color - a 32-bit ARGB color.
public static int brighter(int color)
color - a 32-bit ARGB color.
public static int darker(int color)
color - a 32-bit ARGB color.
public static String RGBtoString(int color)
color - a 32-bit ARGB color.
public static int RGBtoHSB(int argbColor)
int hsb = Colors.RGBtoHSB(rgb);
int h = (hsb >> 16) & 0xff;
int s = (hsb >> 8) & 0xff;
int b = hsb & 0xff;
argbColor - a 32-bit ARGB color.
HSBtoRGB(int)public static int HSBtoRGB(int ahsbColor)
int rgb = Colors.HSBtoRGB(hsb);
int r = (rgb >> 16) & 0xff;
int g = (rgb >> 8) & 0xff;
int b = rgb & 0xff;
ahsbColor - a 32-bit AHSB color.
RGBtoHSB(int)
|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||