public class GraphicsUtil extends java.lang.Object
Constructor and Description |
---|
GraphicsUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
drawCenteredString(java.awt.Graphics g,
java.lang.String text,
int x,
int y,
boolean shadow)
Draw a horizontal and vertical centered text on specified position.
|
static void |
drawHCenteredString(java.awt.Graphics g,
java.lang.String text,
int x,
int y,
boolean shadow)
Draw a horizontal centered text on specified position.
|
static void |
drawHint(java.awt.Graphics2D g,
java.lang.String text,
int x,
int y,
java.awt.Color bgColor,
java.awt.Color textColor)
Draw multi line Hint type text in the specified Graphics context
at the specified location. |
static void |
drawPathIterator(java.awt.geom.PathIterator path,
java.awt.Graphics2D g)
Draw the specified PathIterator in the specified Graphics2D context
|
static void |
drawString(java.awt.Graphics g,
java.lang.String text,
int x,
int y,
boolean shadow)
Draw a text in the specified Graphics context and at the specified position.
|
static float |
getAlpha(java.awt.Graphics2D g) |
static java.awt.Point |
getBestPosition(java.awt.Point origin,
java.awt.Dimension dim,
java.awt.Rectangle region)
Returns the best position to draw specified box in specified region with initial desired
position.
|
static java.awt.Point |
getBestPosition(java.awt.Point origin,
java.awt.Dimension dim,
java.awt.Rectangle region,
int xSpace,
int ySpace)
Returns the best position to draw specified box in specified region with initial desired
position.
|
static java.awt.Point |
getBestPosition(java.awt.Point origin,
java.awt.Dimension dim,
java.awt.Rectangle region,
int xSpace,
int ySpace,
boolean top,
boolean left)
Returns the best position to draw specified box in specified region with initial desired
position.
|
static java.awt.Rectangle |
getBounds(java.awt.Point origin,
java.awt.Dimension dim,
boolean top,
boolean left)
Returns the bounds to draw specified box dimension at specified position.
|
static java.awt.Rectangle |
getBounds(java.awt.Point origin,
java.awt.Dimension dim,
int xSpace,
int ySpace,
boolean top,
boolean left)
Returns the bounds to draw specified box dimension at specified position.
|
static java.awt.Rectangle |
getHintBounds(java.awt.Graphics2D g,
java.lang.String text,
int x,
int y)
Returns the bounds to draw a Hint type text in the specified Graphics context
at the specified location. |
static java.awt.Dimension |
getHintSize(java.awt.Graphics2D g,
java.lang.String text)
Returns the size to draw a Hint type text in the specified Graphics context.
|
static java.awt.geom.Rectangle2D |
getStringBounds(java.awt.Component c,
java.lang.String text)
Return bounds to draw specified string in the specified component.
|
static java.awt.geom.Rectangle2D |
getStringBounds(java.awt.Graphics g,
java.awt.Font f,
java.lang.String text)
Returns bounds to draw specified string in the specified Graphics context
with specified font.
|
static java.awt.geom.Rectangle2D |
getStringBounds(java.awt.Graphics g,
java.lang.String text)
Return bounds to draw specified string in the specified Graphics context
with current font.
|
static boolean |
isVisible(java.awt.Graphics g,
java.awt.Rectangle region)
Returns true if the specified region is visible in the specified
Graphics object. |
static boolean |
isVisible(java.awt.Graphics g,
java.awt.geom.Rectangle2D region)
Returns true if the specified region is visible in the specified
Graphics object. |
static java.lang.String |
limitStringFor(java.awt.Component c,
java.lang.String text,
int width)
Limit the single line string so it fits in the specified component width.
|
static void |
mixAlpha(java.awt.Graphics2D g,
float factor) |
static float |
mixAlpha(java.awt.Graphics2D g,
int rule,
float factor) |
static void |
paintIcyBackGround(java.awt.Component component,
java.awt.Graphics g)
Draw ICY style background on the specified Graphics object with specified component
dimension.
|
static void |
paintIcyBackGround(java.awt.Image image)
Draw ICY style background in the specified Image
|
static void |
paintIcyBackGround(int width,
int height,
java.awt.Graphics g)
Draw ICY style background on the specified Graphics object with specified dimension.
|
public GraphicsUtil()
public static float getAlpha(java.awt.Graphics2D g)
public static void mixAlpha(java.awt.Graphics2D g, float factor)
public static float mixAlpha(java.awt.Graphics2D g, int rule, float factor)
public static void paintIcyBackGround(int width, int height, java.awt.Graphics g)
public static void paintIcyBackGround(java.awt.Component component, java.awt.Graphics g)
public static void paintIcyBackGround(java.awt.Image image)
public static boolean isVisible(java.awt.Graphics g, java.awt.Rectangle region)
Graphics
object.Graphics
clip area to determine if region is visible.public static boolean isVisible(java.awt.Graphics g, java.awt.geom.Rectangle2D region)
Graphics
object.Graphics
clip area to determine if region is visible.public static java.awt.geom.Rectangle2D getStringBounds(java.awt.Graphics g, java.awt.Font f, java.lang.String text)
public static java.lang.String limitStringFor(java.awt.Component c, java.lang.String text, int width)
public static java.awt.geom.Rectangle2D getStringBounds(java.awt.Component c, java.lang.String text)
public static java.awt.geom.Rectangle2D getStringBounds(java.awt.Graphics g, java.lang.String text)
public static void drawString(java.awt.Graphics g, java.lang.String text, int x, int y, boolean shadow)
public static void drawHCenteredString(java.awt.Graphics g, java.lang.String text, int x, int y, boolean shadow)
public static void drawCenteredString(java.awt.Graphics g, java.lang.String text, int x, int y, boolean shadow)
public static java.awt.Dimension getHintSize(java.awt.Graphics2D g, java.lang.String text)
public static java.awt.Rectangle getHintBounds(java.awt.Graphics2D g, java.lang.String text, int x, int y)
public static void drawHint(java.awt.Graphics2D g, java.lang.String text, int x, int y, java.awt.Color bgColor, java.awt.Color textColor)
public static java.awt.Rectangle getBounds(java.awt.Point origin, java.awt.Dimension dim, int xSpace, int ySpace, boolean top, boolean left)
origin
- the initial desired position we want to draw the box.dim
- box dimensionxSpace
- horizontal space between the position and boxySpace
- vertical space between the position and boxtop
- box is at top of positionleft
- box is at left of positionpublic static java.awt.Rectangle getBounds(java.awt.Point origin, java.awt.Dimension dim, boolean top, boolean left)
origin
- the initial desired position we want to draw the box.dim
- box dimensiontop
- box is at top of positionleft
- box is at left of positionpublic static java.awt.Point getBestPosition(java.awt.Point origin, java.awt.Dimension dim, java.awt.Rectangle region, int xSpace, int ySpace, boolean top, boolean left)
origin
- the initial desired position we want to draw the box.dim
- box dimensionregion
- the rectangle defining the region where we want to drawxSpace
- horizontal space between the position and boxySpace
- vertical space between the position and boxtop
- by default box is at top of positionleft
- by default box is at left of positionpublic static java.awt.Point getBestPosition(java.awt.Point origin, java.awt.Dimension dim, java.awt.Rectangle region, int xSpace, int ySpace)
origin
- the initial desired position we want to draw the box.dim
- box dimensionregion
- the rectangle defining the region where we want to drawxSpace
- horizontal space between the position and boxySpace
- vertical space between the position and boxpublic static java.awt.Point getBestPosition(java.awt.Point origin, java.awt.Dimension dim, java.awt.Rectangle region)
origin
- the initial desired position we want to draw the box.dim
- box dimensionregion
- the rectangle defining the region where we want to drawpublic static void drawPathIterator(java.awt.geom.PathIterator path, java.awt.Graphics2D g)