public class ColorHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static Color |
brighter(Color c,
double p)
Creates a color that is the brighter version of the color parameter c.
|
static Color |
createColor(int r,
int g,
int b)
Creates a color object.
|
static Color[] |
createColorArr(Color c1,
Color c2,
int steps)
Creates an array of color values.
|
static Color |
darker(Color c,
double p)
Creates a color that is the darker version of the color parameter c.
|
static int |
getGrayValue(Color c)
Returns a value between 0 and 255 which represents the gray value of the color parameter.
|
static int |
getGrayValue(Color[] ca)
Returns a value between 0 and 255 which represents the median gray value of the color array.
|
static Color |
median(Color c1,
Color c2)
Returns a color value which is the media between the colors c1 and c1
|
static Color |
toGray(Color c)
Returns a gray version of the color parameter c, which means all parts (r,g,b) do have the same value.
|
public static Color createColor(int r, int g, int b)
r - the Red componentg - the Green componentb - the Blue componentpublic static Color[] createColorArr(Color c1, Color c2, int steps)
c1 - the starting colorc2 - the ending colorsteps - the number of steps between c1 and c2 (the size of the created array)public static Color brighter(Color c, double p)
c - the colorp - the factor of the brightness in percent from 0 to 100public static Color darker(Color c, double p)
c - the colorp - the factor to shade the color c in percent from 0 to 100public static Color median(Color c1, Color c2)
c1 - the first colorc2 - the second colorpublic static int getGrayValue(Color c)
c - the color you want to calculate the gray valuepublic static int getGrayValue(Color[] ca)
ca - the color array you want to calculate the gray valueCopyright © 2014. All Rights Reserved.