|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.livescribe.display.Graphics
public class Graphics
The Graphics class provides 2D drawing functionality. It
encapsulates the process of rendering on any drawing surface--whether an
image or the pen display screen. The targeted image or display is called the
"destination" of the Graphics instance. The
Graphics instance contains the attributes, such as location,
width, and color, of the lines used to render geometric shapes.
The static method getGraphics returns a Graphics
instance that is associated with either the Image passed to
the constructor or with the pen display. Call methods such as
setBrushColor and setLineStyle to assign
attributes. To render to the destination, call any of the draw methods, the
fillRect method, the clear methods, or the lineTo
method.
| Field Summary | |
|---|---|
static int |
LINE_STYLE_DOTTED
|
static int |
LINE_STYLE_INVISIBLE
|
static int |
LINE_STYLE_SOLID
|
| Method Summary | |
|---|---|
void |
clearRect()
Clears the drawing surface backed by the Graphics object. |
void |
clearRect(int x,
int y,
int width,
int height)
Clears the portion of the drawing surface backed by the Graphics object. |
void |
drawImage(Image src,
int x,
int y)
Draw the specified image at coordinates x and
y of the destination. |
void |
drawImage(Image src,
int srcx,
int srcy,
int width,
int height,
int x,
int y)
Draws a portion of the image specified by (srcx,srcy,width,height) to the location (x,y) of the destination. |
void |
drawLine(int x0,
int y0,
int x1,
int y1)
Draws a line between the coordinates (x0,y0) and
(x1,y1) on the destination associated with this
Graphics. |
void |
drawString(AttributedText text,
int x,
int y,
int anchor)
Draw a Attributed text on the destination of this Graphics, using
the current font. |
void |
drawString(String text,
int x,
int y,
int anchor)
Draw a string on the destination of this Graphics, using
the current font. |
void |
fill(int x,
int y,
int width,
int height,
int color)
|
void |
fillRect(int x,
int y,
int width,
int height)
Fills the specified rectangle with the white color. |
byte |
getBrushColor()
Gets the current brush color of this Graphics. |
short |
getClipHeight()
Gets the height of the clip |
short |
getClipWidth()
Gets the width of the clip |
short |
getClipX()
Gets the X-coordinate of the clip. |
short |
getClipY()
Gets the Y-coordinate of the clip. |
Image |
getDestination()
Gets the destination Image this Graphics
renders to. |
Font |
getFont()
Gets the current font of this Graphics. |
static Graphics |
getGraphics(Image image)
Gets an instance of the Graphics that can render to the
Image passed. |
byte |
getNegativeBrushColor()
Gets the color that will erase what is painted with the brush. |
void |
lineTo(int x,
int y)
Draws a line from the current position to the coordinate specified. |
void |
moveTo(int x,
int y)
Move to the coordinate specified by (x,y) |
void |
putPixel(int x,
int y,
int color)
Puts a pixel (x,y) on the destination associated with this
Graphics. |
void |
setBrushColor(byte brushColor)
Set the color for this Graphics. |
void |
setFont(Font font)
Sets the font for this Graphics. |
void |
setLineStyle(int linestyle)
Set the line style for all strokes. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LINE_STYLE_SOLID
public static final int LINE_STYLE_DOTTED
public static final int LINE_STYLE_INVISIBLE
| Method Detail |
|---|
public static Graphics getGraphics(Image image)
Graphics that can render to the
Image passed. If the image is null then it
is treated as a request to get a graphics instance for the display.
image - destination for the graphics operations. A value of
null refers to the display as the destination.
public Font getFont()
Graphics.
public void setFont(Font font)
Graphics.
font - Font
public void drawString(String text,
int x,
int y,
int anchor)
Graphics, using
the current font. Note that the Y-coordinate represents the upper-left
corner of the text and not the baseline. This is not consistent with
how Java AWT's drawString method works.
text - the text to drawx - the X-coordinatey - the Y-coordinateanchor - the anchor, unused
public void drawString(AttributedText text,
int x,
int y,
int anchor)
Graphics, using
the current font. Note that the Y-coordinate represents the upper-left
corner of the text and not the baseline. This is not consistent with
how Java AWT's drawString method works.
text - attributed text to renderx - the X-coordinatey - the Y-coordinateanchor - the anchor, unusedpublic void setBrushColor(byte brushColor)
Graphics. All drawing calls will
use the specified color.
brushColor - the valid colors are (Display.getBlackColor(),
Display.getWhiteColor())public byte getBrushColor()
Graphics.
public byte getNegativeBrushColor()
Graphics.
public void setLineStyle(int linestyle)
linestyle - style of the linepublic void clearRect()
Graphics object.
public void clearRect(int x,
int y,
int width,
int height)
Graphics object. The rectangle specified should be fully
contained by the drawing surface bounds.
x - the X-coordinatey - the Y-coordinatewidth - the widthheight - the height
public void fill(int x,
int y,
int width,
int height,
int color)
public void fillRect(int x,
int y,
int width,
int height)
x - the X-coordinatey - the Y-coordinatewidth - the widthheight - the height
public void drawLine(int x0,
int y0,
int x1,
int y1)
(x0,y0) and
(x1,y1) on the destination associated with this
Graphics. The current color and stroke style are used.
The origin is at the top left-hand corner of the pen display.
x0 - the x coordinate of the start of the line.y0 - the y coordinate of the start of the line.x1 - the x coordinate of the end of the line.y1 - the y coordinate of the end of the line.
public void putPixel(int x,
int y,
int color)
(x,y) on the destination associated with this
Graphics.
x - the x coordinate of the pixel.y - the y coordinate of the pixel.color - the color of the pixel
public void moveTo(int x,
int y)
x - the X-coordinatey - the Y-coordinate
public void lineTo(int x,
int y)
x - the X-coordinatey - the Y-coordinate
public void drawImage(Image src,
int x,
int y)
x and
y of the destination. All or parts of src
may end up outside the dimensions of the destination for this
Graphics object.
src - the Image to be drawn to the destination.x - horizontal position of src relative to destination.y - vertical position of src relative to destination.
public void drawImage(Image src,
int srcx,
int srcy,
int width,
int height,
int x,
int y)
src - source image.srcx - source x coordinatesrcy - source y coordinatewidth - width of the source imageheight - height of the source imagex - destination x coordinatey - destination y coordinatepublic Image getDestination()
Image this Graphics
renders to.
public short getClipX()
public short getClipY()
public short getClipWidth()
public short getClipHeight()
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||