APIdia Launch Partner
Top Fields Constructors Methods
sun.print

public Class ProxyGraphics2D

extends Graphics2D
implements PrinterGraphics
Class Inheritance
All Implemented Interfaces
java.awt.print.PrinterGraphics
Known Direct Subclasses
sun.print.GrayscaleProxyGraphics2D, sun.print.PathGraphics
Imports
java.util.Map, java.awt.Color, .Composite, .Graphics, .Graphics2D, .Font, .FontMetrics, .GraphicsConfiguration, .Image, .Paint, .Rectangle, .Shape, .Stroke, .RenderingHints, .RenderingHints.Key, java.awt.font.FontRenderContext, .GlyphVector, java.awt.geom.AffineTransform, .NoninvertibleTransformException, java.awt.image.BufferedImage, .BufferedImageOp, .ImageObserver, .RenderedImage, java.awt.image.renderable.RenderContext, .RenderableImage, java.awt.print.PrinterGraphics, .PrinterJob, java.text.AttributedCharacterIterator

Field Summary

Modifier and TypeField and Description
pack-priv Graphics2D
mGraphics

Drawing methods will be forwarded to this object.

pack-priv PrinterJob
mPrinterJob

The PrinterJob controlling the current printing.

Constructor Summary

AccessConstructor and Description
public
ProxyGraphics2D(Graphics2D graphics, PrinterJob printerJob)

The new ProxyGraphics2D will forward all graphics calls to 'graphics'.

Method Summary

Modifier and TypeMethod and Description
public void
addRenderingHints(Map<?, ?>
The rendering hints to be set
hints
)

Implements abstract java.awt.Graphics2D.addRenderingHints.

Adds a number of preferences for the rendering algorithms.

public void
clearRect(int
the x coordinate of the rectangle to clear.
x
,
int
the y coordinate of the rectangle to clear.
y
,
int
the width of the rectangle to clear.
width
,
int
the height of the rectangle to clear.
height
)

Implements abstract java.awt.Graphics.clearRect.

Clears the specified rectangle by filling it with the background color of the current drawing surface.

public void
clip(Shape
The Shape to be intersected with the current clip.
s
)

Implements abstract java.awt.Graphics2D.clip.

Intersects the current clip with the interior of the specified Shape and sets the current clip to the resulting intersection.

public void
clipRect(int
the x coordinate of the rectangle to intersect the clip with
x
,
int
the y coordinate of the rectangle to intersect the clip with
y
,
int
the width of the rectangle to intersect the clip with
width
,
int
the height of the rectangle to intersect the clip with
height
)

Implements abstract java.awt.Graphics.clipRect.

Intersects the current clip with the specified rectangle.

public void
copyArea(int
the x coordinate of the source rectangle.
x
,
int
the y coordinate of the source rectangle.
y
,
int
the width of the source rectangle.
width
,
int
the height of the source rectangle.
height
,
int
the horizontal distance to copy the pixels.
dx
,
int
the vertical distance to copy the pixels.
dy
)

Implements abstract java.awt.Graphics.copyArea.

Copies an area of the component by a distance specified by dx and dy.

public Graphics

Returns:

a new graphics context that is a copy of this graphics context.
create
()

Implements abstract java.awt.Graphics.create.

Creates a new Graphics object that is a copy of this Graphics object.

public void
dispose()

Implements abstract java.awt.Graphics.dispose.

Disposes of this graphics context and releases any system resources that it is using.

public void
draw(Shape
The shape to be drawn.
s
)

Implements abstract java.awt.Graphics2D.draw.

Strokes the outline of a Shape using the settings of the current graphics state.

public void
drawArc(int
the x coordinate of the upper-left corner of the arc to be drawn.
x
,
int
the y coordinate of the upper-left corner of the arc to be drawn.
y
,
int
the width of the arc to be drawn.
width
,
int
the height of the arc to be drawn.
height
,
int
the beginning angle.
startAngle
,
int
the angular extent of the arc, relative to the start angle.
arcAngle
)

Implements abstract java.awt.Graphics.drawArc.

Draws the outline of a circular or elliptical arc covering the specified rectangle.

public void
drawGlyphVector(GlyphVector
The GlyphVector to be drawn.
g
,
float x, float y)

Implements abstract java.awt.Graphics2D.drawGlyphVector.

Draws a GlyphVector.

public boolean
drawImage(Image
the specified image to be drawn.
img
,
int
the x coordinate.
x
,
int
the y coordinate.
y
,
ImageObserver
object to be notified as more of the image is converted.
observer
)

Implements abstract java.awt.Graphics.drawImage.

Draws as much of the specified image as is currently available.

public boolean
drawImage(Image
the specified image to be drawn.
img
,
int
the x coordinate.
x
,
int
the y coordinate.
y
,
int
the width of the rectangle.
width
,
int
the height of the rectangle.
height
,
ImageObserver
object to be notified as more of the image is converted.
observer
)

Implements abstract java.awt.Graphics.drawImage.

Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.

public boolean
drawImage(Image
the specified image to be drawn.
img
,
int
the x coordinate.
x
,
int
the y coordinate.
y
,
Color
the background color to paint under the non-opaque portions of the image.
bgcolor
,
ImageObserver
object to be notified as more of the image is converted.
observer
)

Implements abstract java.awt.Graphics.drawImage.

Draws as much of the specified image as is currently available.

public boolean
drawImage(Image
the specified image to be drawn.
img
,
int
the x coordinate.
x
,
int
the y coordinate.
y
,
int
the width of the rectangle.
width
,
int
the height of the rectangle.
height
,
Color
the background color to paint under the non-opaque portions of the image.
bgcolor
,
ImageObserver
object to be notified as more of the image is converted.
observer
)

Implements abstract java.awt.Graphics.drawImage.

Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.

public boolean
drawImage(Image
the specified image to be drawn
img
,
int
the x coordinate of the first corner of the destination rectangle.
dx1
,
int
the y coordinate of the first corner of the destination rectangle.
dy1
,
int
the x coordinate of the second corner of the destination rectangle.
dx2
,
int
the y coordinate of the second corner of the destination rectangle.
dy2
,
int
the x coordinate of the first corner of the source rectangle.
sx1
,
int
the y coordinate of the first corner of the source rectangle.
sy1
,
int
the x coordinate of the second corner of the source rectangle.
sx2
,
int
the y coordinate of the second corner of the source rectangle.
sy2
,
ImageObserver
object to be notified as more of the image is scaled and converted.
observer
)

Implements abstract java.awt.Graphics.drawImage.

Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.

public boolean
drawImage(Image
the specified image to be drawn
img
,
int
the x coordinate of the first corner of the destination rectangle.
dx1
,
int
the y coordinate of the first corner of the destination rectangle.
dy1
,
int
the x coordinate of the second corner of the destination rectangle.
dx2
,
int
the y coordinate of the second corner of the destination rectangle.
dy2
,
int
the x coordinate of the first corner of the source rectangle.
sx1
,
int
the y coordinate of the first corner of the source rectangle.
sy1
,
int
the x coordinate of the second corner of the source rectangle.
sx2
,
int
the y coordinate of the second corner of the source rectangle.
sy2
,
Color
the background color to paint under the non-opaque portions of the image.
bgcolor
,
ImageObserver
object to be notified as more of the image is scaled and converted.
observer
)

Implements abstract java.awt.Graphics.drawImage.

Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.

public boolean
drawImage(Image
The image to be drawn.
img
,
AffineTransform
The transformation from image space into user space.
xform
,
ImageObserver
The image observer to be notified as more of the image is converted.
obs
)

Implements abstract java.awt.Graphics2D.drawImage.

Draws an image, applying a transform from image space into user space before drawing.

public void
drawImage(BufferedImage
The BufferedImage to be drawn.
img
,
BufferedImageOp
The filter to be applied to the image before drawing.
op
,
int x, int y)

Implements abstract java.awt.Graphics2D.drawImage.

Draws a BufferedImage that is filtered with a BufferedImageOp.

public void
drawLine(int
the first point's x coordinate.
x1
,
int
the first point's y coordinate.
y1
,
int
the second point's x coordinate.
x2
,
int
the second point's y coordinate.
y2
)

Implements abstract java.awt.Graphics.drawLine.

Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.

public void
drawOval(int
the x coordinate of the upper left corner of the oval to be drawn.
x
,
int
the y coordinate of the upper left corner of the oval to be drawn.
y
,
int
the width of the oval to be drawn.
width
,
int
the height of the oval to be drawn.
height
)

Implements abstract java.awt.Graphics.drawOval.

Draws the outline of an oval.

public void
drawPolygon(int[]
an array of x coordinates.
xPoints
,
int[]
an array of y coordinates.
yPoints
,
int
the total number of points.
nPoints
)

Implements abstract java.awt.Graphics.drawPolygon.

Draws a closed polygon defined by arrays of x and y coordinates.

public void
drawPolyline(int[]
an array of x points
xPoints
,
int[]
an array of y points
yPoints
,
int
the total number of points
nPoints
)

Implements abstract java.awt.Graphics.drawPolyline.

Draws a sequence of connected lines defined by arrays of x and y coordinates.

public void
drawRenderableImage(RenderableImage img, AffineTransform xform)

Implements abstract java.awt.Graphics2D.drawRenderableImage.

Renders a RenderableImage, applying a transform from image space into user space before drawing.

public void
drawRenderedImage(RenderedImage
The image to be drawn.
img
,
AffineTransform
The transformation from image space into user space.
xform
)

Implements abstract java.awt.Graphics2D.drawRenderedImage.

Draws an image, applying a transform from image space into user space before drawing.

public void
drawRoundRect(int
the x coordinate of the rectangle to be drawn.
x
,
int
the y coordinate of the rectangle to be drawn.
y
,
int
the width of the rectangle to be drawn.
width
,
int
the height of the rectangle to be drawn.
height
,
int
the horizontal diameter of the arc at the four corners.
arcWidth
,
int
the vertical diameter of the arc at the four corners.
arcHeight
)

Implements abstract java.awt.Graphics.drawRoundRect.

Draws an outlined round-cornered rectangle using this graphics context's current color.

public void
drawString(String
the string to be drawn.
str
,
int
the x coordinate.
x
,
int
the y coordinate.
y
)

Implements abstract java.awt.Graphics2D.drawString.

Draws the text given by the specified string, using this graphics context's current font and color.

public void
drawString(AttributedCharacterIterator
the iterator whose text is to be drawn
iterator
,
int x, int y)

Implements abstract java.awt.Graphics2D.drawString.

Draws the text given by the specified iterator, using this graphics context's current color.

public void
drawString(AttributedCharacterIterator
the iterator whose text is to be drawn
iterator
,
float x, float y)

Implements abstract java.awt.Graphics2D.drawString.

Draws the text given by the specified iterator, using this graphics context's current color.

public void
drawString(String
The string to be drawn.
str
,
float x, float y)

Implements abstract java.awt.Graphics2D.drawString.

Draws a string of text.

public void
fill(Shape s)

Implements abstract java.awt.Graphics2D.fill.

Fills the interior of a Shape using the settings of the current graphics state.

public void
fillArc(int
the x coordinate of the upper-left corner of the arc to be filled.
x
,
int
the y coordinate of the upper-left corner of the arc to be filled.
y
,
int
the width of the arc to be filled.
width
,
int
the height of the arc to be filled.
height
,
int
the beginning angle.
startAngle
,
int
the angular extent of the arc, relative to the start angle.
arcAngle
)

Implements abstract java.awt.Graphics.fillArc.

Fills a circular or elliptical arc covering the specified rectangle.

public void
fillOval(int
the x coordinate of the upper left corner of the oval to be filled.
x
,
int
the y coordinate of the upper left corner of the oval to be filled.
y
,
int
the width of the oval to be filled.
width
,
int
the height of the oval to be filled.
height
)

Implements abstract java.awt.Graphics.fillOval.

Fills an oval bounded by the specified rectangle with the current color.

public void
fillPolygon(int[]
an array of x coordinates.
xPoints
,
int[]
an array of y coordinates.
yPoints
,
int
the total number of points.
nPoints
)

Implements abstract java.awt.Graphics.fillPolygon.

Fills a closed polygon defined by arrays of x and y coordinates.

public void
fillRect(int
the x coordinate of the rectangle to be filled.
x
,
int
the y coordinate of the rectangle to be filled.
y
,
int
the width of the rectangle to be filled.
width
,
int
the height of the rectangle to be filled.
height
)

Implements abstract java.awt.Graphics.fillRect.

Fills the specified rectangle.

public void
fillRoundRect(int
the x coordinate of the rectangle to be filled.
x
,
int
the y coordinate of the rectangle to be filled.
y
,
int
the width of the rectangle to be filled.
width
,
int
the height of the rectangle to be filled.
height
,
int
the horizontal diameter of the arc at the four corners.
arcWidth
,
int
the vertical diameter of the arc at the four corners.
arcHeight
)

Implements abstract java.awt.Graphics.fillRoundRect.

Fills the specified rounded corner rectangle with the current color.

public void
finalize()

Overrides java.awt.Graphics.finalize.

Empty finalizer as no clean up needed here.

public Color
getBackground()

Implements abstract java.awt.Graphics2D.getBackground.

Returns the background color used for clearing a region.

private BufferedImage
getBufferedImageCopy(Image img, Color bgcolor)

Return a new BufferedImage that contains a copy of the provided Image where its transparent pixels have been replaced by bgcolor.

public Shape

Returns:

a Shape object representing the current clipping area.
getClip
()

Implements abstract java.awt.Graphics.getClip.

Gets the current clipping area.

public Rectangle

Returns:

the bounding rectangle of the current clipping area.
getClipBounds
()

Implements abstract java.awt.Graphics.getClipBounds.

Returns the bounding rectangle of the current clipping area.

public Color

Returns:

this graphics context's current color.
getColor
()

Implements abstract java.awt.Graphics.getColor.

Gets this graphics context's current color.

public Composite
getComposite()

Implements abstract java.awt.Graphics2D.getComposite.

Returns the current Composite in the Graphics2D state.

public Graphics2D
getDelegate()

Return the Graphics2D object that does the drawing for this instance.

public GraphicsConfiguration
getDeviceConfiguration()

Implements abstract java.awt.Graphics2D.getDeviceConfiguration.

Returns the device configuration associated with this Graphics2D.

public Font

Returns:

this graphics context's current font.
getFont
()

Implements abstract java.awt.Graphics.getFont.

Gets the current font.

public FontMetrics

Returns:

the font metrics for the specified font.
getFontMetrics
(Font
the specified font
f
)

Implements abstract java.awt.Graphics.getFontMetrics.

Gets the font metrics for the specified font.

public FontRenderContext
getFontRenderContext()

Implements abstract java.awt.Graphics2D.getFontRenderContext.

Get the rendering context of the font within this Graphics2D context.

public Paint
getPaint()

Implements abstract java.awt.Graphics2D.getPaint.

Returns the current Paint in the Graphics2D state.

public PrinterJob
getPrinterJob()

Implements java.awt.print.PrinterGraphics.getPrinterJob.

Returns the PrinterJob that is controlling the current rendering request.

public Object

Returns:

The preferences for rendering algorithms.
getRenderingHint
(RenderingHints.Key
The category of hint to be set.
hintCategory
)

Implements abstract java.awt.Graphics2D.getRenderingHint.

Returns the preferences for the rendering algorithms.

public RenderingHints
getRenderingHints()

Implements abstract java.awt.Graphics2D.getRenderingHints.

Gets the preferences for the rendering algorithms.

public Stroke
getStroke()

Implements abstract java.awt.Graphics2D.getStroke.

Returns the current Stroke in the Graphics2D state.

public AffineTransform
getTransform()

Implements abstract java.awt.Graphics2D.getTransform.

Returns the current Transform in the Graphics2D state.

public boolean

Returns:

True if there is a hit, false otherwise.
hit
(Rectangle
The area in device space to check for a hit.
rect
,
Shape
The shape to check for a hit.
s
,
boolean
Flag to choose between testing the stroked or the filled shape.
onStroke
)

Implements abstract java.awt.Graphics2D.hit.

Checks to see if the outline of a Shape intersects the specified Rectangle in device space.

private boolean
needToCopyBgColorImage(Image img)

Return true if drawing img will invoke a Java2D bug (#4258675).

public void
rotate(double
The angle of rotation in radians.
theta
)

Implements abstract java.awt.Graphics2D.rotate.

Concatenates the current transform of this Graphics2D with a rotation transformation.

public void
rotate(double
The angle of rotation in radians.
theta
,
double
The x coordinate of the origin of the rotation
x
,
double
The x coordinate of the origin of the rotation
y
)

Implements abstract java.awt.Graphics2D.rotate.

Concatenates the current transform of this Graphics2D with a translated rotation transformation.

public void
scale(double sx, double sy)

Implements abstract java.awt.Graphics2D.scale.

Concatenates the current transform of this Graphics2D with a scaling transformation.

public void
setBackground(Color
The background color that should be used in subsequent calls to clearRect().
color
)

Implements abstract java.awt.Graphics2D.setBackground.

Sets the background color in this context used for clearing a region.

public void
setClip(int
the x coordinate of the new clip rectangle.
x
,
int
the y coordinate of the new clip rectangle.
y
,
int
the width of the new clip rectangle.
width
,
int
the height of the new clip rectangle.
height
)

Implements abstract java.awt.Graphics.setClip.

Sets the current clip to the rectangle specified by the given coordinates.

public void
setClip(Shape clip)

Implements abstract java.awt.Graphics.setClip.

Sets the current clipping area to an arbitrary clip shape.

public void
setColor(Color
the new rendering color.
c
)

Implements abstract java.awt.Graphics.setColor.

Sets this graphics context's current color to the specified color.

public void
setComposite(Composite
The Composite object to be used for drawing.
comp
)

Implements abstract java.awt.Graphics2D.setComposite.

Sets the Composite in the current graphics state.

public void
setDelegate(Graphics2D graphics)

Set the Graphics2D instance which will do the drawing.

public void
setFont(Font
the font.
font
)

Implements abstract java.awt.Graphics.setFont.

Sets this graphics context's font to the specified font.

public void
setPaint(Paint
The Paint object to be used to generate color in the rendering process.
paint
)

Implements abstract java.awt.Graphics2D.setPaint.

Sets the Paint in the current graphics state.

public void
setPaintMode()

Implements abstract java.awt.Graphics.setPaintMode.

Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color.

public void
setRenderingHint(RenderingHints.Key
The category of hint to be set.
hintCategory
,
Object
The value indicating preferences for the specified hint category.
hintValue
)

Implements abstract java.awt.Graphics2D.setRenderingHint.

Sets the preferences for the rendering algorithms.

public void
setRenderingHints(Map<?, ?>
The rendering hints to be set
hints
)

Implements abstract java.awt.Graphics2D.setRenderingHints.

Sets the preferences for the rendering algorithms.

public void
setStroke(Stroke
The Stroke object to be used to stroke a Shape in the rendering process.
s
)

Implements abstract java.awt.Graphics2D.setStroke.

Sets the Stroke in the current graphics state.

public void
setTransform(AffineTransform
The Transform object to be used in the rendering process.
Tx
)

Implements abstract java.awt.Graphics2D.setTransform.

Sets the Transform in the current graphics state.

public void
setXORMode(Color
the XOR alternation color
c1
)

Implements abstract java.awt.Graphics.setXORMode.

Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.

public void
shear(double
The factor by which coordinates are shifted towards the positive X axis direction according to their Y coordinate
shx
,
double
The factor by which coordinates are shifted towards the positive Y axis direction according to their X coordinate
shy
)

Implements abstract java.awt.Graphics2D.shear.

Concatenates the current transform of this Graphics2D with a shearing transformation.

public void
transform(AffineTransform
The Transform object to be composed with the current transform.
Tx
)

Implements abstract java.awt.Graphics2D.transform.

Composes a Transform object with the transform in this Graphics2D according to the rule last-specified-first-applied.

public void
translate(int
the x coordinate.
x
,
int
the y coordinate.
y
)

Implements abstract java.awt.Graphics2D.translate.

Translates the origin of the graphics context to the point (x, y) in the current coordinate system.

public void
translate(double tx, double ty)

Implements abstract java.awt.Graphics2D.translate.

Concatenates the current transform of this Graphics2D with a translation transformation.

Inherited from java.awt.Graphics2D:
draw3DRectfill3DRect