public abstract class GraphicsUtils extends Object
Modifier | Constructor and Description |
---|---|
protected |
GraphicsUtils()
Default constructor that prevents creation of class.
|
Modifier and Type | Method and Description |
---|---|
static Color |
blend(Color color1,
Color color2,
double weight)
Linearly blends two colors with a defined weight.
|
static Color |
deriveBrighter(Color color)
Creates a new brighter version of a color by blending it with white.
|
static Color |
deriveDarker(Color color)
Creates a new darker version of a color by blending it with black.
|
static Color |
deriveWithAlpha(Color color,
int alpha)
Creates a new color with the same color components but a different
alpha value.
|
static void |
drawPaintedShape(Graphics2D graphics,
Shape shape,
Paint paint,
Rectangle2D paintBounds,
Stroke stroke)
Draws a filled Shape with the specified Paint object.
|
static void |
fillPaintedShape(Graphics2D graphics,
Shape shape,
Paint paint,
Rectangle2D paintBounds)
Fills a Shape with the specified Paint object.
|
static Shape |
getOutline(String text,
Font font,
float wrappingWidth,
double alignment)
Returns the outline for the specified text using the specified font and
line width.
|
static double[] |
luv2rgb(double[] luv,
double[] rgb)
Converts color components from the CIE L*u*v* to the sRGB color space.
|
static double[] |
luv2xyz(double[] luv,
double[] xyz)
Convert color components from the CIE L*u*v* to the CIE XYZ color space.
|
static double[] |
rgb2luv(double[] rgb,
double[] luv)
Converts color components from the CIE L*u*v* to the sRGB color space.
|
static double[] |
rgb2xyz(double[] rgb,
double[] xyz)
Converts color components from the sRGB to the CIE XYZ color space.
|
static double[] |
xyz2luv(double[] xyz,
double[] luv)
Converts color components from the CIE XYZ to the CIE L*u*v* color
space.
|
static double[] |
xyz2rgb(double[] xyz,
double[] rgb)
Converts color components from the sRGB to the CIE XYZ color space.
|
protected GraphicsUtils()
public static Shape getOutline(String text, Font font, float wrappingWidth, double alignment)
text
- Text to be displayed.font
- Font of the Text.wrappingWidth
- Maximum width of linesalignment
- Alignment of the text when it spans multiple lines.public static void fillPaintedShape(Graphics2D graphics, Shape shape, Paint paint, Rectangle2D paintBounds)
graphics
- Graphics to be painted into.shape
- Shape to be filled.paint
- Paint to be used.paintBounds
- Optional bounds describing the painted area.public static void drawPaintedShape(Graphics2D graphics, Shape shape, Paint paint, Rectangle2D paintBounds, Stroke stroke)
graphics
- Graphics to be painted into.shape
- Shape to be filled.paint
- Paint to be used.paintBounds
- Optional bounds describing the painted area.stroke
- Stroke to be used for outlines.public static double[] rgb2xyz(double[] rgb, double[] xyz)
null
, a new one will be created with the same
size as the rgb array.
See http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.htmlrgb
- Color components in the sRGB color space.xyz
- Optional array to store color components in the CIE XYZ color space.public static double[] luv2xyz(double[] luv, double[] xyz)
null
, a new one will be created
with the same size as the luv array.
See http://www.brucelindbloom.com/index.html?Eqn_Luv_to_XYZ.htmlluv
- Color components in the CIE L*u*v* color spacexyz
- Optional array to store color components in the CIE XYZ color
space.public static double[] xyz2rgb(double[] xyz, double[] rgb)
null
, a new one will be created with the same
size as the xyz array.
See http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_RGB.htmlxyz
- Color components in the CIE XYZ color space.rgb
- Optional array for storing color components in the sRGB color
space.public static double[] xyz2luv(double[] xyz, double[] luv)
null
, a new one will be
created with the same size as the xyz array.
http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Luv.htmlxyz
- Color components in the CIE XYZ color space.luv
- Optional array for storing color components in the CIE L*u*v*
color space.public static double[] rgb2luv(double[] rgb, double[] luv)
null
, a new one will be created with the same
size as the rgb array.rgb
- Color components in the sRGB color space.luv
- Optional array for storing color components in the CIE L*u*v*
color space.public static double[] luv2rgb(double[] luv, double[] rgb)
null
, a new one will be created with the same size
as the luv array.luv
- Color components in the CIE L*u*v* color space.rgb
- Optional array for storing color components in the sRGB color
space.public static Color blend(Color color1, Color color2, double weight)
color1
- First color.color2
- Second color.weight
- Weighting factor in the range 0 to 1 (0 means color1, 1 means second color)public static Color deriveWithAlpha(Color color, int alpha)
color
- Original color.alpha
- Alpha value for new color.public static Color deriveDarker(Color color)
color
- Original color.Copyright © 2009-2013. All Rights Reserved.