Package com.jtattoo.plaf
Class ColorHelper
java.lang.Object
com.jtattoo.plaf.ColorHelper
A helper class for handling color values.
Author Michael Hagen
-
Method Summary
Modifier and TypeMethodDescriptionstatic ColorCreates a color that is the brighter version of the color parameter c.static ColorcreateColor(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 ColorCreates a color that is the darker version of the color parameter c.static intReturns a value between 0 and 255 which represents the gray value of the color parameter.static intgetGrayValue(Color[] ca) Returns a value between 0 and 255 which represents the median gray value of the color array.static ColorReturns a color value which is the media between the colors c1 and c1static ColorReturns a gray version of the color parameter c, which means all parts (r,g,b) do have the same value.
-
Method Details
-
brighter
Creates a color that is the brighter version of the color parameter c.- Parameters:
c- the colorp- the factor of the brightness in percent from 0 to 100- Returns:
- a new color value that is a brighter version of the color parameter c
-
createColor
Creates a color object.- Parameters:
r- the Red componentg- the Green componentb- the Blue component- Returns:
- a color object
-
createColorArr
Creates an array of color values. The colors created will be a gradient from color c1 to color c1 with a count of steps values.- Parameters:
c1- the starting colorc2- the ending colorsteps- the number of steps between c1 and c2 (the size of the created array)- Returns:
- the array of color values
-
darker
Creates a color that is the darker version of the color parameter c.- Parameters:
c- the colorp- the factor to shade the color c in percent from 0 to 100- Returns:
- a new color value that is a darker version of the color parameter c
-
getGrayValue
Returns a value between 0 and 255 which represents the gray value of the color parameter.- Parameters:
c- the color you want to calculate the gray value- Returns:
- the gray value
-
getGrayValue
Returns a value between 0 and 255 which represents the median gray value of the color array.- Parameters:
ca- the color array you want to calculate the gray value- Returns:
- the gray value
-
median
Returns a color value which is the media between the colors c1 and c1- Parameters:
c1- the first colorc2- the second color- Returns:
- the median color value of the two colors c1 and c1
-
toGray
Returns a gray version of the color parameter c, which means all parts (r,g,b) do have the same value.- Parameters:
c- the color- Returns:
- a gray version of the color parameter c.
-