|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.wtk.GraphicsUtilities
public final class GraphicsUtilities
Contains utility methods dealing with the Java2D API.
Nested Class Summary | |
---|---|
static class |
GraphicsUtilities.PaintType
Enumeration representing a paint type. |
Field Summary | |
---|---|
static String |
CENTER_X_KEY
|
static String |
CENTER_Y_KEY
|
static String |
COLOR_KEY
|
static String |
END_COLOR_KEY
|
static String |
END_X_KEY
|
static String |
END_Y_KEY
|
static String |
OFFSET_KEY
|
static String |
PAINT_TYPE_KEY
|
static String |
RADIUS_KEY
|
static String |
START_COLOR_KEY
|
static String |
START_X_KEY
|
static String |
START_Y_KEY
|
static String |
STOPS_KEY
|
Method Summary | |
---|---|
static Color |
decodeColor(String value)
Interprets a string as a color value. |
static Paint |
decodePaint(Dictionary<String,?> dictionary)
Interpret a dictionary as a Paint value |
static Paint |
decodePaint(String value)
Interpret a string as a Paint value |
static void |
drawLine(Graphics2D graphics,
int x,
int y,
int length,
Orientation orientation)
|
static void |
drawLine(Graphics2D graphics,
int x,
int y,
int length,
Orientation orientation,
int thickness)
|
static void |
drawRect(Graphics2D graphics,
int x,
int y,
int width,
int height)
Draws a rectangle with a thickness of 1 pixel at the specified coordinates whose outer border is the specified width and height. |
static void |
drawRect(Graphics2D graphics,
int x,
int y,
int width,
int height,
int thickness)
Draws a rectangle with the specified thickness at the specified coordinates whose outer border is the specified width and height. |
static Color |
getColor(int rgb,
float alpha)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PAINT_TYPE_KEY
public static final String COLOR_KEY
public static final String START_X_KEY
public static final String START_Y_KEY
public static final String END_X_KEY
public static final String END_Y_KEY
public static final String START_COLOR_KEY
public static final String END_COLOR_KEY
public static final String CENTER_X_KEY
public static final String CENTER_Y_KEY
public static final String RADIUS_KEY
public static final String STOPS_KEY
public static final String OFFSET_KEY
Method Detail |
---|
public static final void drawLine(Graphics2D graphics, int x, int y, int length, Orientation orientation)
public static final void drawLine(Graphics2D graphics, int x, int y, int length, Orientation orientation, int thickness)
public static final void drawRect(Graphics2D graphics, int x, int y, int width, int height)
This method provides more reliable pixel rounding behavior than java.awt.Graphics#drawRect when scaling is applied because this method does not stroke the shape but instead explicitly fills the desired pixels with the graphics context's paint. For this reason, and because Pivot supports scaling the display host, it is recommended that skins use this method over java.awt.Graphics#drawRect.
graphics
- The graphics context that will be used to perform the operation.x
- The x-coordinate of the upper-left corner of the rectangle.y
- The y-coordinate of the upper-left corner of the rectangle.width
- The outer width of the rectangle.height
- The outer height of the rectangle.public static final void drawRect(Graphics2D graphics, int x, int y, int width, int height, int thickness)
This method provides more reliable pixel rounding behavior than java.awt.Graphics#drawRect when scaling is applied because this method does not stroke the shape but instead explicitly fills the desired pixels with the graphics context's paint. For this reason, and because Pivot supports scaling the display host, it is recommended that skins use this method over java.awt.Graphics#drawRect.
graphics
- The graphics context that will be used to perform the operation.x
- The x-coordinate of the upper-left corner of the rectangle.y
- The y-coordinate of the upper-left corner of the rectangle.width
- The outer width of the rectangle.height
- The outer height of the rectangle.thickness
- The thickness of each edge.public static Color decodeColor(String value) throws NumberFormatException
value
- One of the following forms:
Color
class.
Color
on successful decoding
NumberFormatException
- if the value in the first two cases contains
illegal hexadecimal digits.
IllegalArgumentException
- if the value is not in one of the formats listed above.public static Color getColor(int rgb, float alpha)
public static Paint decodePaint(String value)
Paint
value
value
- Either
(a) One of the color values recognized by Pivot
or (b) A JSON dictionary describing a Paint value.public static Paint decodePaint(Dictionary<String,?> dictionary)
Paint
value
dictionary
- A dictionary containing a key "paintType" and further elements
according to its value:
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |