public final class GraphicalUtility extends Object
Modifier and Type | Method | Description |
---|---|---|
static Font |
getAwtFont(String aText,
int aWidth,
String aFontName,
int aFontStyle) |
Tries to determine the font size for the given font name and font style
for the given text to fit into the given width (pixels).
|
static int |
toAlpha(int aRgbValue) |
Retrieves the alpha portion of the provided RGB value.
|
static int |
toBlue(int aRgbValue) |
Retrieves the blue portion of the provided RGB value.
|
static int |
toGray(int aRgbValue) |
Converts the given RGB value to a gray scale value by averaging the red,
green and blue portions of the RGB value.
|
static int |
toGreen(int aRgbValue) |
Retrieves the green portion of the provided RGB value.
|
static int |
toRed(int aRgbValue) |
Retrieves the red portion of the provided RGB value.
|
static int |
toRgb(int aAlpha,
int aRed,
int aGreen,
int aBlue) |
Combines the alpha, red, green and blue values to an RGB value.
|
public static int toGray(int aRgbValue)
aRgbValue
- The RGB value to be converted to a grays scale value.public static int toRgb(int aAlpha, int aRed, int aGreen, int aBlue)
aAlpha
- The alpha value to use.aRed
- The red value to use.aGreen
- The green value to use.aBlue
- The blue value to use.public static int toAlpha(int aRgbValue)
aRgbValue
- The RGB value from which to retrieve the alpha portion.public static int toRed(int aRgbValue)
aRgbValue
- The RGB value from which to retrieve the red portion.public static int toGreen(int aRgbValue)
aRgbValue
- The RGB value from which to retrieve the green portion.public static int toBlue(int aRgbValue)
aRgbValue
- The RGB value from which to retrieve the blue portion.public static Font getAwtFont(String aText, int aWidth, String aFontName, int aFontStyle)
aText
- The text to fit into the given (pixel) width.aWidth
- The (pixel) width into which the given text is to fit.aFontName
- The font name to use for determining the correct font
size.aFontStyle
- The font style to be usedCopyright © 2021. All rights reserved.