public class DXFGraphics
extends java.awt.Graphics2D
// Create a DXF document and get its associated DXFGraphics instance DXFDocument dxfDocument = new DXFDocument("Example"); DXFGraphics dxfGraphics = dxfDocument.getGraphics(); // Do drawing commands as on any other Graphics. If you have a paint(Graphics) method, // you can just use it with the DXFGraphics instance since it's a subclass of Graphics. graphics.setColor(Color.RED); graphics.setStroke(new BasicStroke(3)); graphics.drawLine(0, 0, 1000, 500); graphics.drawRect(1000, 500, 150, 150); graphics.drawRoundRect(20, 200, 130, 100, 20, 10); // Get the DXF output as a string - it's just text - and save in a file for use with a CAD package String stringOutput = dxfDocument.toDXFString(); String filePath = "path/to/file.dxf"; FileWriter fileWriter = new FileWriter(filePath); fileWriter.write(dxfText); fileWriter.flush(); fileWriter.close();
Constructor and Description |
---|
DXFGraphics(DXFDocument dxfDocument)
Constructs a new DXFGraphics object.
|
Modifier and Type | Method and Description |
---|---|
void |
addRenderingHints(java.util.Map<?,?> arg0)
Does nothing...
|
void |
clear(java.awt.Shape shape)
Clear the specified shape by filling with the current background color.
|
void |
clearRect(double x,
double y,
double width,
double height)
Clears the specified rectangle by filling it with the background
color.
|
void |
clearRect(int x,
int y,
int width,
int height)
Clears the specified rectangle by filling it with the background
color.
|
void |
clip(java.awt.Shape arg0)
Does nothing as clipping not supported.
|
void |
clipRect(int x,
int y,
int width,
int height)
Does nothing, as clipping not supported
|
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Throws UnsupportedOperationException, as copyArea not supported.
|
DXFGraphics |
create()
Creates a new DXFGraphics object that is a copy of this DXFGraphics object.
|
DXFGraphics |
create(int x,
int y,
int width,
int height)
Creates a new DXFGraphics object based on this DXFGraphics object, but with a new translation.
|
void |
dispose()
Disposes of this graphics context and releases
any system resources that it is using.
|
void |
draw(java.awt.Shape shape)
Draw the specified shape.
|
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draws a 3-D highlighted outline of the specified rectangle.
|
void |
drawArc(double x,
double y,
double width,
double height,
double startAngle,
double sweepAngle)
Draws the outline of a circular or elliptical arc
covering the specified rectangle.
|
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int sweepAngle)
Draws the outline of a circular or elliptical arc
covering the specified rectangle.
|
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 |
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 |
drawGlyphVector(java.awt.font.GlyphVector arg0,
float arg1,
float arg2)
Throws UnsupportedOperationException as glyph drawing not supported.
|
void |
drawImage(java.awt.image.BufferedImage arg0,
java.awt.image.BufferedImageOp arg1,
int arg2,
int arg3)
Throws UnsupportedOperationException as image drawing not supported.
|
boolean |
drawImage(java.awt.Image arg0,
java.awt.geom.AffineTransform arg1,
java.awt.image.ImageObserver arg2)
Throws UnsupportedOperationException as image drawing not supported.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Throws UnsupportedOperationException, as drawImage not supported.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.image.ImageObserver observer)
Throws UnsupportedOperationException, as drawImage not supported.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Throws UnsupportedOperationException, as drawImage not supported.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
Throws UnsupportedOperationException, as drawImage not supported.
|
boolean |
drawImage(java.awt.Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Throws UnsupportedOperationException, as drawImage not supported.
|
boolean |
drawImage(java.awt.Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
java.awt.image.ImageObserver observer)
Throws UnsupportedOperationException, as drawImage not supported.
|
void |
drawLine(double x1,
double y1,
double x2,
double y2)
Draws a line, using the current color, between the points
(x1, y1) and (x2, y2)
in this graphics context's coordinate system. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line, using the current color, between the points
(x1, y1) and (x2, y2)
in this graphics context's coordinate system. |
void |
drawOval(double x,
double y,
double width,
double height)
Draws the outline of an oval.
|
void |
drawOval(int x,
int y,
int width,
int height)
Draws the outline of an oval.
|
void |
drawPolygon(double[] xPoints,
double[] yPoints,
int nPoints)
Draws a closed polygon defined by
arrays of x and y coordinates.
|
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a closed polygon defined by
arrays of x and y coordinates.
|
void |
drawPolygon(java.awt.Polygon p)
Draws the outline of a polygon defined by the specified
Polygon object. |
void |
drawPolyline(double[] xPoints,
double[] yPoints,
int nPoints)
Draws a sequence of connected lines 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(double x,
double y,
double width,
double height)
Draws the outline of the specified rectangle.
|
void |
drawRect(int x,
int y,
int width,
int height)
Draws the outline of the specified rectangle.
|
void |
drawRenderableImage(java.awt.image.renderable.RenderableImage arg0,
java.awt.geom.AffineTransform arg1)
Throws UnsupportedOperationException as image drawing not supported.
|
void |
drawRenderedImage(java.awt.image.RenderedImage arg0,
java.awt.geom.AffineTransform arg1)
Throws UnsupportedOperationException as image drawing not supported.
|
void |
drawRoundRect(double x,
double y,
double width,
double height,
double arcWidth,
double arcHeight)
Draws an outlined round-cornered rectangle using this graphics
context's current color.
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws an outlined round-cornered rectangle using this graphics
context's current color.
|
void |
drawSpline(int degree,
double[] controlPoints,
int[] multiplicities,
boolean throughEndpoints)
An extension method that supports the drawing of a B-spline.
|
void |
drawString(java.text.AttributedCharacterIterator charIterator,
float x,
float y) |
void |
drawString(java.text.AttributedCharacterIterator charIterator,
int x,
int y)
Renders the text of the specified iterator, but ignoring text attributes.
|
void |
drawString(java.lang.String string,
double x,
double y)
Draws the text given by the specified string, using this
graphics context's current font and color.
|
void |
drawString(java.lang.String str,
float x,
float y) |
void |
drawString(java.lang.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(java.awt.Shape shape)
Fill the specified shape with the current foreground color.
|
void |
fill(java.awt.Shape shape,
java.awt.Color color)
Fill the specified shape with the specified color.
|
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Paints a 3-D highlighted rectangle filled with the current color.
|
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Fills a circular or elliptical arc wedge covering the specified rectangle.
|
void |
fillOval(double x,
double y,
double width,
double height)
Fills an oval bounded by the specified rectangle with the
current color.
|
void |
fillOval(int x,
int y,
int width,
int height)
Fills an oval bounded by the specified rectangle with the
current color.
|
void |
fillPolygon(double[] xPoints,
double[] yPoints,
int nPoints)
Fills a closed polygon defined by
arrays of x and y coordinates.
|
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Fills a closed polygon defined by
arrays of x and y coordinates.
|
void |
fillPolygon(java.awt.Polygon p)
Fills the polygon defined by the specified Polygon object with
the graphics context's current color.
|
void |
fillRect(double x,
double y,
double width,
double height)
Fills the specified rectangle.
|
void |
fillRect(int x,
int y,
int width,
int height)
Fills the specified rectangle.
|
void |
fillRoundRect(double x,
double y,
double width,
double height,
double arcWidth,
double arcHeight)
Fills the specified rounded corner rectangle with the current color.
|
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Fills the specified rounded corner rectangle with the current color.
|
void |
finalize()
Disposes of this graphics context once it is no longer referenced.
|
java.awt.Color |
getBackground()
Return the current background color.
|
java.awt.Shape |
getClip()
Returns null, as clipping not supported
|
java.awt.Rectangle |
getClipBounds()
Returns null, as clipping not supported.
|
java.awt.Rectangle |
getClipBounds(java.awt.Rectangle r)
Returns r, as clipping not supported.
|
java.awt.Rectangle |
getClipRect()
Deprecated.
|
java.awt.Color |
getColor()
Gets this graphic's foreground color.
|
java.awt.Composite |
getComposite()
Returns null; Composite not supported.
|
java.awt.GraphicsConfiguration |
getDeviceConfiguration()
Returns null; GraphicsConfiguration not supported.
|
java.awt.Font |
getFont()
Gets the current font.
|
java.awt.FontMetrics |
getFontMetrics()
Gets the font metrics of the current font.
|
java.awt.FontMetrics |
getFontMetrics(java.awt.Font f)
Gets the font metrics for the specified font.
|
java.awt.font.FontRenderContext |
getFontRenderContext()
Returns null; Font render context not supported.
|
java.awt.Paint |
getPaint()
Just return the current foreground color object.
|
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key arg0)
Return null; rendering hints not supported.
|
java.awt.RenderingHints |
getRenderingHints()
Return null; rendering hints not supported.
|
java.awt.Stroke |
getStroke()
Return our current pen stroke.
|
java.awt.geom.AffineTransform |
getTransform()
Return a copy of the current graphics transformation being applied
to drawing and text operations.
|
boolean |
hit(java.awt.Rectangle arg0,
java.awt.Shape arg1,
boolean arg2)
Not supported; return false.
|
boolean |
hitClip(int x,
int y,
int width,
int height)
Returns true as clipping not supported.
|
void |
rotate(double radians)
Apply the specified rotation to the current graphics transformation.
|
void |
rotate(double radians,
double x,
double y)
Apply the specified rotation to the current graphics transformation, but first translating
by (x,y) and after translating back by (-x, -y).
|
void |
scale(double sx,
double sy)
Apply the specified scaling to the current graphics transformation.
|
void |
setBackground(java.awt.Color color)
Set the background color used in clear operations to the specified color
|
void |
setClip(int x,
int y,
int width,
int height)
Does nothing, as clipping not supported
|
void |
setClip(java.awt.Shape clip)
Does nothing, as clipping not supported
|
void |
setColor(java.awt.Color color)
Sets this graphics foreground color to the specified
color.
|
void |
setComposite(java.awt.Composite arg0)
Do nothing - composite not supported.
|
void |
setFont(java.awt.Font font)
Sets this graphics context's font to the specified font.
|
void |
setPaint(java.awt.Paint paint)
Use to set foreground color if instance of Color, otherwise do nothing.
|
void |
setPaintMode()
Sets the paint mode of this graphics context to overwrite the
destination with this graphics context's current color.
|
void |
setRenderingHint(java.awt.RenderingHints.Key arg0,
java.lang.Object arg1)
Do nothing; rendering hints not supported.
|
void |
setRenderingHints(java.util.Map<?,?> arg0)
Do nothing; rendering hints not supported.
|
void |
setStroke(java.awt.Stroke stroke)
Set stroke if instance of BasicStroke, otherwise throw UnsupportedOperationException.
|
void |
setTransform(java.awt.geom.AffineTransform newTransform)
Set current graphics transformation to that supplied.
|
void |
setXORMode(java.awt.Color xorColor)
Currently does nothing, as only PAINT_MODE is supported
|
void |
shear(double sx,
double sy)
Apply the specified shearing to the current graphics transformation.
|
java.lang.String |
toString()
Returns a
String object representing this
Graphics object's value. |
void |
transform(java.awt.geom.AffineTransform transform)
Concatenate the supplied transformation to the current graphics transformation.
|
void |
translate(double x,
double y)
Translates the origin of the graphics context to the point
(x, y) in the current coordinate system.
|
void |
translate(int x,
int y)
Translates the origin of the graphics context to the point
(x, y) in the current coordinate system.
|
public DXFGraphics(DXFDocument dxfDocument)
dxfDocument
- The associated DXFDocument instancepublic DXFGraphics create()
create
in class java.awt.Graphics
public DXFGraphics create(int x, int y, int width, int height)
create
in class java.awt.Graphics
public java.awt.Color getColor()
getColor
in class java.awt.Graphics
public void setColor(java.awt.Color color)
setColor
in class java.awt.Graphics
color
- the new rendering color.public void setPaintMode()
setPaintMode
in class java.awt.Graphics
public void setXORMode(java.awt.Color xorColor)
setXORMode
in class java.awt.Graphics
public java.awt.Font getFont()
getFont
in class java.awt.Graphics
public void setFont(java.awt.Font font)
setFont
in class java.awt.Graphics
font
- the new font.public java.awt.FontMetrics getFontMetrics()
getFontMetrics
in class java.awt.Graphics
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
getFontMetrics
in class java.awt.Graphics
f
- the specified fontpublic java.awt.Rectangle getClipBounds()
getClipBounds
in class java.awt.Graphics
public void clipRect(int x, int y, int width, int height)
clipRect
in class java.awt.Graphics
public void setClip(int x, int y, int width, int height)
setClip
in class java.awt.Graphics
public java.awt.Shape getClip()
getClip
in class java.awt.Graphics
public void setClip(java.awt.Shape clip)
setClip
in class java.awt.Graphics
public void copyArea(int x, int y, int width, int height, int dx, int dy)
copyArea
in class java.awt.Graphics
public void drawLine(int x1, int y1, int x2, int y2)
(x1, y1)
and (x2, y2)
in this graphics context's coordinate system.drawLine
in class java.awt.Graphics
x1
- the first point's x coordinate.y1
- the first point's y coordinate.x2
- the second point's x coordinate.y2
- the second point's y coordinate.public void drawLine(double x1, double y1, double x2, double y2)
(x1, y1)
and (x2, y2)
in this graphics context's coordinate system.x1
- the first point's x coordinate.y1
- the first point's y coordinate.x2
- the second point's x coordinate.y2
- the second point's y coordinate.public void fillRect(int x, int y, int width, int height)
x
and x + width - 1
.
The top and bottom edges are at
y
and y + height - 1
.
The rectangle is filled using the graphics context's current color.fillRect
in class java.awt.Graphics
x
- the x coordinate
of the rectangle to be filled.y
- the y coordinate
of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.public void fillRect(double x, double y, double width, double height)
x
and x + width - 1
.
The top and bottom edges are at
y
and y + height - 1
.
The rectangle is filled using the graphics context's current color.x
- the x coordinate
of the rectangle to be filled.y
- the y coordinate
of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.public void drawRect(int x, int y, int width, int height)
x
and x + width
.
The top and bottom edges are at
y
and y + height
.
The rectangle is drawn using the graphics context's current color.drawRect
in class java.awt.Graphics
x
- the x coordinate
of the rectangle to be drawn.y
- the y coordinate
of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.public void drawRect(double x, double y, double width, double height)
x
and x + width
.
The top and bottom edges are at
y
and y + height
.
The rectangle is drawn using the graphics context's current color.x
- the x coordinate
of the rectangle to be drawn.y
- the y coordinate
of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.public void clearRect(int x, int y, int width, int height)
clearRect
in class java.awt.Graphics
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.public void clearRect(double x, double y, double width, double height)
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.public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
and x + width
,
respectively. The top and bottom edges of the rectangle are at
y
and y + height
.drawRoundRect
in class java.awt.Graphics
x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.arcWidth
- the horizontal diameter of the arc
at the four corners.arcHeight
- the vertical diameter of the arc
at the four corners.public void drawRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight)
x
and x + width
,
respectively. The top and bottom edges of the rectangle are at
y
and y + height
.x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.arcWidth
- the horizontal diameter of the arc
at the four corners.arcHeight
- the vertical diameter of the arc
at the four corners.public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
and x + width - 1
,
respectively. The top and bottom edges of the rectangle are at
y
and y + height - 1
.fillRoundRect
in class java.awt.Graphics
x
- the x coordinate of the rectangle to be filled.y
- the y coordinate of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.arcWidth
- the horizontal diameter
of the arc at the four corners.arcHeight
- the vertical diameter
of the arc at the four corners.public void fillRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight)
x
and x + width - 1
,
respectively. The top and bottom edges of the rectangle are at
y
and y + height - 1
.x
- the x coordinate of the rectangle to be filled.y
- the y coordinate of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.arcWidth
- the horizontal diameter
of the arc at the four corners.arcHeight
- the vertical diameter
of the arc at the four corners.public void draw3DRect(int x, int y, int width, int height, boolean raised)
The colors used for the highlighting effect are determined
based on the current color.
The resulting rectangle covers an area that is
width + 1
pixels wide
by height + 1
pixels tall.
draw3DRect
in class java.awt.Graphics2D
x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.raised
- a boolean that determines whether the rectangle
appears to be raised above the surface
or sunk into the surface.public void fill3DRect(int x, int y, int width, int height, boolean raised)
fill3DRect
in class java.awt.Graphics2D
x
- the x coordinate of the rectangle to be filled.y
- the y coordinate of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.raised
- a boolean value that determines whether the
rectangle appears to be raised above the surface
or etched into the surface.Graphics.draw3DRect(int, int, int, int, boolean)
public void drawOval(int x, int y, int width, int height)
x
, y
,
width
, and height
arguments.drawOval
in class java.awt.Graphics
x
- the x coordinate of the upper left
corner of the oval to be drawn.y
- the y coordinate of the upper left
corner of the oval to be drawn.width
- the width of the oval to be drawn.height
- the height of the oval to be drawn.public void drawOval(double x, double y, double width, double height)
x
, y
,
width
, and height
arguments.x
- the x coordinate of the upper left
corner of the oval to be drawn.y
- the y coordinate of the upper left
corner of the oval to be drawn.width
- the width of the oval to be drawn.height
- the height of the oval to be drawn.public void fillOval(int x, int y, int width, int height)
fillOval
in class java.awt.Graphics
x
- the x coordinate of the upper left corner
of the oval to be filled.y
- the y coordinate of the upper left corner
of the oval to be filled.width
- the width of the oval to be filled.height
- the height of the oval to be filled.public void fillOval(double x, double y, double width, double height)
x
- the x coordinate of the upper left corner
of the oval to be filled.y
- the y coordinate of the upper left corner
of the oval to be filled.width
- the width of the oval to be filled.height
- the height of the oval to be filled.public void drawArc(int x, int y, int width, int height, int startAngle, int sweepAngle)
The resulting arc begins at startAngle
and extends
for arcAngle
degrees, using the current color.
Angles are interpreted such that 0 degrees
is at the 3 o'clock position.
A positive value indicates a counter-clockwise rotation
while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin
is (x, y) and whose size is specified by the
width
and height
arguments.
The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.
drawArc
in class java.awt.Graphics
x
- the x coordinate of the
upper-left corner of the arc to be drawn.y
- the y coordinate of the
upper-left corner of the arc to be drawn.width
- the width of the arc to be drawn.height
- the height of the arc to be drawn.startAngle
- the beginning angle, in degreessweepAngle
- the angular extent of the arc, in degrees,
relative to the start angle.public void drawArc(double x, double y, double width, double height, double startAngle, double sweepAngle)
The resulting arc begins at startAngle
and extends
for arcAngle
degrees, using the current color.
Angles are interpreted such that 0 degrees
is at the 3 o'clock position.
A positive value indicates a counter-clockwise rotation
while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin
is (x, y) and whose size is specified by the
width
and height
arguments.
The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.
x
- the x coordinate of the
upper-left corner of the arc to be drawn.y
- the y coordinate of the
upper-left corner of the arc to be drawn.width
- the width of the arc to be drawn.height
- the height of the arc to be drawn.startAngle
- the beginning angle, in degreessweepAngle
- the angular extent of the arc, in degrees,
relative to the start angle.public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
The resulting arc begins at startAngle
and extends
for arcAngle
degrees.
Angles are interpreted such that 0 degrees
is at the 3 o'clock position.
A positive value indicates a counter-clockwise rotation
while a negative value indicates a clockwise rotation.
The center of the arc is the center of the rectangle whose origin
is (x, y) and whose size is specified by the
width
and height
arguments.
The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.
fillArc
in class java.awt.Graphics
x
- the x coordinate of the
upper-left corner of the arc to be filled.y
- the y coordinate of the
upper-left corner of the arc to be filled.width
- the width of the arc to be filled.height
- the height of the arc to be filled.startAngle
- the beginning angle.arcAngle
- the angular extent of the arc,
relative to the start angle.public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
drawPolyline
in class java.awt.Graphics
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointspublic void drawPolyline(double[] xPoints, double[] yPoints, int nPoints)
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointspublic void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
This method draws the polygon defined by nPoint
line
segments, where the first nPoint - 1
line segments are line segments from
(xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for
1 ≤ i ≤ nPoints
.
The figure is automatically closed by drawing a line connecting
the final point to the first point, if those points are different.
drawPolygon
in class java.awt.Graphics
xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.public void drawPolygon(double[] xPoints, double[] yPoints, int nPoints)
This method draws the polygon defined by nPoint
line
segments, where the first nPoint - 1
line segments are line segments from
(xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for
1 ≤ i ≤ nPoints
.
The figure is automatically closed by drawing a line connecting
the final point to the first point, if those points are different.
xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.public void drawPolygon(java.awt.Polygon p)
Polygon
object.drawPolygon
in class java.awt.Graphics
p
- the polygon to draw.public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
This method fills the polygon defined by nPoint
line
segments, where the first nPoint - 1
line segments are line segments from
(xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for
1 ≤ i ≤ nPoints
.
The figure is automatically closed by drawing a line connecting
the final point to the first point, if those points are different.
fillPolygon
in class java.awt.Graphics
xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.public void fillPolygon(double[] xPoints, double[] yPoints, int nPoints)
This method fills the polygon defined by nPoint
line
segments, where the first nPoint - 1
line segments are line segments from
(xPoints[i - 1], yPoints[i - 1])
to (xPoints[i], yPoints[i])
, for
1 ≤ i ≤ nPoints
.
The figure is automatically closed by drawing a line connecting
the final point to the first point, if those points are different.
xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.public void fillPolygon(java.awt.Polygon p)
fillPolygon
in class java.awt.Graphics
p
- the polygon to fill.public void drawSpline(int degree, double[] controlPoints, int[] multiplicities, boolean throughEndpoints)
degree
- The degree of the spline; must be greater than 0controlPoints
- The control points that define the shape of the spline, {x1, y1, x2, y2, ..., xn, yn}.multiplicities
- The multiplicities for the control points; the number of multiplicity values must equal the
number of control points (i.e., the array size must be half that of the controlPoints array)throughEndpoints
- If true, the spline will be forced to pass through the endpoints by setting the end
control point multiplicities to degree + 1public void drawString(java.lang.String str, int x, int y)
drawString
in class java.awt.Graphics2D
str
- the string to be drawn.x
- the x coordinate.y
- the y coordinate.java.lang.NullPointerException
- if str
is null
.public void drawString(java.text.AttributedCharacterIterator charIterator, int x, int y)
The baseline of the leftmost character is at position (x, y) in this graphics context's coordinate system.
drawString
in class java.awt.Graphics2D
charIterator
- the iterator whose text is to be drawnx
- the x coordinate.y
- the y coordinate.java.lang.NullPointerException
- if iterator
is
null
.public void drawChars(char[] data, int offset, int length, int x, int y)
drawChars
in class java.awt.Graphics
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 textjava.lang.NullPointerException
- if data
is null
.java.lang.IndexOutOfBoundsException
- if offset
or
length
is less than zero, or
offset+length
is greater than the length of the
data
array.Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawString(java.lang.String, int, int)
public void drawBytes(byte[] data, int offset, int length, int x, int y)
Use of this method is not recommended as each byte is interpreted as a Unicode code point in the range 0 to 255, and so can only be used to draw Latin characters in that range.
drawBytes
in class java.awt.Graphics
data
- the data to be drawnoffset
- the start offset in the datalength
- the number of bytes that are drawnx
- the x coordinate of the baseline of the texty
- the y coordinate of the baseline of the textjava.lang.NullPointerException
- if data
is null
.java.lang.IndexOutOfBoundsException
- if offset
or
length
is less than zero, or offset+length
is greater than the length of the data
array.public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
drawImage
in class java.awt.Graphics
public void dispose()
dispose
in class java.awt.Graphics
public void finalize()
finalize
in class java.awt.Graphics
dispose()
public java.lang.String toString()
String
object representing this
Graphics
object's value.toString
in class java.awt.Graphics
@Deprecated public java.awt.Rectangle getClipRect()
getClipRect
in class java.awt.Graphics
public boolean hitClip(int x, int y, int width, int height)
hitClip
in class java.awt.Graphics
public java.awt.Rectangle getClipBounds(java.awt.Rectangle r)
getClipBounds
in class java.awt.Graphics
r
- the rectangle where the current clipping area is
copied to. Any current values in this rectangle are
overwritten.public void addRenderingHints(java.util.Map<?,?> arg0)
addRenderingHints
in class java.awt.Graphics2D
public void clip(java.awt.Shape arg0)
clip
in class java.awt.Graphics2D
public void draw(java.awt.Shape shape)
draw
in class java.awt.Graphics2D
shape
- shape to be drawnpublic void drawGlyphVector(java.awt.font.GlyphVector arg0, float arg1, float arg2)
drawGlyphVector
in class java.awt.Graphics2D
public boolean drawImage(java.awt.Image arg0, java.awt.geom.AffineTransform arg1, java.awt.image.ImageObserver arg2)
drawImage
in class java.awt.Graphics2D
public void drawImage(java.awt.image.BufferedImage arg0, java.awt.image.BufferedImageOp arg1, int arg2, int arg3)
drawImage
in class java.awt.Graphics2D
public void drawRenderableImage(java.awt.image.renderable.RenderableImage arg0, java.awt.geom.AffineTransform arg1)
drawRenderableImage
in class java.awt.Graphics2D
public void drawRenderedImage(java.awt.image.RenderedImage arg0, java.awt.geom.AffineTransform arg1)
drawRenderedImage
in class java.awt.Graphics2D
public void drawString(java.lang.String str, float x, float y)
drawString
in class java.awt.Graphics2D
public void drawString(java.lang.String string, double x, double y)
string
- the string to be drawn.x
- the x coordinate.y
- the y coordinate.java.lang.NullPointerException
- if str
is null
.public void drawString(java.text.AttributedCharacterIterator charIterator, float x, float y)
drawString
in class java.awt.Graphics2D
public void fill(java.awt.Shape shape)
fill
in class java.awt.Graphics2D
shape
- shape to be filledpublic void clear(java.awt.Shape shape)
shape
- shape to be clearedpublic void fill(java.awt.Shape shape, java.awt.Color color)
shape
- shape to be filledcolor
- color to be used to fill shapepublic java.awt.Color getBackground()
getBackground
in class java.awt.Graphics2D
public java.awt.Composite getComposite()
getComposite
in class java.awt.Graphics2D
public java.awt.GraphicsConfiguration getDeviceConfiguration()
getDeviceConfiguration
in class java.awt.Graphics2D
public java.awt.font.FontRenderContext getFontRenderContext()
getFontRenderContext
in class java.awt.Graphics2D
public java.awt.Paint getPaint()
getPaint
in class java.awt.Graphics2D
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key arg0)
getRenderingHint
in class java.awt.Graphics2D
public java.awt.RenderingHints getRenderingHints()
getRenderingHints
in class java.awt.Graphics2D
public java.awt.Stroke getStroke()
getStroke
in class java.awt.Graphics2D
public java.awt.geom.AffineTransform getTransform()
getTransform
in class java.awt.Graphics2D
public boolean hit(java.awt.Rectangle arg0, java.awt.Shape arg1, boolean arg2)
hit
in class java.awt.Graphics2D
public void rotate(double radians)
rotate
in class java.awt.Graphics2D
radians
- rotation in radianspublic void rotate(double radians, double x, double y)
rotate
in class java.awt.Graphics2D
radians
- rotation in radiansx
- x coordinate of pre- and post-translationy
- y coordinate of pre- and post-translationpublic void scale(double sx, double sy)
scale
in class java.awt.Graphics2D
sx
- amount to scale x coordinatessy
- amount to scale y coordinatespublic void setBackground(java.awt.Color color)
setBackground
in class java.awt.Graphics2D
color
- color to use for backgroundpublic void setComposite(java.awt.Composite arg0)
setComposite
in class java.awt.Graphics2D
public void setPaint(java.awt.Paint paint)
setPaint
in class java.awt.Graphics2D
paint
- paint object; only used if it's an instance of Colorpublic void setRenderingHint(java.awt.RenderingHints.Key arg0, java.lang.Object arg1)
setRenderingHint
in class java.awt.Graphics2D
public void setRenderingHints(java.util.Map<?,?> arg0)
setRenderingHints
in class java.awt.Graphics2D
public void setStroke(java.awt.Stroke stroke)
setStroke
in class java.awt.Graphics2D
stroke
- stroke to use (must be BasicStroke)public void setTransform(java.awt.geom.AffineTransform newTransform)
setTransform
in class java.awt.Graphics2D
newTransform
- new graphics transformation to be used.public void shear(double sx, double sy)
shear
in class java.awt.Graphics2D
sx
- amount to shear x coordinatessy
- amount to shear y coordinatespublic void transform(java.awt.geom.AffineTransform transform)
transform
in class java.awt.Graphics2D
public void translate(int x, int y)
translate
in class java.awt.Graphics2D
x
- the x coordinate.y
- the y coordinate.public void translate(double x, double y)
translate
in class java.awt.Graphics2D
x
- the x coordinate.y
- the y coordinate.