|
Java DTV API 1.3 18-Nov-2009 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.dtv.lwuit.Graphics
public final class Graphics
Abstracts the underlying platform graphics context thus allowing us to achieve
portability between MIDP devices and CDC devices. This abstraction simplifies
and unifies the Graphics implementations of various platforms.
For usage of LWUIT within the DTV specification, a Graphics
object always wraps an instance of java.awt.Graphics2D. The access
to the wrapped object is encouraged only if this is really necessary in order to
handle a specific LWUIT vs. AWT integration issue. It should not be used for
ordinary tasks.
| Constructor Summary | |
|---|---|
Graphics(Graphics2D g)
Create a LWUIT Graphics object using a Graphics instance of the underlying Graphics library to be wrapped. |
|
| Method Summary | |
|---|---|
void |
clearRect(int x,
int y,
int width,
int height)
Clears the specified rectangle by filling it with the background color of the current drawing surface. |
void |
clipRect(int x,
int y,
int width,
int height)
Clips the given rectangle by intersecting with the current clipping region, this method can thus only shrink the clipping region and never increase it. |
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Copies an area of the component by a distance specified by the dx and dy parameters. |
void |
darkerColor(int factor)
Makes the current color slightly darker, this is useful for many visual effects. |
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draws a 3D highlighted outline of the specified rectangle. |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws a circular or elliptical arc based on the given angles and bounding box. |
void |
drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
Draws the text given by the specified byte array, using this graphics context's current font and color. |
void |
drawChar(char character,
int x,
int y)
Draw the given char using the current font and color in the x,y coordinates. |
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
Draw the given char array using the current font and color in the x,y coordinates. |
void |
drawImage(Image img,
int x,
int y)
Draws the image so its top left coordinate corresponds to x/y. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line between the 2 X/Y coordinates. |
void |
drawOval(int x,
int y,
int width,
int height)
Draws the outline of an oval into the bounds of the given rectangle. |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a closed polygon defined by arrays of x and y coordinates. |
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a sequence of connected lines defined by arrays of x and y coordinates. |
void |
drawRect(int x,
int y,
int width,
int height)
Draws a rectangle in the given coordinates. |
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rounded corner rectangle in the given coordinates with the arcWidth/height matching the last two arguments respectively. |
void |
drawString(String str,
int x,
int y)
Draw a string using the current font and color in the x,y coordinates. |
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Fills a 3D highlighted rectangle filled with the current color. |
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised,
byte alpha)
Fills a 3D highlighted rectangle filled with an optionally translucent fill color. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Fills a circular or elliptical arc based on the given angles and bounding box. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle,
byte alpha)
Fills a circular or elliptical arc based on the given angles and bounding box with an optionally translucent fill color. |
void |
fillLinearGradient(Color startColor,
Color endColor,
int x,
int y,
int width,
int height,
boolean horizontal)
Draws a linear gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient. |
void |
fillOval(int x,
int y,
int width,
int height)
Fills an oval bounded by the specified rectangle with the current color. |
void |
fillOval(int x,
int y,
int width,
int height,
byte alpha)
Fills an oval bounded by the specified rectangle with an optionally translucent fill color. |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Fills a closed polygon defined by the specified arrays of x and y coordinates with the graphics context's current color. |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints,
byte alpha)
Fills a closed polygon defined by the specified arrays of x and y coordinates with an optionally translucent fill color. |
void |
fillRadialGradient(Color startColor,
Color endColor,
int x,
int y,
int width,
int height)
Draws a radial gradient in the given coordinates with the given colors, doesn't take alpha into consideration when drawing the gradient. |
void |
fillRect(int x,
int y,
int width,
int height)
Fills the rectangle from the given position according to the width/height minus 1 pixel according to the convention in Java. |
void |
fillRect(int x,
int y,
int w,
int h,
byte alpha)
Fills a rectangle with an optionally translucent fill color. |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Fills a rounded rectangle in the same way as drawRoundRect. |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight,
byte alpha)
Fills a rounded rectangle in the same way as drawRoundRect with an optionally translucent fill color. |
void |
fillTriangle(int x1,
int y1,
int x2,
int y2,
int x3,
int y3)
Draws a filled triangle with the given coordinates. |
void |
fillTriangle(int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
byte alpha)
Draws a filled triangle with the given coordinates with an optionally translucent fill color. |
Graphics2D |
getAWTGraphics()
Obtains the java.awt.Graphics2D object wrapped by this
Graphics instance. |
Rectangle |
getClipBounds()
Returns the bounding rectangle of the current clipping area. |
Rectangle |
getClipBounds(Rectangle r)
Returns the bounding rectangle of the current clipping area. |
int |
getClipHeight()
Returns the clip height. |
int |
getClipWidth()
Returns the clip width. |
int |
getClipX()
Returns the x clipping position. |
int |
getClipY()
Returns the y clipping position. |
Color |
getColor()
Returns the current color. |
Font |
getFont()
Returns the font used with the drawString method calls. |
int |
getTranslateX()
Returns the current x translate value. |
int |
getTranslateY()
Returns the current y translate value. |
boolean |
hitClip(int x,
int y,
int width,
int height)
Returns true if the specified rectangular area might intersect the current clipping area. |
void |
lighterColor(int factor)
Makes the current color slightly lighter, this is useful for many visual effects. |
void |
setClip(int x,
int y,
int width,
int height)
Updates the clipping region to match the given region exactly. |
void |
setColor(Color color)
Sets the current rgb color while ignoring any potential alpha component within said color value. |
void |
setFont(Font font)
Sets the font to use with the drawString method calls. |
void |
translate(int x,
int y)
Translates the X/Y location for drawing on the underlying surface. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Graphics(Graphics2D g)
g - a Graphics instance of the underlying Graphics library| Method Detail |
|---|
public void translate(int x,
int y)
translate(-getTranslateX(), -getTranslateY())
x - the x coordinatey - the y coordinatepublic int getTranslateX()
public int getTranslateY()
public Color getColor()
setColor(java.awt.Color)public void setColor(Color color)
color - the color to be set.getColor()public Font getFont()
setFont(Font)public void setFont(Font font)
font - the font to be setgetFont()public int getClipX()
public int getClipY()
public int getClipWidth()
public int getClipHeight()
public void clipRect(int x,
int y,
int width,
int height)
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
public void setClip(int x,
int y,
int width,
int height)
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
public void drawLine(int x1,
int y1,
int x2,
int y2)
x1 - first x positiony1 - first y positionx2 - second x positiony2 - second y position
public void fillRect(int x,
int y,
int width,
int height)
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
public void fillRadialGradient(Color startColor,
Color endColor,
int x,
int y,
int width,
int height)
startColor - the starting RGB colorendColor - the ending RGB colorx - the x coordinatey - the y coordinatewidth - the width of the region to be filledheight - the height of the region to be filled
public void fillLinearGradient(Color startColor,
Color endColor,
int x,
int y,
int width,
int height,
boolean horizontal)
startColor - the starting RGB colorendColor - the ending RGB colorx - the x coordinatey - the y coordinatewidth - the width of the region to be filledheight - the height of the region to be filledhorizontal - indicating whether it is a horizontal fill or vertical
public void drawRect(int x,
int y,
int width,
int height)
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
public void drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectanglearcWidth - the arc width of the given rectanglearcHeight - the arc height of the given rectangle
public void fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectanglearcWidth - the arc width of the given rectanglearcHeight - the arc height of the given rectangledrawRoundRect(int, int, int, int, int, int)
public void fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight,
byte alpha)
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectanglearcWidth - the arc width of the given rectanglearcHeight - the arc height of the given rectanglealpha - alpha composite valuedrawRoundRect(int, int, int, int, int, int)
public void fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
x - the x coordinate of the given arcy - the y coordinate of the given arcwidth - the width of the given archeight - the height of the given arcstartAngle - the start angle of the given arcarcAngle - the end angle of the given arc
public void fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle,
byte alpha)
x - the x coordinate of the given arcy - the y coordinate of the given arcwidth - the width of the given archeight - the height of the given arcstartAngle - the start angle of the given arcarcAngle - the end angle of the given arcalpha - alpha composite value
public void drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
x - the x coordinate of the given arcy - the y coordinate of the given arcwidth - the width of the given archeight - the height of the given arcstartAngle - the start angle of the given arcarcAngle - the end angle of the given arc
public void drawString(String str,
int x,
int y)
str - the stringx - the x coordinate of the stringy - the y coordinate of the string
public void drawChar(char character,
int x,
int y)
character - a charx - x coordinatey - y coordinate
public void drawChars(char[] data,
int offset,
int length,
int x,
int y)
data - the given char arrayoffset - offset of the arraylength - length of the arrayx - x coordinate of the positiony - y coordinate of the position
public void drawImage(Image img,
int x,
int y)
img - an Image objectx - x coordinatey - y coordinate
public void fillTriangle(int x1,
int y1,
int x2,
int y2,
int x3,
int y3)
x1 - x coordinate of point 1y1 - y coordinate of point 1x2 - x coordinate of point 2y2 - y coordinate of point 2x3 - x coordinate of point 3y3 - y coordinate of point 3
public void fillTriangle(int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
byte alpha)
x1 - x coordinate of point 1y1 - y coordinate of point 1x2 - x coordinate of point 2y2 - y coordinate of point 2x3 - x coordinate of point 3y3 - y coordinate of point 3alpha - alpha composite value
public void fillRect(int x,
int y,
int w,
int h,
byte alpha)
x - x coordinate of upper left cornery - y coordinate of upper left cornerw - the widthh - the heightalpha - alpha composite valuepublic void lighterColor(int factor)
factor - the degree of lightening a color per channel a number from 1 to 255public void darkerColor(int factor)
factor - the degree of lightening a color per channel a number from 1 to 255public Graphics2D getAWTGraphics()
java.awt.Graphics2D object wrapped by this
Graphics instance.
java.awt.Graphics2D object
public void clearRect(int x,
int y,
int width,
int height)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
public void copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
dx and dy parameters.
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given areay - the y coordinate of the given areawidth - the width of the given areaheight - the height of the given areadx - x coordinate of the distancedy - y coordinate of the distance
public void draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangleraised - true if the rectangle appears to be raised above the surface,
or false if it appears to be sunk into the surface
public void drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
data - the specified byte arrayoffset - the array's offsetlength - the array's lengthx - the x coordinate of the positiony - the y coordinate of the position
public void drawOval(int x,
int y,
int width,
int height)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
public void drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
xPoints - array of x coordinatesyPoints - array of y coordinatesnPoints - number of given points
public void drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
xPoints - array of x coordinatesyPoints - array of y coordinatesnPoints - number of given points
public void fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangleraised - true if the rectangle appears to be raised above the surface,
or false if it appears to be sunk into the surface
public void fill3DRect(int x,
int y,
int width,
int height,
boolean raised,
byte alpha)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangleraised - true if the rectangle appears to be raised above the surface,
or false if it appears to be sunk into the surfacealpha - alpha composite value
public void fillOval(int x,
int y,
int width,
int height)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
public void fillOval(int x,
int y,
int width,
int height,
byte alpha)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectanglealpha - alpha composite value
public void fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
xPoints - array of x coordinatesyPoints - array of y coordinatesnPoints - number of given points
public void fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints,
byte alpha)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
xPoints - array of x coordinatesyPoints - array of y coordinatesnPoints - number of given pointsalpha - alpha composite valuepublic Rectangle getClipBounds()
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
public Rectangle getClipBounds(Rectangle r)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
r - the given existing rectangle
public boolean hitClip(int x,
int y,
int width,
int height)
IMPLEMENTATION NOTE: Delegate to the wrapped AWT Graphics2D object.
x - the x coordinate of the given rectangley - the y coordinate of the given rectanglewidth - the width of the given rectangleheight - the height of the given rectangle
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||