public interface Graphics
| Modifier and Type | Method and Description |
|---|---|
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)
Intersects the current clip with the specified rectangle.
|
void |
draw(Shape shape)
Strokes a shape
|
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
Draws the text given by the specified character array, using this graphics context's current
font and color.
|
void |
drawLine(double x,
double y,
double x2,
double y2) |
void |
drawString(String str,
int x,
int y)
Draws the text given by the specified string, using this graphics context's current font and
color.
|
void |
fill(Shape shape)
Fills a shape
|
void |
forceRepaint()
Forces a Repaint of the Component
|
com.google.gwt.canvas.dom.client.Context2d |
getContext2d() |
void |
setClip(int x,
int y,
int width,
int height)
Sets the current clip to the rectangle specified by the given coordinates.
|
void |
setClip(Shape clip)
Sets the current clipping area to an arbitrary clip shape.
|
void |
setColor(Color color)
Sets the Color to Fill/Stroke
|
void |
setFillColor(Color color) |
void |
setStroke(BasicStroke stroke)
sets the line style
|
void |
translate(int x,
int y) |
void forceRepaint()
com.google.gwt.canvas.dom.client.Context2d getContext2d()
void translate(int x,
int y)
void setColor(Color color)
color - the new colorvoid setStroke(BasicStroke stroke)
stroke - the style definitionIllegalArgumentException - if stroke contains an pattern for lines - dashArray and
dashPhase aren't supportedvoid draw(Shape shape)
shape - the shape to strokevoid fill(Shape shape)
shape - the shape to fillvoid clipRect(int x,
int y,
int width,
int height)
setClip(null), the specified rectangle becomes the new clip. This method sets the
user clip, which is independent of the clipping associated with device bounds and window
visibility. This method can only be used to make the current clip smaller. To set the current
clip larger, use any of the setClip methods. Rendering operations have no effect outside of the
clipping area.x - the x coordinate of the rectangle to intersect the clip withy - the y coordinate of the rectangle to intersect the clip withwidth - the width of the rectangle to intersect the clip withheight - the height of the rectangle to intersect the clip withsetClip(int, int, int, int),
setClip(Shape)void setClip(int x,
int y,
int width,
int height)
x - the x coordinate of the new clip rectangle.y - the y coordinate of the new clip rectangle.width - the width of the new clip rectangle.height - the height of the new clip rectangle.void setClip(Shape clip)
Shape interface can be used to set the clip. The only Shape objects
that are guaranteed to be supported are Shape objects that are obtained via the
getClip method and via Rectangle objects. This method sets the user
clip, which is independent of the clipping associated with device bounds and window visibility.clip - the Shape to use to set the clipvoid clearRect(int x,
int y,
int width,
int height)
Beginning with Java 1.1, the background color of offscreen images may be system dependent.
Applications should use setColor followed by fillRect to ensure that
an offscreen image is cleared to a specific color.
x - the x coordinate of the rectangle to clear.y - the y coordinate of the rectangle to clear.width - the width of the rectangle to clear.height - the height of the rectangle to clear.void drawString(String str, int x, int y)
str - the string to be drawn.x - the x coordinate.y - the y coordinate.NullPointerException - if str is null.void drawChars(char[] data,
int offset,
int length,
int x,
int y)
data - the array of characters to be drawnoffset - the start offset in the datalength - the number of characters to be drawnx - the x coordinate of the baseline of the texty - the y coordinate of the baseline of the textNullPointerException - if data is null.IndexOutOfBoundsException - if offset or lengthis less than
zero, or offset+length is greater than the length of the
data array.void drawLine(double x,
double y,
double x2,
double y2)
void setFillColor(Color color)
Copyright © 2015 levigo. All Rights Reserved.