public final class

SunGraphics2D

extends Graphics2D
implements Cloneable ConstrainableGraphics
java.lang.Object
   ↳ java.awt.Graphics
     ↳ java.awt.Graphics2D
       ↳ sun.java2d.SunGraphics2D

Class Overview

This is a the master Graphics2D superclass for all of the Sun Graphics implementations. This class relies on subclasses to manage the various device information, but provides an overall general framework for performing all of the requests in the Graphics and Graphics2D APIs.

Summary

Constants
int CLIP_DEVICE
int CLIP_RECTANGULAR
int CLIP_SHAPE
int COMP_ALPHA
int COMP_CUSTOM
int COMP_ISCOPY
int COMP_XOR
double MinPenSizeSquared
int PAINT_ALPHACOLOR
int PAINT_CUSTOM
int PAINT_GRADIENT
int PAINT_LIN_GRADIENT
int PAINT_OPAQUECOLOR
int PAINT_RAD_GRADIENT
int PAINT_TEXTURE
int STROKE_CUSTOM
int STROKE_THIN
int STROKE_THINDASHED
int STROKE_WIDE
int TRANSFORM_ANY_TRANSLATE
int TRANSFORM_GENERIC
int TRANSFORM_INT_TRANSLATE
int TRANSFORM_ISIDENT
int TRANSFORM_TRANSLATESCALE
Fields
public static final double MinPenSizeAA
public static final double MinPenSizeAASquared
public MaskFill alphafill
public int antialiasHint
public Color backgroundColor
public Region clipRegion
public int clipState
public Composite composite
public int compositeState
public Region constrainClip
public int constrainX
public int constrainY
protected static final Composite defaultComposite
protected static final Stroke defaultStroke
protected Region devClip
public PixelDrawPipe drawpipe
public int eargb
public PixelFillPipe fillpipe
protected Font font
protected FontMetrics fontMetrics
public Color foregroundColor
public RenderingHints hints
public CompositeType imageComp
public DrawImagePipe imagepipe
public int interpolationType
protected static ValidatePipe invalidpipe
public int lcdTextContrast
public RenderLoops loops
public Paint paint
public int paintState
public int pixel
public int renderHint
public ShapeDrawPipe shapepipe
public Stroke stroke
public int strokeHint
public int strokeState
public SurfaceData surfaceData
public int textAntialiasHint
public TextPipe textpipe
public int transX
public int transY
public AffineTransform transform
public int transformState
public Shape usrClip
Public Constructors
SunGraphics2D(SurfaceData sd, Color fg, Color bg, Font f)
Public Methods
void addRenderingHints(Map<?, ?> hints)
Adds a number of preferences for the rendering algorithms.
FontInfo checkFontInfo(FontInfo info, Font font, FontRenderContext frc)
void clearRect(int x, int y, int w, int h)
Clears the specified rectangle by filling it with the background color of the current drawing surface.
void clip(Shape s)
Intersects the current clip with the specified Path and sets the current clip to the resulting intersection.
void clipRect(int x, int y, int w, int h)
Intersects the current clip with the specified rectangle.
AffineTransform cloneTransform()
Returns the current Transform ignoring the "constrain" rectangle.
void constrain(int x, int y, int w, int h)
Constrain rendering for lightweight objects.
void copyArea(int x, int y, int w, int h, int dx, int dy)
Copies an area of the component by a distance specified by dx and dy.
boolean copyImage(Image img, int dx, int dy, int sx, int sy, int width, int height, Color bgcolor, ImageObserver observer)
Not part of the advertised API but a useful utility method to call internally.
Graphics create()
Create a new SunGraphics2D based on this one.
void dispose()
This object has no resources to dispose of per se, but the doc comments for the base method in java.awt.Graphics imply that this object will not be useable after it is disposed.
void draw(Shape s)
Strokes the outline of a Path using the settings of the current graphics state.
void drawArc(int x, int y, int w, int h, int startAngl, int arcAngl)
Draws the outline of a circular or elliptical arc covering the specified rectangle.
void drawBytes(byte[] data, int offset, int length, int x, int y)
Draws the text given by the specified byte array, using this graphics context's current font and color.
void drawChars(char[] data, int offset, int length, int x, int y)
Draws the text given by the specified character array, using this graphics context's current font and color.
void drawGlyphVector(GlyphVector gv, float x, float y)
Renders the text of the specified GlyphVector using the Graphics2D context's rendering attributes.
void drawImage(BufferedImage bImg, BufferedImageOp op, int x, int y)
Renders a BufferedImage that is filtered with a BufferedImageOp.
boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
Draws a subrectangle of an image scaled to a destination rectangle in nonblocking mode with a solid background color and a callback object.
boolean drawImage(Image img, int x, int y, ImageObserver observer)
Draws an image at x,y in nonblocking mode.
boolean drawImage(Image img, int x, int y, int width, int height, Color bg, ImageObserver observer)
Draws an image scaled to x,y,w,h in nonblocking mode with a solid background color and a callback object.
boolean drawImage(Image img, int x, int y, Color bg, ImageObserver observer)
Draws an image at x,y in nonblocking mode with a solid background color and a callback object.
boolean drawImage(Image img, AffineTransform xform, ImageObserver observer)
Draw an image, applying a transform from image space into user space before drawing.
boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
Draws an image scaled to x,y,w,h in nonblocking mode with a callback object.
boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
Draws a subrectangle of an image scaled to a destination rectangle in nonblocking mode with a callback object.
void drawLine(int x1, int y1, int x2, int y2)
Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.
void drawOval(int x, int y, int w, int h)
Draws the outline of an oval.
void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Draws a closed polygon defined by arrays of x and y coordinates.
void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
Draws a sequence of connected lines defined by arrays of x and y coordinates.
void drawRect(int x, int y, int w, int h)
Draws the outline of the specified rectangle.
void drawRenderableImage(RenderableImage img, AffineTransform xform)
Renders a RenderableImage, applying a transform from image space into user space before drawing.
void drawRenderedImage(RenderedImage img, AffineTransform xform)
Draws an image, applying a transform from image space into user space before drawing.
void drawRoundRect(int x, int y, int w, int h, int arcW, int arcH)
Draws an outlined round-cornered rectangle using this graphics context's current color.
void drawString(String str, float x, float y)
Renders the text specified by the specified String, using the current text attribute state in the Graphics2D context.
void drawString(String str, int x, int y)
Renders the text of the specified String, using the current text attribute state in the Graphics2D context.
void drawString(AttributedCharacterIterator iterator, int x, int y)
Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.
void drawString(AttributedCharacterIterator iterator, float x, float y)
Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.
void fill(Shape s)
Fills the interior of a Path using the settings of the current graphics state.
void fillArc(int x, int y, int w, int h, int startAngl, int arcAngl)
Fills a circular or elliptical arc covering the specified rectangle.
void fillOval(int x, int y, int w, int h)
Fills an oval bounded by the specified rectangle with the current color.
void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Fills a closed polygon defined by arrays of x and y coordinates.
void fillRect(int x, int y, int w, int h)
Fills the specified rectangle.
void fillRoundRect(int x, int y, int w, int h, int arcW, int arcH)
Fills the specified rounded corner rectangle with the current color.
void finalize()
Graphics has a finalize method that automatically calls dispose() for subclasses.
Color getBackground()
Returns the background color used for clearing a region.
Shape getClip()
Gets the current clipping area.
Rectangle getClipBounds()
Returns the bounding rectangle of the current clipping area.
Rectangle getClipBounds(Rectangle r)
Returns the bounding rectangle of the current clipping area.
Color getColor()
Gets this graphics context's current color.
Region getCompClip()
Composite getComposite()
Returns the current Composite in the Graphics2D state.
Object getDestination()
Returns destination that this Graphics renders to.
ColorModel getDeviceColorModel()
Return the ColorModel associated with this Graphics2D.
GraphicsConfiguration getDeviceConfiguration()
Return the device configuration associated with this Graphics2D.
Font getFont()
Gets the current font.
FontInfo getFontInfo()
FontMetrics getFontMetrics(Font font)
Gets the font metrics for the specified font.
FontMetrics getFontMetrics()
Gets the font metrics of the current font.
FontRenderContext getFontRenderContext()
Get the rendering context of the font within this Graphics2D context.
FontInfo getGVFontInfo(Font font, FontRenderContext frc)
Paint getPaint()
Returns the current Paint in the Graphics2D state.
Object getRenderingHint(RenderingHints.Key hintKey)
Returns the preferences for the rendering algorithms.
RenderingHints getRenderingHints()
Gets the preferences for the rendering algorithms.
Stroke getStroke()
Returns the current Stroke in the Graphics2D state.
final SurfaceData getSurfaceData()
Return the SurfaceData object assigned to manage the destination drawable surface of this Graphics2D.
AffineTransform getTransform()
Returns the current Transform in the Graphics2D state.
boolean hit(Rectangle rect, Shape s, boolean onStroke)
Checks to see if a Path intersects the specified Rectangle in device space.
boolean hitClip(int x, int y, int width, int height)
Returns true if the specified rectangular area might intersect the current clipping area.
static boolean isRotated(double[] mtx)
void rotate(double theta, double x, double y)
Concatenates the current transform of this Graphics2D with a translated rotation transformation.
void rotate(double theta)
Concatenates the current transform of this Graphics2D with a rotation transformation.
void scale(double sx, double sy)
Concatenates the current transform of this Graphics2D with a scaling transformation.
void setBackground(Color color)
Sets the background color in this context used for clearing a region.
void setClip(int x, int y, int w, int h)
Sets the current clip to the rectangle specified by the given coordinates.
void setClip(Shape sh)
Sets the current clipping area to an arbitrary clip shape.
void setColor(Color color)
Sets this graphics context's current color to the specified color.
void setComposite(Composite comp)
Sets the Composite in the current graphics state.
void setDevClip(Rectangle r)
void setDevClip(int x, int y, int w, int h)
void setFont(Font font)
Sets this graphics context's font to the specified font.
void setPaint(Paint paint)
Sets the Paint in the current graphics state.
void setPaintMode()
Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color.
void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
Sets the preferences for the rendering algorithms.
void setRenderingHints(Map<?, ?> hints)
Sets the preferences for the rendering algorithms.
void setStroke(Stroke s)
Sets the Stroke for the Graphics2D context.
void setTransform(AffineTransform Tx)
Sets the Transform in the current graphics state.
void setXORMode(Color c)
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.
void shear(double shx, double shy)
Concatenates the current transform of this Graphics2D with a shearing transformation.
void transform(AffineTransform xform)
Composes a Transform object with the transform in this Graphics2D according to the rule last-specified-first-applied.
void translate(int x, int y)
Translate
void translate(double tx, double ty)
Concatenates the current transform of this Graphics2D with a translation transformation.
Shape untransformShape(Shape s)
void validatePipe()
Protected Methods
Object clone()
Creates and returns a copy of this object.
static Shape cloneShape(Shape s)
void invalidatePipe()
void invalidateTransform()
Rectangle transformBounds(Rectangle rect, AffineTransform tx)
static Shape transformShape(AffineTransform tx, Shape clip)
static Shape transformShape(int tx, int ty, Shape s)
Shape transformShape(Shape s)
void validateCompClip()
[Expand]
Inherited Methods
From class java.awt.Graphics2D
From class java.awt.Graphics
From class java.lang.Object
From interface sun.awt.ConstrainableGraphics

Constants

public static final int CLIP_DEVICE

Constant Value: 0 (0x00000000)

public static final int CLIP_RECTANGULAR

Constant Value: 1 (0x00000001)

public static final int CLIP_SHAPE

Constant Value: 2 (0x00000002)

public static final int COMP_ALPHA

Constant Value: 1 (0x00000001)

public static final int COMP_CUSTOM

Constant Value: 3 (0x00000003)

public static final int COMP_ISCOPY

Constant Value: 0 (0x00000000)

public static final int COMP_XOR

Constant Value: 2 (0x00000002)

public static final double MinPenSizeSquared

Constant Value: 1.000000001

public static final int PAINT_ALPHACOLOR

Constant Value: 1 (0x00000001)

public static final int PAINT_CUSTOM

Constant Value: 6 (0x00000006)

public static final int PAINT_GRADIENT

Constant Value: 2 (0x00000002)

public static final int PAINT_LIN_GRADIENT

Constant Value: 3 (0x00000003)

public static final int PAINT_OPAQUECOLOR

Constant Value: 0 (0x00000000)

public static final int PAINT_RAD_GRADIENT

Constant Value: 4 (0x00000004)

public static final int PAINT_TEXTURE

Constant Value: 5 (0x00000005)

public static final int STROKE_CUSTOM

Constant Value: 3 (0x00000003)

public static final int STROKE_THIN

Constant Value: 0 (0x00000000)

public static final int STROKE_THINDASHED

Constant Value: 1 (0x00000001)

public static final int STROKE_WIDE

Constant Value: 2 (0x00000002)

public static final int TRANSFORM_ANY_TRANSLATE

Constant Value: 2 (0x00000002)

public static final int TRANSFORM_GENERIC

Constant Value: 4 (0x00000004)

public static final int TRANSFORM_INT_TRANSLATE

Constant Value: 1 (0x00000001)

public static final int TRANSFORM_ISIDENT

Constant Value: 0 (0x00000000)

public static final int TRANSFORM_TRANSLATESCALE

Constant Value: 3 (0x00000003)

Fields

public static final double MinPenSizeAA

public static final double MinPenSizeAASquared

public MaskFill alphafill

public int antialiasHint

public Color backgroundColor

public Region clipRegion

public int clipState

public Composite composite

public int compositeState

public Region constrainClip

public int constrainX

public int constrainY

protected static final Composite defaultComposite

protected static final Stroke defaultStroke

protected Region devClip

public PixelDrawPipe drawpipe

public int eargb

public PixelFillPipe fillpipe

protected Font font

protected FontMetrics fontMetrics

public Color foregroundColor

public RenderingHints hints

public CompositeType imageComp

public DrawImagePipe imagepipe

public int interpolationType

protected static ValidatePipe invalidpipe

public int lcdTextContrast

public RenderLoops loops

public Paint paint

public int paintState

public int pixel

public int renderHint

public ShapeDrawPipe shapepipe

public Stroke stroke

public int strokeHint

public int strokeState

public SurfaceData surfaceData

public int textAntialiasHint

public TextPipe textpipe

public int transX

public int transY

public AffineTransform transform

public int transformState

public Shape usrClip

Public Constructors

public SunGraphics2D (SurfaceData sd, Color fg, Color bg, Font f)

Public Methods

public void addRenderingHints (Map<?, ?> hints)

Adds a number of preferences for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process.

Parameters
hints The rendering hints to be set
See Also

public FontInfo checkFontInfo (FontInfo info, Font font, FontRenderContext frc)

public void clearRect (int x, int y, int w, int h)

Clears the specified rectangle by filling it with the background color of the current drawing surface. This operation does not use the current paint mode.

Beginning with Java 1.1, the background color of offscreen images may be system dependent. Applications should use setColor followed by fillRect to ensure that an offscreen image is cleared to a specific color.

Parameters
x the x coordinate of the rectangle to clear.
y the y coordinate of the rectangle to clear.
w the width of the rectangle to clear.
h the height of the rectangle to clear.

public void clip (Shape s)

Intersects the current clip with the specified Path and sets the current clip to the resulting intersection. The clip is transformed with the current transform in the Graphics2D state before being intersected with the current clip. This method is used to make the current clip smaller. To make the clip larger, use any setClip method.

Parameters
s the Shape to be intersected with the current Clip. If s is null, this method clears the current Clip.

public void clipRect (int x, int y, int w, int h)

Intersects the current clip with the specified rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle. If there is no current clipping area, either because the clip has never been set, or the clip has been cleared using setClip(null), the specified rectangle becomes the new clip. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility. This method can only be used to make the current clip smaller. To set the current clip larger, use any of the setClip methods. Rendering operations have no effect outside of the clipping area.

Parameters
x the x coordinate of the rectangle to intersect the clip with
y the y coordinate of the rectangle to intersect the clip with
w the width of the rectangle to intersect the clip with
h the height of the rectangle to intersect the clip with

public AffineTransform cloneTransform ()

Returns the current Transform ignoring the "constrain" rectangle.

public void constrain (int x, int y, int w, int h)

Constrain rendering for lightweight objects. REMIND: This method will back off to the "workaround" of using translate and clipRect if the Graphics to be constrained has a complex transform. The drawback of the workaround is that the resulting clip and device origin cannot be "enforced".

Throws
IllegalStateException If the Graphics to be constrained has a complex transform.

public void copyArea (int x, int y, int w, int h, int dx, int dy)

Copies an area of the component by a distance specified by dx and dy. From the point specified by x and y, this method copies downwards and to the right. To copy an area of the component to the left or upwards, specify a negative value for dx or dy. If a portion of the source rectangle lies outside the bounds of the component, or is obscured by another window or component, copyArea will be unable to copy the associated pixels. The area that is omitted can be refreshed by calling the component's paint method.

Parameters
x the x coordinate of the source rectangle.
y the y coordinate of the source rectangle.
w the width of the source rectangle.
h the height of the source rectangle.
dx the horizontal distance to copy the pixels.
dy the vertical distance to copy the pixels.

public boolean copyImage (Image img, int dx, int dy, int sx, int sy, int width, int height, Color bgcolor, ImageObserver observer)

Not part of the advertised API but a useful utility method to call internally. This is for the case where we are drawing to/from given coordinates using a given width/height, but we guarantee that the weidth/height of the src and dest areas are equal (no scale needed).

public Graphics create ()

Create a new SunGraphics2D based on this one.

Returns
  • a new graphics context that is a copy of this graphics context.

public void dispose ()

This object has no resources to dispose of per se, but the doc comments for the base method in java.awt.Graphics imply that this object will not be useable after it is disposed. So, we sabotage the object to prevent further use to prevent developers from relying on behavior that may not work on other, less forgiving, VMs that really need to dispose of resources.

public void draw (Shape s)

Strokes the outline of a Path using the settings of the current graphics state. The rendering attributes applied include the clip, transform, paint or color, composite and stroke attributes.

Parameters
s the Shape to be rendered

public void drawArc (int x, int y, int w, int h, int startAngl, int arcAngl)

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

The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.

Parameters
x the x coordinate of the upper-left corner of the arc to be drawn.
y the y coordinate of the upper-left corner of the arc to be drawn.
w the width of the arc to be drawn.
h the height of the arc to be drawn.
startAngl the beginning angle.
arcAngl the angular extent of the arc, relative to the start angle.

public void drawBytes (byte[] data, int offset, int length, int x, int y)

Draws the text given by the specified byte array, using this graphics context's current font and color. The baseline of the first character is at position (xy) in this graphics context's coordinate system.

Use of this method is not recommended as each byte is interpreted as a Unicode code point in the range 0 to 255, and so can only be used to draw Latin characters in that range.

Parameters
data the data to be drawn
offset the start offset in the data
length the number of bytes that are drawn
x the x coordinate of the baseline of the text
y the y coordinate of the baseline of the text

public void drawChars (char[] data, int offset, int length, int x, int y)

Draws the text given by the specified character array, using this graphics context's current font and color. The baseline of the first character is at position (xy) in this graphics context's coordinate system.

Parameters
data the array of characters to be drawn
offset the start offset in the data
length the number of characters to be drawn
x the x coordinate of the baseline of the text
y the y coordinate of the baseline of the text

public void drawGlyphVector (GlyphVector gv, float x, float y)

Renders the text of the specified GlyphVector using the Graphics2D context's rendering attributes. The rendering attributes applied include the Clip, Transform, Paint, and Composite attributes. The GlyphVector specifies individual glyphs from a Font. The GlyphVector can also contain the glyph positions. This is the fastest way to render a set of characters to the screen.

Parameters
gv the GlyphVector to be rendered
x the x position in User Space where the glyphs should be rendered
y the y position in User Space where the glyphs should be rendered

public void drawImage (BufferedImage bImg, BufferedImageOp op, int x, int y)

Renders a BufferedImage that is filtered with a BufferedImageOp. The rendering attributes applied include the Clip, Transform and Composite attributes. This is equivalent to:

 img1 = op.filter(img, null);
 drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null);
 

Parameters
bImg the specified BufferedImage to be rendered. This method does nothing if img is null.
op the filter to be applied to the image before rendering
x the x coordinate of the location in user space where the upper left corner of the image is rendered
y the y coordinate of the location in user space where the upper left corner of the image is rendered

public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)

Draws a subrectangle of an image scaled to a destination rectangle in nonblocking mode with a solid background color and a callback object.

Parameters
img the specified image to be drawn. This method does nothing if img is null.
dx1 the x coordinate of the first corner of the destination rectangle.
dy1 the y coordinate of the first corner of the destination rectangle.
dx2 the x coordinate of the second corner of the destination rectangle.
dy2 the y coordinate of the second corner of the destination rectangle.
sx1 the x coordinate of the first corner of the source rectangle.
sy1 the y coordinate of the first corner of the source rectangle.
sx2 the x coordinate of the second corner of the source rectangle.
sy2 the y coordinate of the second corner of the source rectangle.
bgcolor the background color to paint under the non-opaque portions of the image.
observer object to be notified as more of the image is scaled and converted.
Returns
  • false if the image pixels are still changing; true otherwise.

public boolean drawImage (Image img, int x, int y, ImageObserver observer)

Draws an image at x,y in nonblocking mode.

Parameters
img the specified image to be drawn. This method does nothing if img is null.
x the x coordinate.
y the y coordinate.
observer object to be notified as more of the image is converted.
Returns
  • false if the image pixels are still changing; true otherwise.

public boolean drawImage (Image img, int x, int y, int width, int height, Color bg, ImageObserver observer)

Draws an image scaled to x,y,w,h in nonblocking mode with a solid background color and a callback object.

Parameters
img the specified image to be drawn. This method does nothing if img is null.
x the x coordinate.
y the y coordinate.
width the width of the rectangle.
height the height of the rectangle.
bg the background color to paint under the non-opaque portions of the image.
observer object to be notified as more of the image is converted.
Returns
  • false if the image pixels are still changing; true otherwise.

public boolean drawImage (Image img, int x, int y, Color bg, ImageObserver observer)

Draws an image at x,y in nonblocking mode with a solid background color and a callback object.

Parameters
img the specified image to be drawn. This method does nothing if img is null.
x the x coordinate.
y the y coordinate.
bg the background color to paint under the non-opaque portions of the image.
observer object to be notified as more of the image is converted.
Returns
  • false if the image pixels are still changing; true otherwise.

public boolean drawImage (Image img, AffineTransform xform, ImageObserver observer)

Draw an image, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current transform in the Graphics2D. The given transformation is applied to the image before the transform attribute in the Graphics2D state is applied. The rendering attributes applied include the clip, transform, paint or color and composite attributes. Note that the result is undefined, if the given transform is non-invertible.

Parameters
img The image to be drawn.
xform The transformation from image space into user space.
observer The image observer to be notified on the image producing progress.
Returns
  • true if the Image is fully loaded and completely rendered, or if it's null; false if the Image is still being loaded.

public boolean drawImage (Image img, int x, int y, int width, int height, ImageObserver observer)

Draws an image scaled to x,y,w,h in nonblocking mode with a callback object.

Parameters
img the specified image to be drawn. This method does nothing if img is null.
x the x coordinate.
y the y coordinate.
width the width of the rectangle.
height the height of the rectangle.
observer object to be notified as more of the image is converted.
Returns
  • false if the image pixels are still changing; true otherwise.

public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)

Draws a subrectangle of an image scaled to a destination rectangle in nonblocking mode with a callback object.

Parameters
img the specified image to be drawn. This method does nothing if img is null.
dx1 the x coordinate of the first corner of the destination rectangle.
dy1 the y coordinate of the first corner of the destination rectangle.
dx2 the x coordinate of the second corner of the destination rectangle.
dy2 the y coordinate of the second corner of the destination rectangle.
sx1 the x coordinate of the first corner of the source rectangle.
sy1 the y coordinate of the first corner of the source rectangle.
sx2 the x coordinate of the second corner of the source rectangle.
sy2 the y coordinate of the second corner of the source rectangle.
observer object to be notified as more of the image is scaled and converted.
Returns
  • false if the image pixels are still changing; true otherwise.

public void drawLine (int x1, int y1, int x2, int y2)

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

Parameters
x1 the first point's x coordinate.
y1 the first point's y coordinate.
x2 the second point's x coordinate.
y2 the second point's y coordinate.

public void drawOval (int x, int y, int w, int h)

Draws the outline of an oval. The result is a circle or ellipse that fits within the rectangle specified by the x, y, width, and height arguments.

The oval covers an area that is width + 1 pixels wide and height + 1 pixels tall.

Parameters
x the x coordinate of the upper left corner of the oval to be drawn.
y the y coordinate of the upper left corner of the oval to be drawn.
w the width of the oval to be drawn.
h the height of the oval to be drawn.

public void drawPolygon (int[] xPoints, int[] yPoints, int nPoints)

Draws a closed polygon defined by arrays of x and y coordinates. Each pair of (xy) coordinates defines a point.

This method draws the polygon defined by nPoint line segments, where the first nPoint - 1 line segments are line segments from (xPoints[i - 1], yPoints[i - 1]) to (xPoints[i], yPoints[i]), for 1 ≤ i ≤ nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.

Parameters
xPoints a an array of x coordinates.
yPoints a an array of y coordinates.
nPoints a the total number of points.

public void drawPolyline (int[] xPoints, int[] yPoints, int nPoints)

Draws a sequence of connected lines defined by arrays of x and y coordinates. Each pair of (xy) coordinates defines a point. The figure is not closed if the first point differs from the last point.

Parameters
xPoints an array of x points
yPoints an array of y points
nPoints the total number of points

public void drawRect (int x, int y, int w, int h)

Draws the outline of the specified rectangle. The left and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height. The rectangle is drawn using the graphics context's current color.

Parameters
x the x coordinate of the rectangle to be drawn.
y the y coordinate of the rectangle to be drawn.
w the width of the rectangle to be drawn.
h the height of the rectangle to be drawn.

public void drawRenderableImage (RenderableImage img, AffineTransform xform)

Renders a RenderableImage, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current Transform in the Graphics2D. The specified transformation is applied to the image before the transform attribute in the Graphics2D context is applied. The rendering attributes applied include the Clip, Transform, and Composite attributes. Note that no rendering is done if the specified transform is noninvertible.

Rendering hints set on the Graphics2D object might be used in rendering the RenderableImage. If explicit control is required over specific hints recognized by a specific RenderableImage, or if knowledge of which hints are used is required, then a RenderedImage should be obtained directly from the RenderableImage and rendered using drawRenderedImage.

Parameters
img the image to be rendered. This method does nothing if img is null.
xform the transformation from image space into user space

public void drawRenderedImage (RenderedImage img, AffineTransform xform)

Draws an image, applying a transform from image space into user space before drawing. The transformation from user space into device space is done with the current transform in the Graphics2D. The given transformation is applied to the image before the transform attribute in the Graphics2D state is applied. The rendering attributes applied include the clip, transform, and composite attributes. Note that the result is undefined, if the given transform is noninvertible.

Parameters
img The image to be drawn. Does nothing if img is null.
xform The transformation from image space into user space.

public void drawRoundRect (int x, int y, int w, int h, int arcW, int arcH)

Draws an outlined round-cornered rectangle using this graphics context's current color. The left and right edges of the rectangle are at x and x + width, respectively. The top and bottom edges of the rectangle are at y and y + height.

Parameters
x the x coordinate of the rectangle to be drawn.
y the y coordinate of the rectangle to be drawn.
w the width of the rectangle to be drawn.
h the height of the rectangle to be drawn.
arcW the horizontal diameter of the arc at the four corners.
arcH the vertical diameter of the arc at the four corners.

public void drawString (String str, float x, float y)

Renders the text specified by the specified String, using the current text attribute state in the Graphics2D context. The baseline of the first character is at position (xy) in the User Space. The rendering attributes applied include the Clip, Transform, Paint, Font and Composite attributes. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.

Parameters
str the String to be rendered
x the x coordinate of the location where the String should be rendered
y the y coordinate of the location where the String should be rendered

public void drawString (String str, int x, int y)

Renders the text of the specified String, using the current text attribute state in the Graphics2D context. The baseline of the first character is at position (xy) in the User Space. The rendering attributes applied include the Clip, Transform, Paint, Font and Composite attributes. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.

Parameters
str the string to be rendered
x the x coordinate of the location where the String should be rendered
y the y coordinate of the location where the String should be rendered

public void drawString (AttributedCharacterIterator iterator, int x, int y)

Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.

The baseline of the first character is at position (xy) in User Space. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.

Parameters
iterator the iterator whose text is to be rendered
x the x coordinate where the iterator's text is to be rendered
y the y coordinate where the iterator's text is to be rendered

public void drawString (AttributedCharacterIterator iterator, float x, float y)

Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.

The baseline of the first character is at position (xy) in User Space. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.

Parameters
iterator the iterator whose text is to be rendered
x the x coordinate where the iterator's text is to be rendered
y the y coordinate where the iterator's text is to be rendered

public void fill (Shape s)

Fills the interior of a Path using the settings of the current graphics state. The rendering attributes applied include the clip, transform, paint or color, and composite.

Parameters
s the Shape to be filled

public void fillArc (int x, int y, int w, int h, int startAngl, int arcAngl)

Fills a circular or elliptical arc covering the specified rectangle.

The resulting arc begins at startAngle and extends for arcAngle degrees. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (xy) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.

The angles are specified relative to the non-square extents of the bounding rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the bounding rectangle. As a result, if the bounding rectangle is noticeably longer in one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the bounds.

Parameters
x the x coordinate of the upper-left corner of the arc to be filled.
y the y coordinate of the upper-left corner of the arc to be filled.
w the width of the arc to be filled.
h the height of the arc to be filled.
startAngl the beginning angle.
arcAngl the angular extent of the arc, relative to the start angle.

public void fillOval (int x, int y, int w, int h)

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

Parameters
x the x coordinate of the upper left corner of the oval to be filled.
y the y coordinate of the upper left corner of the oval to be filled.
w the width of the oval to be filled.
h the height of the oval to be filled.

public void fillPolygon (int[] xPoints, int[] yPoints, int nPoints)

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

This method draws the polygon defined by nPoint line segments, where the first nPoint - 1 line segments are line segments from (xPoints[i - 1], yPoints[i - 1]) to (xPoints[i], yPoints[i]), for 1 ≤ i ≤ nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.

The area inside the polygon is defined using an even-odd fill rule, also known as the alternating rule.

Parameters
xPoints a an array of x coordinates.
yPoints a an array of y coordinates.
nPoints a the total number of points.

public void fillRect (int x, int y, int w, int h)

Fills the specified rectangle. The left and right edges of the rectangle are at x and x + width - 1. The top and bottom edges are at y and y + height - 1. The resulting rectangle covers an area width pixels wide by height pixels tall. The rectangle is filled using the graphics context's current color.

Parameters
x the x coordinate of the rectangle to be filled.
y the y coordinate of the rectangle to be filled.
w the width of the rectangle to be filled.
h the height of the rectangle to be filled.

public void fillRoundRect (int x, int y, int w, int h, int arcW, int arcH)

Fills the specified rounded corner rectangle with the current color. The left and right edges of the rectangle are at x and x + width - 1, respectively. The top and bottom edges of the rectangle are at y and y + height - 1.

Parameters
x the x coordinate of the rectangle to be filled.
y the y coordinate of the rectangle to be filled.
w the width of the rectangle to be filled.
h the height of the rectangle to be filled.
arcW the horizontal diameter of the arc at the four corners.
arcH the vertical diameter of the arc at the four corners.

public void finalize ()

Graphics has a finalize method that automatically calls dispose() for subclasses. For SunGraphics2D we do not need to be finalized so that method simply causes us to be enqueued on the Finalizer queues for no good reason. Unfortunately, that method and implementation are now considered part of the public contract of that base class so we can not remove or gut the method. We override it here with an empty method and the VM is smart enough to know that if our override is empty then it should not mark us as finalizeable.

public Color getBackground ()

Returns the background color used for clearing a region.

Returns
  • the current Graphics2D Color, which defines the background color.
See Also
  • setBackground

public Shape getClip ()

Gets the current clipping area. This method returns the user clip, which is independent of the clipping associated with device bounds and window visibility. If no clip has previously been set, or if the clip has been cleared using setClip(null), this method returns null.

Returns
  • a Shape object representing the current clipping area, or null if no clip is set.

public Rectangle getClipBounds ()

Returns the bounding rectangle of the current clipping area. This method refers to the user clip, which is independent of the clipping associated with device bounds and window visibility. If no clip has previously been set, or if the clip has been cleared using setClip(null), this method returns null. The coordinates in the rectangle are relative to the coordinate system origin of this graphics context.

Returns
  • the bounding rectangle of the current clipping area, or null if no clip is set.

public Rectangle getClipBounds (Rectangle r)

Returns the bounding rectangle of the current clipping area. The coordinates in the rectangle are relative to the coordinate system origin of this graphics context. This method differs from getClipBounds in that an existing rectangle is used instead of allocating a new one. This method refers to the user clip, which is independent of the clipping associated with device bounds and window visibility. If no clip has previously been set, or if the clip has been cleared using setClip(null), this method returns the specified Rectangle.

Parameters
r the rectangle where the current clipping area is copied to. Any current values in this rectangle are overwritten.
Returns
  • the bounding rectangle of the current clipping area.

public Color getColor ()

Gets this graphics context's current color.

Returns
  • this graphics context's current color.

public Region getCompClip ()

public Composite getComposite ()

Returns the current Composite in the Graphics2D state.

Returns
  • the current Graphics2D Composite, which defines a compositing style.

public Object getDestination ()

Returns destination that this Graphics renders to. This could be either an Image or a Component; subclasses of SurfaceData are responsible for returning the appropriate object.

public ColorModel getDeviceColorModel ()

Return the ColorModel associated with this Graphics2D.

public GraphicsConfiguration getDeviceConfiguration ()

Return the device configuration associated with this Graphics2D.

Returns
  • the device configuration of this Graphics2D.

public Font getFont ()

Gets the current font.

Returns
  • this graphics context's current font.

public FontInfo getFontInfo ()

public FontMetrics getFontMetrics (Font font)

Gets the font metrics for the specified font.

Parameters
font the specified font
Returns
  • the font metrics for the specified font.

public FontMetrics getFontMetrics ()

Gets the font metrics of the current font.

Returns
  • the font metrics of this graphics context's current font.

public FontRenderContext getFontRenderContext ()

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

Returns
  • a reference to an instance of FontRenderContext.

public FontInfo getGVFontInfo (Font font, FontRenderContext frc)

public Paint getPaint ()

Returns the current Paint in the Graphics2D state.

Returns
  • the current Graphics2D Paint, which defines a color or pattern.

public Object getRenderingHint (RenderingHints.Key hintKey)

Returns the preferences for the rendering algorithms.

Parameters
hintKey the key corresponding to the hint to get.
Returns
  • The preferences for rendering algorithms. The strings are defined in the RenderingHints class.
See Also

public RenderingHints getRenderingHints ()

Gets the preferences for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process.

Returns
  • a reference to an instance of RenderingHints that contains the current preferences.
See Also

public Stroke getStroke ()

Returns the current Stroke in the Graphics2D state.

Returns
  • the current Graphics2D Stroke, which defines the line style.
See Also
  • setStroke

public final SurfaceData getSurfaceData ()

Return the SurfaceData object assigned to manage the destination drawable surface of this Graphics2D.

public AffineTransform getTransform ()

Returns the current Transform in the Graphics2D state.

Returns
  • the current AffineTransform in the Graphics2D context.

public boolean hit (Rectangle rect, Shape s, boolean onStroke)

Checks to see if a Path intersects the specified Rectangle in device space. The rendering attributes taken into account include the clip, transform, and stroke attributes.

Parameters
rect The area in device space to check for a hit.
s the Shape to check for a hit
onStroke Flag to choose between testing the stroked or the filled path.
Returns
  • True if there is a hit, false otherwise.

public boolean hitClip (int x, int y, int width, int height)

Returns true if the specified rectangular area might intersect the current clipping area. The coordinates of the specified rectangular area are in the user coordinate space and are relative to the coordinate system origin of this graphics context. This method may use an algorithm that calculates a result quickly but which sometimes might return true even if the specified rectangular area does not intersect the clipping area. The specific algorithm employed may thus trade off accuracy for speed, but it will never return false unless it can guarantee that the specified rectangular area does not intersect the current clipping area. The clipping area used by this method can represent the intersection of the user clip as specified through the clip methods of this graphics context as well as the clipping associated with the device or image bounds and window visibility.

Parameters
x the x coordinate of the rectangle to test against the clip
y the y coordinate of the rectangle to test against the clip
width the width of the rectangle to test against the clip
height the height of the rectangle to test against the clip
Returns
  • true if the specified rectangle intersects the bounds of the current clip; false otherwise.

public static boolean isRotated (double[] mtx)

public void rotate (double theta, double x, double y)

Concatenates the current transform of this Graphics2D with a translated rotation transformation. This is equivalent to the following sequence of calls:

          translate(x, y);
          rotate(theta);
          translate(-x, -y);
 
Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.

Parameters
theta The angle of rotation in radians.
x The x coordinate of the origin of the rotation
y The x coordinate of the origin of the rotation

public void rotate (double theta)

Concatenates the current transform of this Graphics2D with a rotation transformation. This is equivalent to calling transform(R), where R is an AffineTransform represented by the following matrix:

          [   cos(theta)    -sin(theta)    0   ]
          [   sin(theta)     cos(theta)    0   ]
          [       0              0         1   ]
 
Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.

Parameters
theta The angle of rotation in radians.

public void scale (double sx, double sy)

Concatenates the current transform of this Graphics2D with a scaling transformation. This is equivalent to calling transform(S), where S is an AffineTransform represented by the following matrix:

          [   sx   0    0   ]
          [   0    sy   0   ]
          [   0    0    1   ]
 

Parameters
sx the amount by which X coordinates in subsequent rendering operations are multiplied relative to previous rendering operations.
sy the amount by which Y coordinates in subsequent rendering operations are multiplied relative to previous rendering operations.

public void setBackground (Color color)

Sets the background color in this context used for clearing a region. When Graphics2D is constructed for a component, the backgroung color is inherited from the component. Setting the background color in the Graphics2D context only affects the subsequent clearRect() calls and not the background color of the component. To change the background of the component, use appropriate methods of the component.

Parameters
color The background color that should be used in subsequent calls to clearRect().
See Also
  • getBackground
  • Graphics.clearRect()

public void setClip (int x, int y, int w, int h)

Sets the current clip to the rectangle specified by the given coordinates. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility. Rendering operations have no effect outside of the clipping area.

Parameters
x the x coordinate of the new clip rectangle.
y the y coordinate of the new clip rectangle.
w the width of the new clip rectangle.
h the height of the new clip rectangle.

public void setClip (Shape sh)

Sets the current clipping area to an arbitrary clip shape. Not all objects that implement the Shape interface can be used to set the clip. The only Shape objects that are guaranteed to be supported are Shape objects that are obtained via the getClip method and via Rectangle objects. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.

Parameters
sh the Shape to use to set the clip

public void setColor (Color color)

Sets this graphics context's current color to the specified color. All subsequent graphics operations using this graphics context use this specified color.

Parameters
color the new rendering color.

public void setComposite (Composite comp)

Sets the Composite in the current graphics state. Composite is used in all drawing methods such as drawImage, drawString, drawPath, and fillPath. It specifies how new pixels are to be combined with the existing pixels on the graphics device in the rendering process.

Parameters
comp The Composite object to be used for drawing.

public void setDevClip (Rectangle r)

public void setDevClip (int x, int y, int w, int h)

public void setFont (Font font)

Sets this graphics context's font to the specified font. All subsequent text operations using this graphics context use this font. A null argument is silently ignored.

Parameters
font the font.

public void setPaint (Paint paint)

Sets the Paint in the current graphics state.

Parameters
paint The Paint object to be used to generate color in the rendering process.

public void setPaintMode ()

Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color. This sets the logical pixel operation function to the paint or overwrite mode. All subsequent rendering operations will overwrite the destination with the current color.

public void setRenderingHint (RenderingHints.Key hintKey, Object hintValue)

Sets the preferences for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process.

Parameters
hintKey The key of hint to be set. The strings are defined in the RenderingHints class.
hintValue The value indicating preferences for the specified hint category. These strings are defined in the RenderingHints class.
See Also

public void setRenderingHints (Map<?, ?> hints)

Sets the preferences for the rendering algorithms. Hint categories include controls for rendering quality and overall time/quality trade-off in the rendering process.

Parameters
hints The rendering hints to be set
See Also

public void setStroke (Stroke s)

Sets the Stroke for the Graphics2D context.

Parameters
s the Stroke object to be used to stroke a Shape during the rendering process

public void setTransform (AffineTransform Tx)

Sets the Transform in the current graphics state.

Parameters
Tx The Transform object to be used in the rendering process.
See Also

public void setXORMode (Color c)

Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color. This specifies that logical pixel operations are performed in the XOR mode, which alternates pixels between the current color and a specified XOR color.

When drawing operations are performed, pixels which are the current color are changed to the specified color, and vice versa.

Pixels that are of colors other than those two colors are changed in an unpredictable but reversible manner; if the same figure is drawn twice, then all pixels are restored to their original values.

Parameters
c the XOR alternation color

public void shear (double shx, double shy)

Concatenates the current transform of this Graphics2D with a shearing transformation. This is equivalent to calling transform(SH), where SH is an AffineTransform represented by the following matrix:

          [   1   shx   0   ]
          [  shy   1    0   ]
          [   0    0    1   ]
 

Parameters
shx The factor by which coordinates are shifted towards the positive X axis direction according to their Y coordinate
shy The factor by which coordinates are shifted towards the positive Y axis direction according to their X coordinate

public void transform (AffineTransform xform)

Composes a Transform object with the transform in this Graphics2D according to the rule last-specified-first-applied. If the currrent transform is Cx, the result of composition with Tx is a new transform Cx'. Cx' becomes the current transform for this Graphics2D. Transforming a point p by the updated transform Cx' is equivalent to first transforming p by Tx and then transforming the result by the original transform Cx. In other words, Cx'(p) = Cx(Tx(p)). A copy of the Tx is made, if necessary, so further modifications to Tx do not affect rendering.

Parameters
xform the AffineTransform object to be composed with the current Transform

public void translate (int x, int y)

Translate

Parameters
x the specified x coordinate
y the specified y coordinate

public void translate (double tx, double ty)

Concatenates the current transform of this Graphics2D with a translation transformation. This is equivalent to calling transform(T), where T is an AffineTransform represented by the following matrix:

          [   1    0    tx  ]
          [   0    1    ty  ]
          [   0    0    1   ]
 

Parameters
tx the distance to translate along the x-axis
ty the distance to translate along the y-axis

public Shape untransformShape (Shape s)

public void validatePipe ()

Protected Methods

protected Object clone ()

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

 x.clone() != x
will be true, and that the expression:
 x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
 x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

The method clone for class Object performs a specific cloning operation. First, if the class of this object does not implement the interface Cloneable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.

The class Object does not itself implement the interface Cloneable, so calling the clone method on an object whose class is Object will result in throwing an exception at run time.

Returns
  • a clone of this instance.

protected static Shape cloneShape (Shape s)

protected void invalidatePipe ()

protected void invalidateTransform ()

protected Rectangle transformBounds (Rectangle rect, AffineTransform tx)

protected static Shape transformShape (AffineTransform tx, Shape clip)

protected static Shape transformShape (int tx, int ty, Shape s)

protected Shape transformShape (Shape s)

protected void validateCompClip ()