public class ColorUtil
extends java.lang.Object
Constructor | Description |
---|---|
ColorUtil() |
Modifier and Type | Method | Description |
---|---|---|
static java.awt.Paint |
getCheckerPaint() |
Obtain a
java.awt.Paint instance which draws a checker
background of black and white. |
static java.awt.Paint |
getCheckerPaint(java.awt.Color c1,
java.awt.Color c2,
int size) |
|
static java.awt.Color |
interpolate(java.awt.Color b,
java.awt.Color a,
float t) |
|
static java.awt.Color |
removeAlpha(java.awt.Color color) |
Returns a new color equal to the old one, except that there is no
alpha channel (transparency).
|
static java.awt.Color |
setAlpha(java.awt.Color col,
int alpha) |
Modifies the passed in color by setting a new alpha channel (transparency)
and returns the new color.
|
static java.awt.Color |
setBrightness(java.awt.Color color,
float brightness) |
Modifies the passed in color by changing it's brightness using HSB
calculations.
|
static java.awt.Color |
setSaturation(java.awt.Color color,
float saturation) |
|
static void |
tileStretchPaint(java.awt.Graphics g,
javax.swing.JComponent comp,
java.awt.image.BufferedImage img,
java.awt.Insets ins) |
Draws an image on top of a component by doing a 3x3 grid stretch of the image
using the specified insets.
|
static java.lang.String |
toHexString(java.awt.Color color) |
Produces a String representing the passed in color as a hex value
(including the #) suitable for use in html.
|
public static java.awt.Color removeAlpha(java.awt.Color color)
color
- the color to remove the alpha (transparency) frompublic static java.awt.Color setAlpha(java.awt.Color col, int alpha)
col
- the color to modifyalpha
- the new alpha (transparency) level. Must be an int between 0 and 255public static java.awt.Color setBrightness(java.awt.Color color, float brightness)
color
- the color to modifybrightness
- the brightness to use in the new colorpublic static java.lang.String toHexString(java.awt.Color color)
color
- the color to convertpublic static java.awt.Paint getCheckerPaint()
java.awt.Paint
instance which draws a checker
background of black and white.
Note: The returned instance may be shared.
Note: This method should be reimplemented to not use a png resource.public static java.awt.Paint getCheckerPaint(java.awt.Color c1, java.awt.Color c2, int size)
public static void tileStretchPaint(java.awt.Graphics g, javax.swing.JComponent comp, java.awt.image.BufferedImage img, java.awt.Insets ins)
public static java.awt.Color setSaturation(java.awt.Color color, float saturation)
public static java.awt.Color interpolate(java.awt.Color b, java.awt.Color a, float t)