public final class PDFGraphics2D
extends java.awt.Graphics2D
Graphics2D
implementation that writes to PDF format. For
typical usage, see the documentation for the PDFDocument
class.
For some demos of the use of this class, please look in the
com.orsonpdf.demo
package in the src
directory.
Constructor and Description |
---|
PDFGraphics2D(GraphicsStream gs,
int width,
int height)
Creates a new instance of
PDFGraphics2D . |
PDFGraphics2D(GraphicsStream gs,
int width,
int height,
boolean skipJava2DTransform)
Creates a new instance of
PDFGraphics2D . |
Modifier and Type | Method and Description |
---|---|
void |
addRenderingHints(java.util.Map<?,?> hints)
Adds all the supplied rendering hints.
|
void |
clearRect(int x,
int y,
int width,
int height)
Clears the specified rectangle by filling it with the current
background color.
|
void |
clip(java.awt.Shape s)
Clips to the intersection of the current clipping region and the
specified shape.
|
void |
clipRect(int x,
int y,
int width,
int height)
Clips to the intersection of the current clipping region and the
specified rectangle.
|
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
This method does nothing.
|
java.awt.Graphics |
create()
Returns a new
PDFGraphics2D instance that is a copy of this
instance. |
void |
dispose()
This method does nothing, there are no resources to dispose.
|
void |
draw(java.awt.Shape s)
Draws the specified shape with the current
paint and
stroke . |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws an arc contained within the rectangle
(x, y, width, height) , starting at startAngle
and continuing through arcAngle degrees using
the current paint and stroke . |
void |
drawGlyphVector(java.awt.font.GlyphVector g,
float x,
float y)
Draws the specified glyph vector at the location
(x, y) . |
void |
drawImage(java.awt.image.BufferedImage img,
java.awt.image.BufferedImageOp op,
int x,
int y)
Draws the image resulting from applying the
BufferedImageOp
to the specified image at the location (x, y) . |
boolean |
drawImage(java.awt.Image img,
java.awt.geom.AffineTransform xform,
java.awt.image.ImageObserver observer)
Draws an image with the specified transform.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Draws an image at the location
(x, y) . |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.image.ImageObserver observer)
Draws an image at the location
(x, y) . |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int w,
int h,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Draws an image to the rectangle
(x, y, w, h) (scaling it if
required), first filling the background with the specified color. |
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int w,
int h,
java.awt.image.ImageObserver observer)
Draws the image into the rectangle defined by
(x, y, w, h) . |
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)
Draws part of an image (defined by the source rectangle
(sx1, sy1, sx2, sy2) ) into the destination rectangle
(dx1, dy1, dx2, dy2) . |
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)
Draws part of an image (defined by the source rectangle
(sx1, sy1, sx2, sy2) ) into the destination rectangle
(dx1, dy1, dx2, dy2) . |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line from
(x1, y1) to (x2, y2) using
the current paint and stroke . |
void |
drawOval(int x,
int y,
int width,
int height)
Draws an oval framed by the rectangle
(x, y, width, height)
using the current paint and stroke . |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws the specified polygon using the current
paint and
stroke . |
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
Draws the specified multi-segment line using the current
paint and stroke . |
void |
drawRenderableImage(java.awt.image.renderable.RenderableImage img,
java.awt.geom.AffineTransform xform)
Draws the renderable image.
|
void |
drawRenderedImage(java.awt.image.RenderedImage img,
java.awt.geom.AffineTransform xform)
Draws the rendered image.
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rectangle with rounded corners using the current
paint and stroke . |
void |
drawString(java.text.AttributedCharacterIterator iterator,
float x,
float y)
Draws a string of attributed characters at
(x, y) . |
void |
drawString(java.text.AttributedCharacterIterator iterator,
int x,
int y)
Draws a string of attributed characters at
(x, y) . |
void |
drawString(java.lang.String str,
float x,
float y)
Draws a string at
(x, y) . |
void |
drawString(java.lang.String str,
int x,
int y)
Draws a string at
(x, y) . |
void |
fill(java.awt.Shape s)
Fills the specified shape with the current
paint . |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Fills an arc contained within the rectangle
(x, y, width, height) , starting at startAngle
and continuing through arcAngle degrees, using
the current paint |
void |
fillOval(int x,
int y,
int width,
int height)
Fills an oval framed by the rectangle
(x, y, width, height) . |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Fills the specified polygon using the current
paint . |
void |
fillRect(int x,
int y,
int width,
int height)
Fills the specified rectangle with the current
paint . |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Fills a rectangle with rounded corners.
|
java.awt.Color |
getBackground()
Returns the background color.
|
java.awt.Shape |
getClip()
Returns the user clipping region.
|
java.awt.Rectangle |
getClipBounds()
Returns the bounds of the user clipping region.
|
java.awt.Color |
getColor()
Returns the foreground color.
|
java.awt.Composite |
getComposite()
Returns the current composite.
|
java.awt.GraphicsConfiguration |
getDeviceConfiguration()
Returns the device configuration associated with this
Graphics2D . |
java.awt.Font |
getFont()
Returns the current font used for drawing text.
|
java.awt.FontMetrics |
getFontMetrics(java.awt.Font f)
Returns the font metrics for the specified font.
|
java.awt.font.FontRenderContext |
getFontRenderContext()
Returns the font render context.
|
java.awt.Paint |
getPaint()
Returns the paint used to draw or fill shapes (or text).
|
java.lang.Object |
getRenderingHint(java.awt.RenderingHints.Key hintKey)
Returns the current value for the specified hint.
|
java.awt.RenderingHints |
getRenderingHints()
Returns a copy of the rendering hints.
|
java.awt.Stroke |
getStroke()
Returns the current stroke (used when drawing shapes).
|
java.awt.geom.AffineTransform |
getTransform()
Returns a copy of the current transform.
|
boolean |
hit(java.awt.Rectangle rect,
java.awt.Shape s,
boolean onStroke)
Returns
true if the rectangle (in device space) intersects
with the shape (the interior, if onStroke is false,
otherwise the stroked outline of the shape). |
void |
rotate(double theta)
Applies a rotation (anti-clockwise) about
(0, 0) . |
void |
rotate(double theta,
double x,
double y)
Applies a rotation (anti-clockwise) about
(x, y) . |
void |
scale(double sx,
double sy)
Applies a scale transformation.
|
void |
setBackground(java.awt.Color color)
Sets the background color.
|
void |
setClip(int x,
int y,
int width,
int height)
Sets the user clipping region to the specified rectangle.
|
void |
setClip(java.awt.Shape shape)
Sets the user clipping region.
|
void |
setColor(java.awt.Color c)
Sets the foreground color.
|
void |
setComposite(java.awt.Composite comp)
Sets the composite (only
AlphaComposite is handled). |
void |
setFont(java.awt.Font font)
Sets the font to be used for drawing text.
|
void |
setPaint(java.awt.Paint paint)
Sets the paint used to draw or fill shapes (or text).
|
void |
setPaintMode()
Does nothing in this
PDFGraphics2D implementation. |
void |
setRenderingHint(java.awt.RenderingHints.Key hintKey,
java.lang.Object hintValue)
Sets the value for a hint.
|
void |
setRenderingHints(java.util.Map<?,?> hints)
Sets the rendering hints to the specified collection.
|
void |
setStroke(java.awt.Stroke s)
Sets the stroke that will be used to draw shapes.
|
void |
setTransform(java.awt.geom.AffineTransform t)
Sets the transform.
|
void |
setXORMode(java.awt.Color c)
Does nothing in this
PDFGraphics2D implementation. |
void |
shear(double shx,
double shy)
Applies a shear transformation.
|
void |
transform(java.awt.geom.AffineTransform t)
Applies this transform to the existing transform by concatenating it.
|
void |
translate(double tx,
double ty)
Applies the translation
(tx, ty) . |
void |
translate(int tx,
int ty)
Applies the translation
(tx, ty) . |
public PDFGraphics2D(GraphicsStream gs, int width, int height)
PDFGraphics2D
. You won't
normally create this directly, instead you will call the
Page.getGraphics2D()
method.gs
- the graphics stream (null
not permitted).width
- the width.height
- the height.public PDFGraphics2D(GraphicsStream gs, int width, int height, boolean skipJava2DTransform)
PDFGraphics2D
. You won't
normally create this directly, instead you will call the
Page.getGraphics2D()
method.gs
- the graphics stream (null
not permitted).width
- the width.height
- the height.skipJava2DTransform
- a flag that allows the PDF to Java2D
transform to be skipped (used for watermarks which are appended
to an existing stream that already has the transform).public java.awt.Graphics create()
PDFGraphics2D
instance that is a copy of this
instance.create
in class java.awt.Graphics
public java.awt.Paint getPaint()
Color.WHITE
.getPaint
in class java.awt.Graphics2D
null
).setPaint(java.awt.Paint)
public void setPaint(java.awt.Paint paint)
paint
is an instance of Color
, this method will
also update the current color attribute (see getColor()
). If
you pass null
to this method, it does nothing (in
accordance with the JDK specification).setPaint
in class java.awt.Graphics2D
paint
- the paint (null
is permitted but ignored).getPaint()
public java.awt.Color getColor()
getPaint()
method instead.getColor
in class java.awt.Graphics
null
).getPaint()
public void setColor(java.awt.Color c)
setPaint(java.awt.Paint)
method.setColor
in class java.awt.Graphics
c
- the color (null
permitted but ignored).setPaint(java.awt.Paint)
public java.awt.Color getBackground()
Color.BLACK
.
This is used by the clearRect(int, int, int, int)
method.getBackground
in class java.awt.Graphics2D
null
).setBackground(java.awt.Color)
public void setBackground(java.awt.Color color)
clearRect(int, int, int, int)
method. The reference
implementation allows null
for the background color so we allow
that too (but for that case, the clearRect()
method will do
nothing).setBackground
in class java.awt.Graphics2D
color
- the color (null
permitted).getBackground()
public java.awt.Composite getComposite()
getComposite
in class java.awt.Graphics2D
null
).setComposite(java.awt.Composite)
public void setComposite(java.awt.Composite comp)
AlphaComposite
is handled).setComposite
in class java.awt.Graphics2D
comp
- the composite (null
not permitted).getComposite()
public java.awt.Stroke getStroke()
getStroke
in class java.awt.Graphics2D
null
).setStroke(java.awt.Stroke)
public void setStroke(java.awt.Stroke s)
BasicStroke
is supported.setStroke
in class java.awt.Graphics2D
s
- the stroke (null
not permitted).getStroke()
public java.lang.Object getRenderingHint(java.awt.RenderingHints.Key hintKey)
PDFHints
class for details of the supported hints.getRenderingHint
in class java.awt.Graphics2D
hintKey
- the hint key (null
permitted, but the
result will be null
also).null
).setRenderingHint(java.awt.RenderingHints.Key, java.lang.Object)
public void setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)
PDFHints
class for details
of the supported hints.setRenderingHint
in class java.awt.Graphics2D
hintKey
- the hint key.hintValue
- the hint value.getRenderingHint(java.awt.RenderingHints.Key)
public java.awt.RenderingHints getRenderingHints()
Graphics2D
instance.getRenderingHints
in class java.awt.Graphics2D
null
).setRenderingHints(java.util.Map)
public void setRenderingHints(java.util.Map<?,?> hints)
setRenderingHints
in class java.awt.Graphics2D
hints
- the new set of hints (null
not permitted).getRenderingHints()
public void addRenderingHints(java.util.Map<?,?> hints)
addRenderingHints
in class java.awt.Graphics2D
hints
- the hints (null
not permitted).public void draw(java.awt.Shape s)
paint
and
stroke
. There is direct handling for Line2D
and Path2D
instances. All other shapes are mapped to a
GeneralPath
and then drawn (effectively as Path2D
objects).draw
in class java.awt.Graphics2D
s
- the shape (null
not permitted).fill(java.awt.Shape)
public void fill(java.awt.Shape s)
paint
. There is
direct handling for Path2D
instances. All other shapes are
mapped to a GeneralPath
and then filled.fill
in class java.awt.Graphics2D
s
- the shape (null
not permitted).draw(java.awt.Shape)
public java.awt.Font getFont()
getFont
in class java.awt.Graphics
null
).setFont(java.awt.Font)
public void setFont(java.awt.Font font)
setFont
in class java.awt.Graphics
font
- the font (null
is permitted but ignored).getFont()
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
getFontMetrics
in class java.awt.Graphics
f
- the font.public java.awt.font.FontRenderContext getFontRenderContext()
FontRenderContext
for an image that is maintained
internally (as for getFontMetrics(java.awt.Font)
).getFontRenderContext
in class java.awt.Graphics2D
public void drawString(java.lang.String str, int x, int y)
(x, y)
. The start of the text at the
baseline level will be aligned with the (x, y)
point.drawString
in class java.awt.Graphics2D
str
- the string (null
not permitted).x
- the x-coordinate.y
- the y-coordinate.drawString(java.lang.String, float, float)
public void drawString(java.lang.String str, float x, float y)
(x, y)
. The start of the text at the
baseline level will be aligned with the (x, y)
point.drawString
in class java.awt.Graphics2D
str
- the string (null
not permitted).x
- the x-coordinate.y
- the y-coordinate.public void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)
(x, y)
. The call is
delegated to
drawString(java.text.AttributedCharacterIterator, float, float)
.drawString
in class java.awt.Graphics2D
iterator
- an iterator for the characters.x
- the x-coordinate.y
- the x-coordinate.public void drawString(java.text.AttributedCharacterIterator iterator, float x, float y)
(x, y)
.
LIMITATION: in the current implementation, the string is drawn using the current font and the formatting is ignored.
drawString
in class java.awt.Graphics2D
iterator
- an iterator over the characters (null
not
permitted).x
- the x-coordinate.y
- the y-coordinate.public void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)
(x, y)
.drawGlyphVector
in class java.awt.Graphics2D
g
- the glyph vector (null
not permitted).x
- the x-coordinate.y
- the y-coordinate.public void translate(int tx, int ty)
(tx, ty)
. This call is delegated
to translate(double, double)
.translate
in class java.awt.Graphics2D
tx
- the x-translation.ty
- the y-translation.translate(double, double)
public void translate(double tx, double ty)
(tx, ty)
.translate
in class java.awt.Graphics2D
tx
- the x-translation.ty
- the y-translation.public void rotate(double theta)
(0, 0)
.rotate
in class java.awt.Graphics2D
theta
- the rotation angle (in radians).public void rotate(double theta, double x, double y)
(x, y)
.rotate
in class java.awt.Graphics2D
theta
- the rotation angle (in radians).x
- the x-coordinate.y
- the y-coordinate.public void scale(double sx, double sy)
scale
in class java.awt.Graphics2D
sx
- the x-scaling factor.sy
- the y-scaling factor.public void shear(double shx, double shy)
transform
method:
transform(AffineTransform.getShearInstance(shx, shy));
shear
in class java.awt.Graphics2D
shx
- the x-shear factor.shy
- the y-shear factor.public void transform(java.awt.geom.AffineTransform t)
transform
in class java.awt.Graphics2D
t
- the transform (null
not permitted).public java.awt.geom.AffineTransform getTransform()
getTransform
in class java.awt.Graphics2D
null
).setTransform(java.awt.geom.AffineTransform)
public void setTransform(java.awt.geom.AffineTransform t)
setTransform
in class java.awt.Graphics2D
t
- the new transform (null
permitted, resets to the
identity transform).getTransform()
public boolean hit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)
true
if the rectangle (in device space) intersects
with the shape (the interior, if onStroke
is false,
otherwise the stroked outline of the shape).hit
in class java.awt.Graphics2D
rect
- a rectangle (in device space).s
- the shape.onStroke
- test the stroked outline only?public java.awt.GraphicsConfiguration getDeviceConfiguration()
Graphics2D
.getDeviceConfiguration
in class java.awt.Graphics2D
public void setPaintMode()
PDFGraphics2D
implementation.setPaintMode
in class java.awt.Graphics
public void setXORMode(java.awt.Color c)
PDFGraphics2D
implementation.setXORMode
in class java.awt.Graphics
c
- ignoredpublic java.awt.Shape getClip()
null
.getClip
in class java.awt.Graphics
null
).setClip(java.awt.Shape)
public void setClip(java.awt.Shape shape)
setClip
in class java.awt.Graphics
shape
- the new user clipping region (null
permitted).getClip()
public java.awt.Rectangle getClipBounds()
null
, this method will return null
.getClipBounds
in class java.awt.Graphics
null
).getClip()
public void clip(java.awt.Shape s)
According to the Oracle API specification, this method will accept a
null
argument, but there is an open bug report (since 2004)
that suggests this is wrong:
clip
in class java.awt.Graphics2D
s
- the clip shape (null
not permitted).public void clipRect(int x, int y, int width, int height)
clipRect
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.public void setClip(int x, int y, int width, int height)
setClip
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.getClip()
public void drawLine(int x1, int y1, int x2, int y2)
(x1, y1)
to (x2, y2)
using
the current paint
and stroke
.drawLine
in class java.awt.Graphics
x1
- the x-coordinate of the start point.y1
- the y-coordinate of the start point.x2
- the x-coordinate of the end point.y2
- the x-coordinate of the end point.public void fillRect(int x, int y, int width, int height)
paint
.fillRect
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the rectangle width.height
- the rectangle height.public void clearRect(int x, int y, int width, int height)
null
, this
method will do nothing.clearRect
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.getBackground()
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
paint
and stroke
.drawRoundRect
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.arcWidth
- the arc-width.arcHeight
- the arc-height.fillRoundRect(int, int, int, int, int, int)
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
fillRoundRect
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.arcWidth
- the arc-width.arcHeight
- the arc-height.public void drawOval(int x, int y, int width, int height)
(x, y, width, height)
using the current paint
and stroke
.drawOval
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.fillOval(int, int, int, int)
public void fillOval(int x, int y, int width, int height)
(x, y, width, height)
.fillOval
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.drawOval(int, int, int, int)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
(x, y, width, height)
, starting at startAngle
and continuing through arcAngle
degrees using
the current paint
and stroke
.drawArc
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.startAngle
- the start angle in degrees, 0 = 3 o'clock.arcAngle
- the angle (anticlockwise) in degrees.fillArc(int, int, int, int, int, int)
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
(x, y, width, height)
, starting at startAngle
and continuing through arcAngle
degrees, using
the current paint
fillArc
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width.height
- the height.startAngle
- the start angle in degrees, 0 = 3 o'clock.arcAngle
- the angle (anticlockwise) in degrees.drawArc(int, int, int, int, int, int)
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
paint
and stroke
.drawPolyline
in class java.awt.Graphics
xPoints
- the x-points.yPoints
- the y-points.nPoints
- the number of points to use for the polyline.public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
paint
and
stroke
.drawPolygon
in class java.awt.Graphics
xPoints
- the x-points.yPoints
- the y-points.nPoints
- the number of points to use for the polygon.fillPolygon(int[], int[], int)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
paint
.fillPolygon
in class java.awt.Graphics
xPoints
- the x-points.yPoints
- the y-points.nPoints
- the number of points to use for the polygon.drawPolygon(int[], int[], int)
public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver observer)
obs
is ignored.drawImage
in class java.awt.Graphics2D
img
- the image.xform
- the transform.observer
- the image observer (ignored).true
if the image is drawn.public void drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)
BufferedImageOp
to the specified image at the location (x, y)
.drawImage
in class java.awt.Graphics2D
img
- the image.op
- the operation.x
- the x-coordinate.y
- the y-coordinate.public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
drawRenderedImage
in class java.awt.Graphics2D
img
- the image.xform
- the transform.public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)
drawRenderableImage
in class java.awt.Graphics2D
img
- the renderable image.xform
- the transform.public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
(x, y)
. Note that the
observer
is ignored.drawImage
in class java.awt.Graphics
img
- the image.x
- the x-coordinate.y
- the y-coordinate.observer
- ignored.true
if the image is drawn.public boolean drawImage(java.awt.Image img, int x, int y, int w, int h, java.awt.image.ImageObserver observer)
(x, y, w, h)
.
Note that the observer
is ignored (it is not useful in this
context).drawImage
in class java.awt.Graphics
img
- the image.x
- the x-coordinate.y
- the y-coordinate.w
- the width.h
- the height.observer
- ignored.true
if the image is drawn.public boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
(x, y)
. Note that the
observer
is ignored.drawImage
in class java.awt.Graphics
img
- the image.x
- the x-coordinate.y
- the y-coordinate.bgcolor
- the background color (null
permitted).observer
- ignored.true
if the image is drawn.public boolean drawImage(java.awt.Image img, int x, int y, int w, int h, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
(x, y, w, h)
(scaling it if
required), first filling the background with the specified color. Note
that the observer
is ignored.drawImage
in class java.awt.Graphics
img
- the image.x
- the x-coordinate.y
- the y-coordinate.w
- the width.h
- the height.bgcolor
- the background color (null
permitted).observer
- ignored.true
if the image is drawn.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)
(sx1, sy1, sx2, sy2)
) into the destination rectangle
(dx1, dy1, dx2, dy2)
. Note that the observer
is ignored.drawImage
in class java.awt.Graphics
img
- the image.dx1
- the x-coordinate for the top left of the destination.dy1
- the y-coordinate for the top left of the destination.dx2
- the x-coordinate for the bottom right of the destination.dy2
- the y-coordinate for the bottom right of the destination.sx1
- the x-coordinate for the top left of the source.sy1
- the y-coordinate for the top left of the source.sx2
- the x-coordinate for the bottom right of the source.sy2
- the y-coordinate for the bottom right of the source.true
if the image is drawn.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)
(sx1, sy1, sx2, sy2)
) into the destination rectangle
(dx1, dy1, dx2, dy2)
. The destination rectangle is first
cleared by filling it with the specified bgcolor
. Note that
the observer
is ignored.drawImage
in class java.awt.Graphics
img
- the image.dx1
- the x-coordinate for the top left of the destination.dy1
- the y-coordinate for the top left of the destination.dx2
- the x-coordinate for the bottom right of the destination.dy2
- the y-coordinate for the bottom right of the destination.sx1
- the x-coordinate for the top left of the source.sy1
- the y-coordinate for the top left of the source.sx2
- the x-coordinate for the bottom right of the source.sy2
- the y-coordinate for the bottom right of the source.bgcolor
- the background color (null
permitted).observer
- ignored.true
if the image is drawn.public void copyArea(int x, int y, int width, int height, int dx, int dy)
copyArea
in class java.awt.Graphics
x
- the x-coordinate.y
- the y-coordinate.width
- the width of the area.height
- the height of the area.dx
- the delta x.dy
- the delta y.public void dispose()
dispose
in class java.awt.Graphics