History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/print/ProxyGraphics.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/print/ProxyGraphics.java+1157−0
@@ -0,0 +1,1157 @@
1+/*
2+ * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * This code is free software; you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License version 2 only, as
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package sun.print;
27+
28+import java.awt.Color;
29+import java.awt.Font;
30+import java.awt.FontMetrics;
31+import java.awt.Graphics;
32+import java.awt.Image;
33+import java.awt.Polygon;
34+import java.awt.Rectangle;
35+import java.awt.Shape;
36+
37+import java.awt.image.ImageObserver;
38+
39+import java.text.AttributedCharacterIterator;
40+
41+/**
42+ * Implements the Graphics API but does all
43+ * rendering through a second Graphics instance.
44+ * The primary use of this class is to provide
45+ * a Graphics instance without the 2D API to
46+ * an application, but to implement the rendering
47+ * with a Graphics2D instance.
48+ */
49+public class ProxyGraphics extends Graphics {
50+
51+ /**
52+ * The Graphics instance that performs the
53+ * drawing for this Graphics.
54+ */
55+ private Graphics g;
56+
57+ public ProxyGraphics(Graphics graphics) {
58+ g = graphics;
59+ }
60+
61+ Graphics getGraphics() {
62+ return g;
63+ }
64+
65+ /**
66+ * Creates a new <code>Graphics</code> object that is
67+ * a copy of this <code>Graphics</code> object.
68+ * @return a new graphics context that is a copy of
69+ * this graphics context.
70+ */
71+ public Graphics create() {
72+ return new ProxyGraphics(g.create());
73+ }
74+
75+ /**
76+ * Creates a new <code>Graphics</code> object based on this
77+ * <code>Graphics</code> object, but with a new translation and clip area.
78+ * The new <code>Graphics</code> object has its origin
79+ * translated to the specified point (<i>x</i>,&nbsp;<i>y</i>).
80+ * Its clip area is determined by the intersection of the original
81+ * clip area with the specified rectangle. The arguments are all
82+ * interpreted in the coordinate system of the original
83+ * <code>Graphics</code> object. The new graphics context is
84+ * identical to the original, except in two respects:
85+ * <p>
86+ * <ul>
87+ * <li>
88+ * The new graphics context is translated by (<i>x</i>,&nbsp;<i>y</i>).
89+ * That is to say, the point (<code>0</code>,&nbsp;<code>0</code>) in the
90+ * new graphics context is the same as (<i>x</i>,&nbsp;<i>y</i>) in
91+ * the original graphics context.
92+ * <li>
93+ * The new graphics context has an additional clipping rectangle, in
94+ * addition to whatever (translated) clipping rectangle it inherited
95+ * from the original graphics context. The origin of the new clipping
96+ * rectangle is at (<code>0</code>,&nbsp;<code>0</code>), and its size
97+ * is specified by the <code>width</code> and <code>height</code>
98+ * arguments.
99+ * </ul>
100+ * <p>
101+ * @param x the <i>x</i> coordinate.
102+ * @param y the <i>y</i> coordinate.
103+ * @param width the width of the clipping rectangle.
104+ * @param height the height of the clipping rectangle.
105+ * @return a new graphics context.
106+ * @see java.awt.Graphics#translate
107+ * @see java.awt.Graphics#clipRect
108+ */
109+ public Graphics create(int x, int y, int width, int height) {
110+ return new ProxyGraphics(g.create(x, y, width, height));
111+ }
112+
113+ /**
114+ * Translates the origin of the graphics context to the point
115+ * (<i>x</i>,&nbsp;<i>y</i>) in the current coordinate system.
116+ * Modifies this graphics context so that its new origin corresponds
117+ * to the point (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's
118+ * original coordinate system. All coordinates used in subsequent
119+ * rendering operations on this graphics context will be relative
120+ * to this new origin.
121+ * @param x the <i>x</i> coordinate.
122+ * @param y the <i>y</i> coordinate.
123+ */
124+ public void translate(int x, int y) {
125+ g.translate(x, y);
126+ }
127+
128+ /**
129+ * Gets this graphics context's current color.
130+ * @return this graphics context's current color.
131+ * @see java.awt.Color
132+ * @see java.awt.Graphics#setColor
133+ */
134+ public Color getColor() {
135+ return g.getColor();
136+ }
137+
138+ /**
139+ * Sets this graphics context's current color to the specified
140+ * color. All subsequent graphics operations using this graphics
141+ * context use this specified color.
142+ * @param c the new rendering color.
143+ * @see java.awt.Color
144+ * @see java.awt.Graphics#getColor
145+ */
146+ public void setColor(Color c) {
147+ g.setColor(c);
148+ }
149+
150+ /**
151+ * Sets the paint mode of this graphics context to overwrite the
152+ * destination with this graphics context's current color.
153+ * This sets the logical pixel operation function to the paint or
154+ * overwrite mode. All subsequent rendering operations will
155+ * overwrite the destination with the current color.
156+ */
157+ public void setPaintMode() {
158+ g.setPaintMode();
159+ }
160+
161+ /**
162+ * Sets the paint mode of this graphics context to alternate between
163+ * this graphics context's current color and the new specified color.
164+ * This specifies that logical pixel operations are performed in the
165+ * XOR mode, which alternates pixels between the current color and
166+ * a specified XOR color.
167+ * <p>
168+ * When drawing operations are performed, pixels which are the
169+ * current color are changed to the specified color, and vice versa.
170+ * <p>
171+ * Pixels that are of colors other than those two colors are changed
172+ * in an unpredictable but reversible manner; if the same figure is
173+ * drawn twice, then all pixels are restored to their original values.
174+ * @param c1 the XOR alternation color
175+ */
176+ public void setXORMode(Color c1) {
177+ g.setXORMode(c1);
178+ }
179+
180+ /**
181+ * Gets the current font.
182+ * @return this graphics context's current font.
183+ * @see java.awt.Font
184+ * @see java.awt.Graphics#setFont
185+ */
186+ public Font getFont() {
187+ return g.getFont();
188+ }
189+
190+ /**
191+ * Sets this graphics context's font to the specified font.
192+ * All subsequent text operations using this graphics context
193+ * use this font.
194+ * @param font the font.
195+ * @see java.awt.Graphics#getFont
196+ * @see java.awt.Graphics#drawString(java.lang.String, int, int)
197+ * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int)
198+ * @see java.awt.Graphics#drawChars(char[], int, int, int, int)
199+ */
200+ public void setFont(Font font) {
201+ g.setFont(font);
202+ }
203+
204+ /**
205+ * Gets the font metrics of the current font.
206+ * @return the font metrics of this graphics
207+ * context's current font.
208+ * @see java.awt.Graphics#getFont
209+ * @see java.awt.FontMetrics
210+ * @see java.awt.Graphics#getFontMetrics(Font)
211+ */
212+ public FontMetrics getFontMetrics() {
213+ return g.getFontMetrics();
214+ }
215+
216+ /**
217+ * Gets the font metrics for the specified font.
218+ * @return the font metrics for the specified font.
219+ * @param f the specified font
220+ * @see java.awt.Graphics#getFont
221+ * @see java.awt.FontMetrics
222+ * @see java.awt.Graphics#getFontMetrics()
223+ */
224+ public FontMetrics getFontMetrics(Font f) {
225+ return g.getFontMetrics(f);
226+ }
227+
228+
229+ /**
230+ * Returns the bounding rectangle of the current clipping area.
231+ * This method refers to the user clip, which is independent of the
232+ * clipping associated with device bounds and window visibility.
233+ * If no clip has previously been set, or if the clip has been
234+ * cleared using <code>setClip(null)</code>, this method returns
235+ * <code>null</code>.
236+ * The coordinates in the rectangle are relative to the coordinate
237+ * system origin of this graphics context.
238+ * @return the bounding rectangle of the current clipping area,
239+ * or <code>null</code> if no clip is set.
240+ * @see java.awt.Graphics#getClip
241+ * @see java.awt.Graphics#clipRect
242+ * @see java.awt.Graphics#setClip(int, int, int, int)
243+ * @see java.awt.Graphics#setClip(Shape)
244+ * @since JDK1.1
245+ */
246+ public Rectangle getClipBounds() {
247+ return g.getClipBounds();
248+ }
249+
250+ /**
251+ * Intersects the current clip with the specified rectangle.
252+ * The resulting clipping area is the intersection of the current
253+ * clipping area and the specified rectangle. If there is no
254+ * current clipping area, either because the clip has never been
255+ * set, or the clip has been cleared using <code>setClip(null)</code>,
256+ * the specified rectangle becomes the new clip.
257+ * This method sets the user clip, which is independent of the
258+ * clipping associated with device bounds and window visibility.
259+ * This method can only be used to make the current clip smaller.
260+ * To set the current clip larger, use any of the setClip methods.
261+ * Rendering operations have no effect outside of the clipping area.
262+ * @param x the x coordinate of the rectangle to intersect the clip with
263+ * @param y the y coordinate of the rectangle to intersect the clip with
264+ * @param width the width of the rectangle to intersect the clip with
265+ * @param height the height of the rectangle to intersect the clip with
266+ * @see #setClip(int, int, int, int)
267+ * @see #setClip(Shape)
268+ */
269+ public void clipRect(int x, int y, int width, int height) {
270+ g.clipRect(x, y, width, height);
271+ }
272+
273+ /**
274+ * Sets the current clip to the rectangle specified by the given
275+ * coordinates. This method sets the user clip, which is
276+ * independent of the clipping associated with device bounds
277+ * and window visibility.
278+ * Rendering operations have no effect outside of the clipping area.
279+ * @param x the <i>x</i> coordinate of the new clip rectangle.
280+ * @param y the <i>y</i> coordinate of the new clip rectangle.
281+ * @param width the width of the new clip rectangle.
282+ * @param height the height of the new clip rectangle.
283+ * @see java.awt.Graphics#clipRect
284+ * @see java.awt.Graphics#setClip(Shape)
285+ * @since JDK1.1
286+ */
287+ public void setClip(int x, int y, int width, int height) {
288+ g.setClip(x, y, width, height);
289+ }
290+
291+ /**
292+ * Gets the current clipping area.
293+ * This method returns the user clip, which is independent of the
294+ * clipping associated with device bounds and window visibility.
295+ * If no clip has previously been set, or if the clip has been
296+ * cleared using <code>setClip(null)</code>, this method returns
297+ * <code>null</code>.
298+ * @return a <code>Shape</code> object representing the
299+ * current clipping area, or <code>null</code> if
300+ * no clip is set.
301+ * @see java.awt.Graphics#getClipBounds
302+ * @see java.awt.Graphics#clipRect
303+ * @see java.awt.Graphics#setClip(int, int, int, int)
304+ * @see java.awt.Graphics#setClip(Shape)
305+ * @since JDK1.1
306+ */
307+ public Shape getClip() {
308+ return g.getClip();
309+ }
310+
311+ /**
312+ * Sets the current clipping area to an arbitrary clip shape.
313+ * Not all objects that implement the <code>Shape</code>
314+ * interface can be used to set the clip. The only
315+ * <code>Shape</code> objects that are guaranteed to be
316+ * supported are <code>Shape</code> objects that are
317+ * obtained via the <code>getClip</code> method and via
318+ * <code>Rectangle</code> objects. This method sets the
319+ * user clip, which is independent of the clipping associated
320+ * with device bounds and window visibility.
321+ * @param clip the <code>Shape</code> to use to set the clip
322+ * @see java.awt.Graphics#getClip()
323+ * @see java.awt.Graphics#clipRect
324+ * @see java.awt.Graphics#setClip(int, int, int, int)
325+ * @since JDK1.1
326+ */
327+ public void setClip(Shape clip) {
328+ g.setClip(clip);
329+ }
330+
331+ /**
332+ * Copies an area of the component by a distance specified by
333+ * <code>dx</code> and <code>dy</code>. From the point specified
334+ * by <code>x</code> and <code>y</code>, this method
335+ * copies downwards and to the right. To copy an area of the
336+ * component to the left or upwards, specify a negative value for
337+ * <code>dx</code> or <code>dy</code>.
338+ * If a portion of the source rectangle lies outside the bounds
339+ * of the component, or is obscured by another window or component,
340+ * <code>copyArea</code> will be unable to copy the associated
341+ * pixels. The area that is omitted can be refreshed by calling
342+ * the component's <code>paint</code> method.
343+ * @param x the <i>x</i> coordinate of the source rectangle.
344+ * @param y the <i>y</i> coordinate of the source rectangle.
345+ * @param width the width of the source rectangle.
346+ * @param height the height of the source rectangle.
347+ * @param dx the horizontal distance to copy the pixels.
348+ * @param dy the vertical distance to copy the pixels.
349+ */
350+ public void copyArea(int x, int y, int width, int height,
351+ int dx, int dy) {
352+ g.copyArea(x, y, width, height, dx, dy);
353+ }
354+
355+ /**
356+ * Draws a line, using the current color, between the points
357+ * <code>(x1,&nbsp;y1)</code> and <code>(x2,&nbsp;y2)</code>
358+ * in this graphics context's coordinate system.
359+ * @param x1 the first point's <i>x</i> coordinate.
360+ * @param y1 the first point's <i>y</i> coordinate.
361+ * @param x2 the second point's <i>x</i> coordinate.
362+ * @param y2 the second point's <i>y</i> coordinate.
363+ */
364+ public void drawLine(int x1, int y1, int x2, int y2) {
365+ g.drawLine(x1, y1, x2, y2);
366+ }
367+
368+ /**
369+ * Fills the specified rectangle.
370+ * The left and right edges of the rectangle are at
371+ * <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>.
372+ * The top and bottom edges are at
373+ * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.
374+ * The resulting rectangle covers an area
375+ * <code>width</code> pixels wide by
376+ * <code>height</code> pixels tall.
377+ * The rectangle is filled using the graphics context's current color.
378+ * @param x the <i>x</i> coordinate
379+ * of the rectangle to be filled.
380+ * @param y the <i>y</i> coordinate
381+ * of the rectangle to be filled.
382+ * @param width the width of the rectangle to be filled.
383+ * @param height the height of the rectangle to be filled.
384+ * @see java.awt.Graphics#clearRect
385+ * @see java.awt.Graphics#drawRect
386+ */
387+ public void fillRect(int x, int y, int width, int height) {
388+ g.fillRect(x, y, width, height);
389+ }
390+
391+ /**
392+ * Draws the outline of the specified rectangle.
393+ * The left and right edges of the rectangle are at
394+ * <code>x</code> and <code>x&nbsp;+&nbsp;width</code>.
395+ * The top and bottom edges are at
396+ * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.
397+ * The rectangle is drawn using the graphics context's current color.
398+ * @param x the <i>x</i> coordinate
399+ * of the rectangle to be drawn.
400+ * @param y the <i>y</i> coordinate
401+ * of the rectangle to be drawn.
402+ * @param width the width of the rectangle to be drawn.
403+ * @param height the height of the rectangle to be drawn.
404+ * @see java.awt.Graphics#fillRect
405+ * @see java.awt.Graphics#clearRect
406+ */
407+ public void drawRect(int x, int y, int width, int height) {
408+ g.drawRect(x, y, width, height);
409+ }
410+
411+ /**
412+ * Clears the specified rectangle by filling it with the background
413+ * color of the current drawing surface. This operation does not
414+ * use the current paint mode.
415+ * <p>
416+ * Beginning with Java&nbsp;1.1, the background color
417+ * of offscreen images may be system dependent. Applications should
418+ * use <code>setColor</code> followed by <code>fillRect</code> to
419+ * ensure that an offscreen image is cleared to a specific color.
420+ * @param x the <i>x</i> coordinate of the rectangle to clear.
421+ * @param y the <i>y</i> coordinate of the rectangle to clear.
422+ * @param width the width of the rectangle to clear.
423+ * @param height the height of the rectangle to clear.
424+ * @see java.awt.Graphics#fillRect(int, int, int, int)
425+ * @see java.awt.Graphics#drawRect
426+ * @see java.awt.Graphics#setColor(java.awt.Color)
427+ * @see java.awt.Graphics#setPaintMode
428+ * @see java.awt.Graphics#setXORMode(java.awt.Color)
429+ */
430+ public void clearRect(int x, int y, int width, int height) {
431+ g.clearRect(x, y, width, height);
432+ }
433+
434+ /**
435+ * Draws an outlined round-cornered rectangle using this graphics
436+ * context's current color. The left and right edges of the rectangle
437+ * are at <code>x</code> and <code>x&nbsp;+&nbsp;width</code>,
438+ * respectively. The top and bottom edges of the rectangle are at
439+ * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.
440+ * @param x the <i>x</i> coordinate of the rectangle to be drawn.
441+ * @param y the <i>y</i> coordinate of the rectangle to be drawn.
442+ * @param width the width of the rectangle to be drawn.
443+ * @param height the height of the rectangle to be drawn.
444+ * @param arcWidth the horizontal diameter of the arc
445+ * at the four corners.
446+ * @param arcHeight the vertical diameter of the arc
447+ * at the four corners.
448+ * @see java.awt.Graphics#fillRoundRect
449+ */
450+ public void drawRoundRect(int x, int y, int width, int height,
451+ int arcWidth, int arcHeight) {
452+ g.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
453+ }
454+
455+ /**
456+ * Fills the specified rounded corner rectangle with the current color.
457+ * The left and right edges of the rectangle
458+ * are at <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>,
459+ * respectively. The top and bottom edges of the rectangle are at
460+ * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.
461+ * @param x the <i>x</i> coordinate of the rectangle to be filled.
462+ * @param y the <i>y</i> coordinate of the rectangle to be filled.
463+ * @param width the width of the rectangle to be filled.
464+ * @param height the height of the rectangle to be filled.
465+ * @param arcWidth the horizontal diameter
466+ * of the arc at the four corners.
467+ * @param arcHeight the vertical diameter
468+ * of the arc at the four corners.
469+ * @see java.awt.Graphics#drawRoundRect
470+ */
471+ public void fillRoundRect(int x, int y, int width, int height,
472+ int arcWidth, int arcHeight) {
473+ g.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
474+ }
475+
476+ /**
477+ * Draws a 3-D highlighted outline of the specified rectangle.
478+ * The edges of the rectangle are highlighted so that they
479+ * appear to be beveled and lit from the upper left corner.
480+ * <p>
481+ * The colors used for the highlighting effect are determined
482+ * based on the current color.
483+ * The resulting rectangle covers an area that is
484+ * <code>width&nbsp;+&nbsp;1</code> pixels wide
485+ * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
486+ * @param x the <i>x</i> coordinate of the rectangle to be drawn.
487+ * @param y the <i>y</i> coordinate of the rectangle to be drawn.
488+ * @param width the width of the rectangle to be drawn.
489+ * @param height the height of the rectangle to be drawn.
490+ * @param raised a boolean that determines whether the rectangle
491+ * appears to be raised above the surface
492+ * or sunk into the surface.
493+ * @see java.awt.Graphics#fill3DRect
494+ */
495+ public void draw3DRect(int x, int y, int width, int height,
496+ boolean raised) {
497+ g.draw3DRect(x, y, width, height, raised);
498+ }
499+
500+ /**
501+ * Paints a 3-D highlighted rectangle filled with the current color.
502+ * The edges of the rectangle will be highlighted so that it appears
503+ * as if the edges were beveled and lit from the upper left corner.
504+ * The colors used for the highlighting effect will be determined from
505+ * the current color.
506+ * @param x the <i>x</i> coordinate of the rectangle to be filled.
507+ * @param y the <i>y</i> coordinate of the rectangle to be filled.
508+ * @param width the width of the rectangle to be filled.
509+ * @param height the height of the rectangle to be filled.
510+ * @param raised a boolean value that determines whether the
511+ * rectangle appears to be raised above the surface
512+ * or etched into the surface.
513+ * @see java.awt.Graphics#draw3DRect
514+ */
515+ public void fill3DRect(int x, int y, int width, int height,
516+ boolean raised) {
517+ g.fill3DRect(x, y, width, height, raised);
518+ }
519+
520+ /**
521+ * Draws the outline of an oval.
522+ * The result is a circle or ellipse that fits within the
523+ * rectangle specified by the <code>x</code>, <code>y</code>,
524+ * <code>width</code>, and <code>height</code> arguments.
525+ * <p>
526+ * The oval covers an area that is
527+ * <code>width&nbsp;+&nbsp;1</code> pixels wide
528+ * and <code>height&nbsp;+&nbsp;1</code> pixels tall.
529+ * @param x the <i>x</i> coordinate of the upper left
530+ * corner of the oval to be drawn.
531+ * @param y the <i>y</i> coordinate of the upper left
532+ * corner of the oval to be drawn.
533+ * @param width the width of the oval to be drawn.
534+ * @param height the height of the oval to be drawn.
535+ * @see java.awt.Graphics#fillOval
536+ */
537+ public void drawOval(int x, int y, int width, int height) {
538+ g.drawOval(x, y, width, height);
539+ }
540+
541+ /**
542+ * Fills an oval bounded by the specified rectangle with the
543+ * current color.
544+ * @param x the <i>x</i> coordinate of the upper left corner
545+ * of the oval to be filled.
546+ * @param y the <i>y</i> coordinate of the upper left corner
547+ * of the oval to be filled.
548+ * @param width the width of the oval to be filled.
549+ * @param height the height of the oval to be filled.
550+ * @see java.awt.Graphics#drawOval
551+ */
552+ public void fillOval(int x, int y, int width, int height) {
553+ g.fillOval(x, y, width, height);
554+ }
555+
556+ /**
557+ * Draws the outline of a circular or elliptical arc
558+ * covering the specified rectangle.
559+ * <p>
560+ * The resulting arc begins at <code>startAngle</code> and extends
561+ * for <code>arcAngle</code> degrees, using the current color.
562+ * Angles are interpreted such that 0&nbsp;degrees
563+ * is at the 3&nbsp;o'clock position.
564+ * A positive value indicates a counter-clockwise rotation
565+ * while a negative value indicates a clockwise rotation.
566+ * <p>
567+ * The center of the arc is the center of the rectangle whose origin
568+ * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
569+ * <code>width</code> and <code>height</code> arguments.
570+ * <p>
571+ * The resulting arc covers an area
572+ * <code>width&nbsp;+&nbsp;1</code> pixels wide
573+ * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
574+ * <p>
575+ * The angles are specified relative to the non-square extents of
576+ * the bounding rectangle such that 45 degrees always falls on the
577+ * line from the center of the ellipse to the upper right corner of
578+ * the bounding rectangle. As a result, if the bounding rectangle is
579+ * noticeably longer in one axis than the other, the angles to the
580+ * start and end of the arc segment will be skewed farther along the
581+ * longer axis of the bounds.
582+ * @param x the <i>x</i> coordinate of the
583+ * upper-left corner of the arc to be drawn.
584+ * @param y the <i>y</i> coordinate of the
585+ * upper-left corner of the arc to be drawn.
586+ * @param width the width of the arc to be drawn.
587+ * @param height the height of the arc to be drawn.
588+ * @param startAngle the beginning angle.
589+ * @param arcAngle the angular extent of the arc,
590+ * relative to the start angle.
591+ * @see java.awt.Graphics#fillArc
592+ */
593+ public void drawArc(int x, int y, int width, int height,
594+ int startAngle, int arcAngle) {
595+ g.drawArc(x, y, width, height, startAngle, arcAngle);
596+ }
597+
598+ /**
599+ * Fills a circular or elliptical arc covering the specified rectangle.
600+ * <p>
601+ * The resulting arc begins at <code>startAngle</code> and extends
602+ * for <code>arcAngle</code> degrees.
603+ * Angles are interpreted such that 0&nbsp;degrees
604+ * is at the 3&nbsp;o'clock position.
605+ * A positive value indicates a counter-clockwise rotation
606+ * while a negative value indicates a clockwise rotation.
607+ * <p>
608+ * The center of the arc is the center of the rectangle whose origin
609+ * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
610+ * <code>width</code> and <code>height</code> arguments.
611+ * <p>
612+ * The resulting arc covers an area
613+ * <code>width&nbsp;+&nbsp;1</code> pixels wide
614+ * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
615+ * <p>
616+ * The angles are specified relative to the non-square extents of
617+ * the bounding rectangle such that 45 degrees always falls on the
618+ * line from the center of the ellipse to the upper right corner of
619+ * the bounding rectangle. As a result, if the bounding rectangle is
620+ * noticeably longer in one axis than the other, the angles to the
621+ * start and end of the arc segment will be skewed farther along the
622+ * longer axis of the bounds.
623+ * @param x the <i>x</i> coordinate of the
624+ * upper-left corner of the arc to be filled.
625+ * @param y the <i>y</i> coordinate of the
626+ * upper-left corner of the arc to be filled.
627+ * @param width the width of the arc to be filled.
628+ * @param height the height of the arc to be filled.
629+ * @param startAngle the beginning angle.
630+ * @param arcAngle the angular extent of the arc,
631+ * relative to the start angle.
632+ * @see java.awt.Graphics#drawArc
633+ */
634+ public void fillArc(int x, int y, int width, int height,
635+ int startAngle, int arcAngle) {
636+
637+ g.fillArc(x, y, width, height, startAngle, arcAngle);
638+ }
639+
640+ /**
641+ * Draws a sequence of connected lines defined by
642+ * arrays of <i>x</i> and <i>y</i> coordinates.
643+ * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.
644+ * The figure is not closed if the first point
645+ * differs from the last point.
646+ * @param xPoints an array of <i>x</i> points
647+ * @param yPoints an array of <i>y</i> points
648+ * @param nPoints the total number of points
649+ * @see java.awt.Graphics#drawPolygon(int[], int[], int)
650+ * @since JDK1.1
651+ */
652+ public void drawPolyline(int xPoints[], int yPoints[],
653+ int nPoints) {
654+ g.drawPolyline(xPoints, yPoints, nPoints);
655+ }
656+
657+ /**
658+ * Draws a closed polygon defined by
659+ * arrays of <i>x</i> and <i>y</i> coordinates.
660+ * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.
661+ * <p>
662+ * This method draws the polygon defined by <code>nPoint</code> line
663+ * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>
664+ * line segments are line segments from
665+ * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>
666+ * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for
667+ * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.
668+ * The figure is automatically closed by drawing a line connecting
669+ * the final point to the first point, if those points are different.
670+ * @param xPoints a an array of <code>x</code> coordinates.
671+ * @param yPoints a an array of <code>y</code> coordinates.
672+ * @param nPoints a the total number of points.
673+ * @see java.awt.Graphics#fillPolygon
674+ * @see java.awt.Graphics#drawPolyline
675+ */
676+ public void drawPolygon(int xPoints[], int yPoints[],
677+ int nPoints) {
678+ g.drawPolygon(xPoints, yPoints, nPoints);
679+ }
680+
681+ /**
682+ * Draws the outline of a polygon defined by the specified
683+ * <code>Polygon</code> object.
684+ * @param p the polygon to draw.
685+ * @see java.awt.Graphics#fillPolygon
686+ * @see java.awt.Graphics#drawPolyline
687+ */
688+ public void drawPolygon(Polygon p) {
689+ g.drawPolygon(p);
690+ }
691+
692+ /**
693+ * Fills a closed polygon defined by
694+ * arrays of <i>x</i> and <i>y</i> coordinates.
695+ * <p>
696+ * This method draws the polygon defined by <code>nPoint</code> line
697+ * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>
698+ * line segments are line segments from
699+ * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>
700+ * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for
701+ * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.
702+ * The figure is automatically closed by drawing a line connecting
703+ * the final point to the first point, if those points are different.
704+ * <p>
705+ * The area inside the polygon is defined using an
706+ * even-odd fill rule, also known as the alternating rule.
707+ * @param xPoints a an array of <code>x</code> coordinates.
708+ * @param yPoints a an array of <code>y</code> coordinates.
709+ * @param nPoints a the total number of points.
710+ * @see java.awt.Graphics#drawPolygon(int[], int[], int)
711+ */
712+ public void fillPolygon(int xPoints[], int yPoints[],
713+ int nPoints) {
714+ g.fillPolygon(xPoints, yPoints, nPoints);
715+ }
716+
717+ /**
718+ * Fills the polygon defined by the specified Polygon object with
719+ * the graphics context's current color.
720+ * <p>
721+ * The area inside the polygon is defined using an
722+ * even-odd fill rule, also known as the alternating rule.
723+ * @param p the polygon to fill.
724+ * @see java.awt.Graphics#drawPolygon(int[], int[], int)
725+ */
726+ public void fillPolygon(Polygon p) {
727+ g.fillPolygon(p);
728+ }
729+
730+ /**
731+ * Draws the text given by the specified string, using this
732+ * graphics context's current font and color. The baseline of the
733+ * leftmost character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
734+ * graphics context's coordinate system.
735+ * @param str the string to be drawn.
736+ * @param x the <i>x</i> coordinate.
737+ * @param y the <i>y</i> coordinate.
738+ * @see java.awt.Graphics#drawBytes
739+ * @see java.awt.Graphics#drawChars
740+ */
741+ public void drawString(String str, int x, int y) {
742+ g.drawString(str, x, y);
743+ }
744+
745+ /**
746+ * Draws the text given by the specified iterator, using this
747+ * graphics context's current color. The iterator has to specify a font
748+ * for each character. The baseline of the
749+ * leftmost character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
750+ * graphics context's coordinate system.
751+ * @param iterator the iterator whose text is to be drawn
752+ * @param x the <i>x</i> coordinate.
753+ * @param y the <i>y</i> coordinate.
754+ * @see java.awt.Graphics#drawBytes
755+ * @see java.awt.Graphics#drawChars
756+ */
757+ public void drawString(AttributedCharacterIterator iterator,
758+ int x, int y) {
759+ g.drawString(iterator, x, y);
760+ }
761+
762+ /**
763+ * Draws the text given by the specified character array, using this
764+ * graphics context's current font and color. The baseline of the
765+ * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
766+ * graphics context's coordinate system.
767+ * @param data the array of characters to be drawn
768+ * @param offset the start offset in the data
769+ * @param length the number of characters to be drawn
770+ * @param x the <i>x</i> coordinate of the baseline of the text
771+ * @param y the <i>y</i> coordinate of the baseline of the text
772+ * @see java.awt.Graphics#drawBytes
773+ * @see java.awt.Graphics#drawString
774+ */
775+ public void drawChars(char data[], int offset, int length, int x, int y) {
776+ g.drawChars(data, offset, length, x, y);
777+ }
778+
779+ /**
780+ * Draws the text given by the specified byte array, using this
781+ * graphics context's current font and color. The baseline of the
782+ * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
783+ * graphics context's coordinate system.
784+ * @param data the data to be drawn
785+ * @param offset the start offset in the data
786+ * @param length the number of bytes that are drawn
787+ * @param x the <i>x</i> coordinate of the baseline of the text
788+ * @param y the <i>y</i> coordinate of the baseline of the text
789+ * @see java.awt.Graphics#drawChars
790+ * @see java.awt.Graphics#drawString
791+ */
792+ public void drawBytes(byte data[], int offset, int length, int x, int y) {
793+ g.drawBytes(data, offset, length, x, y);
794+ }
795+
796+ /**
797+ * Draws as much of the specified image as is currently available.
798+ * The image is drawn with its top-left corner at
799+ * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate
800+ * space. Transparent pixels in the image do not affect whatever
801+ * pixels are already there.
802+ * <p>
803+ * This method returns immediately in all cases, even if the
804+ * complete image has not yet been loaded, and it has not been dithered
805+ * and converted for the current output device.
806+ * <p>
807+ * If the image has not yet been completely loaded, then
808+ * <code>drawImage</code> returns <code>false</code>. As more of
809+ * the image becomes available, the process that draws the image notifies
810+ * the specified image observer.
811+ * @param img the specified image to be drawn.
812+ * @param x the <i>x</i> coordinate.
813+ * @param y the <i>y</i> coordinate.
814+ * @param observer object to be notified as more of
815+ * the image is converted.
816+ * @see java.awt.Image
817+ * @see java.awt.image.ImageObserver
818+ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
819+ */
820+ public boolean drawImage(Image img, int x, int y,
821+ ImageObserver observer) {
822+ return g.drawImage(img, x, y, observer);
823+ }
824+
825+ /**
826+ * Draws as much of the specified image as has already been scaled
827+ * to fit inside the specified rectangle.
828+ * <p>
829+ * The image is drawn inside the specified rectangle of this
830+ * graphics context's coordinate space, and is scaled if
831+ * necessary. Transparent pixels do not affect whatever pixels
832+ * are already there.
833+ * <p>
834+ * This method returns immediately in all cases, even if the
835+ * entire image has not yet been scaled, dithered, and converted
836+ * for the current output device.
837+ * If the current output representation is not yet complete, then
838+ * <code>drawImage</code> returns <code>false</code>. As more of
839+ * the image becomes available, the process that draws the image notifies
840+ * the image observer by calling its <code>imageUpdate</code> method.
841+ * <p>
842+ * A scaled version of an image will not necessarily be
843+ * available immediately just because an unscaled version of the
844+ * image has been constructed for this output device. Each size of
845+ * the image may be cached separately and generated from the original
846+ * data in a separate image production sequence.
847+ * @param img the specified image to be drawn.
848+ * @param x the <i>x</i> coordinate.
849+ * @param y the <i>y</i> coordinate.
850+ * @param width the width of the rectangle.
851+ * @param height the height of the rectangle.
852+ * @param observer object to be notified as more of
853+ * the image is converted.
854+ * @see java.awt.Image
855+ * @see java.awt.image.ImageObserver
856+ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
857+ */
858+ public boolean drawImage(Image img, int x, int y,
859+ int width, int height,
860+ ImageObserver observer) {
861+ return g.drawImage(img, x, y, width, height, observer);
862+ }
863+
864+ /**
865+ * Draws as much of the specified image as is currently available.
866+ * The image is drawn with its top-left corner at
867+ * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate
868+ * space. Transparent pixels are drawn in the specified
869+ * background color.
870+ * <p>
871+ * This operation is equivalent to filling a rectangle of the
872+ * width and height of the specified image with the given color and then
873+ * drawing the image on top of it, but possibly more efficient.
874+ * <p>
875+ * This method returns immediately in all cases, even if the
876+ * complete image has not yet been loaded, and it has not been dithered
877+ * and converted for the current output device.
878+ * <p>
879+ * If the image has not yet been completely loaded, then
880+ * <code>drawImage</code> returns <code>false</code>. As more of
881+ * the image becomes available, the process that draws the image notifies
882+ * the specified image observer.
883+ * @param img the specified image to be drawn.
884+ * @param x the <i>x</i> coordinate.
885+ * @param y the <i>y</i> coordinate.
886+ * @param bgcolor the background color to paint under the
887+ * non-opaque portions of the image.
888+ * @param observer object to be notified as more of
889+ * the image is converted.
890+ * @see java.awt.Image
891+ * @see java.awt.image.ImageObserver
892+ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
893+ */
894+ public boolean drawImage(Image img, int x, int y,
895+ Color bgcolor,
896+ ImageObserver observer) {
897+ return g.drawImage(img, x, y, bgcolor, observer);
898+ }
899+
900+ /**
901+ * Draws as much of the specified image as has already been scaled
902+ * to fit inside the specified rectangle.
903+ * <p>
904+ * The image is drawn inside the specified rectangle of this
905+ * graphics context's coordinate space, and is scaled if
906+ * necessary. Transparent pixels are drawn in the specified
907+ * background color.
908+ * This operation is equivalent to filling a rectangle of the
909+ * width and height of the specified image with the given color and then
910+ * drawing the image on top of it, but possibly more efficient.
911+ * <p>
912+ * This method returns immediately in all cases, even if the
913+ * entire image has not yet been scaled, dithered, and converted
914+ * for the current output device.
915+ * If the current output representation is not yet complete then
916+ * <code>drawImage</code> returns <code>false</code>. As more of
917+ * the image becomes available, the process that draws the image notifies
918+ * the specified image observer.
919+ * <p>
920+ * A scaled version of an image will not necessarily be
921+ * available immediately just because an unscaled version of the
922+ * image has been constructed for this output device. Each size of
923+ * the image may be cached separately and generated from the original
924+ * data in a separate image production sequence.
925+ * @param img the specified image to be drawn.
926+ * @param x the <i>x</i> coordinate.
927+ * @param y the <i>y</i> coordinate.
928+ * @param width the width of the rectangle.
929+ * @param height the height of the rectangle.
930+ * @param bgcolor the background color to paint under the
931+ * non-opaque portions of the image.
932+ * @param observer object to be notified as more of
933+ * the image is converted.
934+ * @see java.awt.Image
935+ * @see java.awt.image.ImageObserver
936+ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
937+ */
938+ public boolean drawImage(Image img, int x, int y,
939+ int width, int height,
940+ Color bgcolor,
941+ ImageObserver observer) {
942+
943+ return g.drawImage(img, x, y, width, height, bgcolor, observer);
944+ }
945+
946+ /**
947+ * Draws as much of the specified area of the specified image as is
948+ * currently available, scaling it on the fly to fit inside the
949+ * specified area of the destination drawable surface. Transparent pixels
950+ * do not affect whatever pixels are already there.
951+ * <p>
952+ * This method returns immediately in all cases, even if the
953+ * image area to be drawn has not yet been scaled, dithered, and converted
954+ * for the current output device.
955+ * If the current output representation is not yet complete then
956+ * <code>drawImage</code> returns <code>false</code>. As more of
957+ * the image becomes available, the process that draws the image notifies
958+ * the specified image observer.
959+ * <p>
960+ * This method always uses the unscaled version of the image
961+ * to render the scaled rectangle and performs the required
962+ * scaling on the fly. It does not use a cached, scaled version
963+ * of the image for this operation. Scaling of the image from source
964+ * to destination is performed such that the first coordinate
965+ * of the source rectangle is mapped to the first coordinate of
966+ * the destination rectangle, and the second source coordinate is
967+ * mapped to the second destination coordinate. The subimage is
968+ * scaled and flipped as needed to preserve those mappings.
969+ * @param img the specified image to be drawn
970+ * @param dx1 the <i>x</i> coordinate of the first corner of the
971+ * destination rectangle.
972+ * @param dy1 the <i>y</i> coordinate of the first corner of the
973+ * destination rectangle.
974+ * @param dx2 the <i>x</i> coordinate of the second corner of the
975+ * destination rectangle.
976+ * @param dy2 the <i>y</i> coordinate of the second corner of the
977+ * destination rectangle.
978+ * @param sx1 the <i>x</i> coordinate of the first corner of the
979+ * source rectangle.
980+ * @param sy1 the <i>y</i> coordinate of the first corner of the
981+ * source rectangle.
982+ * @param sx2 the <i>x</i> coordinate of the second corner of the
983+ * source rectangle.
984+ * @param sy2 the <i>y</i> coordinate of the second corner of the
985+ * source rectangle.
986+ * @param observer object to be notified as more of the image is
987+ * scaled and converted.
988+ * @see java.awt.Image
989+ * @see java.awt.image.ImageObserver
990+ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
991+ * @since JDK1.1
992+ */
993+ public boolean drawImage(Image img,
994+ int dx1, int dy1, int dx2, int dy2,
995+ int sx1, int sy1, int sx2, int sy2,
996+ ImageObserver observer) {
997+
998+ return g.drawImage(img, dx1, dy1, dx2, dy2,
999+ sx1, sy1, sx2, sy2,
1000+ observer);
1001+ }
1002+
1003+ /**
1004+ * Draws as much of the specified area of the specified image as is
1005+ * currently available, scaling it on the fly to fit inside the
1006+ * specified area of the destination drawable surface.
1007+ * <p>
1008+ * Transparent pixels are drawn in the specified background color.
1009+ * This operation is equivalent to filling a rectangle of the
1010+ * width and height of the specified image with the given color and then
1011+ * drawing the image on top of it, but possibly more efficient.
1012+ * <p>
1013+ * This method returns immediately in all cases, even if the
1014+ * image area to be drawn has not yet been scaled, dithered, and converted
1015+ * for the current output device.
1016+ * If the current output representation is not yet complete then
1017+ * <code>drawImage</code> returns <code>false</code>. As more of
1018+ * the image becomes available, the process that draws the image notifies
1019+ * the specified image observer.
1020+ * <p>
1021+ * This method always uses the unscaled version of the image
1022+ * to render the scaled rectangle and performs the required
1023+ * scaling on the fly. It does not use a cached, scaled version
1024+ * of the image for this operation. Scaling of the image from source
1025+ * to destination is performed such that the first coordinate
1026+ * of the source rectangle is mapped to the first coordinate of
1027+ * the destination rectangle, and the second source coordinate is
1028+ * mapped to the second destination coordinate. The subimage is
1029+ * scaled and flipped as needed to preserve those mappings.
1030+ * @param img the specified image to be drawn
1031+ * @param dx1 the <i>x</i> coordinate of the first corner of the
1032+ * destination rectangle.
1033+ * @param dy1 the <i>y</i> coordinate of the first corner of the
1034+ * destination rectangle.
1035+ * @param dx2 the <i>x</i> coordinate of the second corner of the
1036+ * destination rectangle.
1037+ * @param dy2 the <i>y</i> coordinate of the second corner of the
1038+ * destination rectangle.
1039+ * @param sx1 the <i>x</i> coordinate of the first corner of the
1040+ * source rectangle.
1041+ * @param sy1 the <i>y</i> coordinate of the first corner of the
1042+ * source rectangle.
1043+ * @param sx2 the <i>x</i> coordinate of the second corner of the
1044+ * source rectangle.
1045+ * @param sy2 the <i>y</i> coordinate of the second corner of the
1046+ * source rectangle.
1047+ * @param bgcolor the background color to paint under the
1048+ * non-opaque portions of the image.
1049+ * @param observer object to be notified as more of the image is
1050+ * scaled and converted.
1051+ * @see java.awt.Image
1052+ * @see java.awt.image.ImageObserver
1053+ * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
1054+ * @since JDK1.1
1055+ */
1056+ public boolean drawImage(Image img,
1057+ int dx1, int dy1, int dx2, int dy2,
1058+ int sx1, int sy1, int sx2, int sy2,
1059+ Color bgcolor,
1060+ ImageObserver observer) {
1061+
1062+ return g.drawImage(img, dx1, dy1, dx2, dy2,
1063+ sx1, sy1, sx2, sy2,
1064+ bgcolor,
1065+ observer);
1066+ }
1067+
1068+ /**
1069+ * Disposes of this graphics context and releases
1070+ * any system resources that it is using.
1071+ * A <code>Graphics</code> object cannot be used after
1072+ * <code>dispose</code>has been called.
1073+ * <p>
1074+ * When a Java program runs, a large number of <code>Graphics</code>
1075+ * objects can be created within a short time frame.
1076+ * Although the finalization process of the garbage collector
1077+ * also disposes of the same system resources, it is preferable
1078+ * to manually free the associated resources by calling this
1079+ * method rather than to rely on a finalization process which
1080+ * may not run to completion for a long period of time.
1081+ * <p>
1082+ * Graphics objects which are provided as arguments to the
1083+ * <code>paint</code> and <code>update</code> methods
1084+ * of components are automatically released by the system when
1085+ * those methods return. For efficiency, programmers should
1086+ * call <code>dispose</code> when finished using
1087+ * a <code>Graphics</code> object only if it was created
1088+ * directly from a component or another <code>Graphics</code> object.
1089+ * @see java.awt.Graphics#finalize
1090+ * @see java.awt.Component#paint
1091+ * @see java.awt.Component#update
1092+ * @see java.awt.Component#getGraphics
1093+ * @see java.awt.Graphics#create
1094+ */
1095+ public void dispose() {
1096+ g.dispose();
1097+ }
1098+
1099+ /**
1100+ * Empty finalizer as no clean up needed here.
1101+ */
1102+ public void finalize() {
1103+ }
1104+
1105+ /**
1106+ * Returns a <code>String</code> object representing this
1107+ * <code>Graphics</code> object's value.
1108+ * @return a string representation of this graphics context.
1109+ */
1110+ public String toString() {
1111+ return getClass().getName() + "[font=" + getFont() + ",color=" + getColor() + "]";
1112+ }
1113+
1114+ /**
1115+ * @deprecated As of JDK version 1.1,
1116+ * replaced by <code>getClipBounds()</code>.
1117+ */
1118+ @Deprecated
1119+ public Rectangle getClipRect() {
1120+ return g.getClipRect();
1121+ }
1122+
1123+ /**
1124+ * Returns true if the specified rectangular area intersects
1125+ * the bounding rectangle of the current clipping area.
1126+ * The coordinates in the rectangle are relative to the coordinate
1127+ * system origin of this graphics context.
1128+ *
1129+ * @param x the x coordinate of the rectangle to test against the clip
1130+ * @param y the y coordinate of the rectangle to test against the clip
1131+ * @param width the width of the rectangle to test against the clip
1132+ * @param height the height of the rectangle to test against the clip
1133+ */
1134+ public boolean hitClip(int x, int y, int width, int height) {
1135+ return g.hitClip(x, y, width, height);
1136+ }
1137+
1138+ /**
1139+ * Returns the bounding rectangle of the current clipping area.
1140+ * The coordinates in the rectangle are relative to the coordinate
1141+ * system origin of this graphics context. This method differs
1142+ * from {@link #getClipBounds() getClipBounds} in that an existing
1143+ * rectangle is used instead of allocating a new one.
1144+ * This method refers to the user clip, which is independent of the
1145+ * clipping associated with device bounds and window visibility.
1146+ * If no clip has previously been set, or if the clip has been
1147+ * cleared using <code>setClip(null)</code>, this method returns the
1148+ * specified <code>Rectangle</code>.
1149+ * @param r the rectangle where the current clipping area is
1150+ * copied to. Any current values in this rectangle are
1151+ * overwritten.
1152+ * @return the bounding rectangle of the current clipping area.
1153+ */
1154+ public Rectangle getClipBounds(Rectangle r) {
1155+ return g.getClipBounds(r);
1156+ }
1157+}