|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.lcdui.Graphics
public class Graphics
lcdui.graphics implementation for the NXT LCD screen and in memory images. This class provides a sun-set of the standard JavaME graphics class. In particular it does not implement clipping. There are also several additional non-standard methods to allow easier use of images, alow access to inverse text, and allow the use of raster operations. Some of the standard limitations (like not allowing copyArea of the screen), are not enforced.
Field Summary | |
---|---|
static int |
BASELINE
Position the anchor point at the baseline of text. |
static int |
BLACK
|
static int |
BOTTOM
Position the anchor point of text and images below the text or image. |
static int |
DOTTED
Constant for the DOTTED stroke style. |
static int |
HCENTER
Centering text and images horizontally around the anchor point |
static int |
LEFT
Position the anchor point of text and images to the left of the text or image. |
static int |
RIGHT
Position the anchor point of text and images to the right of the text or image. |
static int |
SOLID
Constant for the SOLID stroke style. |
static int |
TOP
Position the anchor point of text and images above the text or image. |
static int |
VCENTER
Centering images vertically around the anchor point. |
static int |
WHITE
|
Constructor Summary | |
---|---|
Graphics()
Default constructor returns a context that can be used to access the NXT LCD display. |
Method Summary | |
---|---|
void |
clear()
Clear the graphics surface to white. |
void |
copyArea(int sx,
int sy,
int w,
int h,
int x,
int y,
int anchor)
Copy one rectangular area of the drawing surface to another. |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draw an arc, using the current color and style. |
void |
drawChar(char character,
int x,
int y,
int anchor)
Draw a single character to the graphics surface using the current color. |
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y,
int anchor)
Draw a series of characters to the graphics surface using the current color. |
void |
drawImage(Image src,
int x,
int y,
int anchor)
Draw the specified image to the graphics surface, using the supplied rop. |
void |
drawLine(int x0,
int y0,
int x1,
int y1)
Draw a line between the specified points, using the current color and style. |
void |
drawRect(int x,
int y,
int width,
int height)
Draw a rectangle using the current color and style. |
void |
drawRegion(Image src,
int sx,
int sy,
int w,
int h,
int transform,
int x,
int y,
int anchor)
Draw the specified region of the supplied image to the graphics surface. |
void |
drawRegionRop(Image src,
int sx,
int sy,
int w,
int h,
int x,
int y,
int anchor,
int rop)
Draw the specified image to the graphics surface, using the supplied rop. |
void |
drawRegionRop(Image src,
int sx,
int sy,
int w,
int h,
int transform,
int x,
int y,
int anchor,
int rop)
Draw the specified region of the source image to the graphics surface after applying the requested transformation, use the supplied rop. |
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draw a rounded rectangle. |
void |
drawString(String str,
int x,
int y,
int anchor)
Draws the specified String using the current font and color. |
void |
drawString(String str,
int x,
int y,
int anchor,
boolean inverted)
Draws the specified String using the current font and color. |
void |
drawSubstring(String str,
int offset,
int len,
int x,
int y,
int anchor)
Draw a substring to the graphics surface using the current color. |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draw a filled arc, using the current color. |
void |
fillRect(int x,
int y,
int w,
int h)
Draw a filled rectangle using the current color. |
int |
getBlueComponent()
Gets the blue value of color. |
int |
getColor()
Return the current rgb color. |
int |
getDisplayColor(int color)
Returns the actual color that will be used on the display if the specified color is requested. |
Font |
getFont()
Return the currently selected font object. |
int |
getGreenComponent()
Gets the green value of color. |
int |
getHeight()
Return the height of the associated drawing surface. |
int |
getRedComponent()
Gets the red value of color. |
int |
getStrokeStyle()
Return the current stroke style. |
int |
getTranslateX()
Gets the X coordinate of the translated origin of this graphics context. |
int |
getTranslateY()
Gets the Y coordinate of the translated origin of this graphics context. |
int |
getWidth()
Return the width of the associated drawing surface. |
void |
setColor(int rgb)
Set the current drawing color. |
void |
setColor(int red,
int green,
int blue)
Sets the current color to the specified RGB values. |
void |
setFont(Font f)
|
void |
setStrokeStyle(int style)
Set the stroke style to be used for drawing operations. |
void |
translate(int x,
int y)
Translates the origin of the graphics context to the point (x, y) in the current coordinate system. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HCENTER
Value 1
is assigned to HCENTER
.
public static final int VCENTER
Value 2
is assigned to VCENTER
.
public static final int LEFT
Value 4
is assigned to LEFT
.
public static final int RIGHT
Value 8
is assigned to RIGHT
.
public static final int TOP
Value 16
is assigned to TOP
.
public static final int BOTTOM
Value 32
is assigned to BOTTOM
.
public static final int BASELINE
Value 64
is assigned to BASELINE
.
public static final int SOLID
SOLID
stroke style.
Value 0
is assigned to SOLID
.
public static final int DOTTED
DOTTED
stroke style.
Value 1
is assigned to DOTTED
.
public static final int BLACK
public static final int WHITE
Constructor Detail |
---|
public Graphics()
Method Detail |
---|
public int getWidth()
public int getHeight()
public void drawString(String str, int x, int y, int anchor, boolean inverted)
str
- the String to be drawnx
- the x coordinate of the anchor pointy
- the y coordinate of the anchor pointanchor
- the anchor point for positioning the textinverted
- true to invert the text display.public void drawRegionRop(Image src, int sx, int sy, int w, int h, int x, int y, int anchor, int rop)
src
- image to draw (may be null for ops that do not require input.sx
- x offset in the sourcesy
- y offset in the sourcew
- width of area to drawh
- height of area to draw.x
- destinationy
- destinationanchor
- location of the anchor pointrop
- drawing operation.Image
public void drawRegionRop(Image src, int sx, int sy, int w, int h, int transform, int x, int y, int anchor, int rop)
src
- The source imagesx
- x coordinate of the regionsy
- y coordinate of the regionw
- width of the regionh
- height of the regiontransform
- the required transformx
- x coordinate of the anchor pointy
- y coordinate of the anchor pointanchor
- type of anchorrop
- raster operation used to draw the output.public void clear()
public Font getFont()
public void setFont(Font f)
public int getDisplayColor(int color)
color
-
public void setColor(int rgb)
rgb
- new color.public void setColor(int red, int green, int blue)
red
- the red componentgreen
- the green componentblue
- the blue
IllegalArgumentException
- if any of the color components
are outside of range 0-255
getColor()
public int getColor()
public int getRedComponent()
0-255
setColor(int, int, int)
public int getGreenComponent()
0-255
setColor(int, int, int)
public int getBlueComponent()
0-255
setColor(int, int, int)
public void drawString(String str, int x, int y, int anchor)
str
- the String to be drawnx
- the x coordinate of the anchor pointy
- the y coordinate of the anchor pointanchor
- the anchor point for positioning the textpublic void drawSubstring(String str, int offset, int len, int x, int y, int anchor)
str
- the base stringoffset
- the start of the sub stringlen
- the length of the sub stringx
- the x coordinate of the anchor pointy
- the x coordinate of the anchor pointanchor
- the anchor point used to position the text.public void drawChar(char character, int x, int y, int anchor)
character
- the character to drawx
- the x coordinate of the anchor pointy
- the x coordinate of the anchor pointanchor
- the anchor point used to position the text.public void drawChars(char[] data, int offset, int length, int x, int y, int anchor)
data
- the charactersoffset
- the start of the characters to be drawnlength
- the length of the character string to drawx
- the x coordinate of the anchor pointy
- the x coordinate of the anchor pointanchor
- the anchor point used to position the text.public void drawRegion(Image src, int sx, int sy, int w, int h, int transform, int x, int y, int anchor)
src
- image to draw (may be null for ops that do not require input.sx
- x offset to the regionsy
- y offset to the regionw
- width of the regionh
- height of the regiontransform
- x
- destinationy
- destinationanchor
- location of the anchor pointImage
public void drawImage(Image src, int x, int y, int anchor)
src
- image to draw (may be null for ops that do not require input.x
- destinationy
- destinationanchor
- location of the anchor pointImage
public void drawLine(int x0, int y0, int x1, int y1)
x0
- x start pointy0
- y start pointx1
- x end pointy1
- y end pointpublic void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
x
- y
- width
- height
- startAngle
- arcAngle
- public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
x
- y
- width
- height
- startAngle
- arcAngle
- public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
- y
- width
- height
- arcWidth
- arcHeight
- public void drawRect(int x, int y, int width, int height)
x
- y
- width
- height
- public void fillRect(int x, int y, int w, int h)
x
- y
- w
- h
- public int getStrokeStyle()
public void setStrokeStyle(int style)
style
- new style.public void copyArea(int sx, int sy, int w, int h, int x, int y, int anchor)
sx
- Source xsy
- Source yw
- Source widthh
- Source heightx
- Destination xy
- Destination yanchor
- location of the anchor point of the destination.public void translate(int x, int y)
x
- the new translation origin x valuey
- new translation origin y valuegetTranslateX()
,
getTranslateY()
public int getTranslateX()
public int getTranslateY()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |