Revision: 745
Author: allain.lalonde
Date: Mon Oct 19 10:43:18 2009
Log: Fixing some checkstyle bugs and fixing an infinite recursion bug
introduced by r727 by me :(
http://code.google.com/p/piccolo2d/source/detail?r=745
Modified:
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
=======================================
--- /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java
Wed Oct 14 13:39:44 2009
+++ /piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PNode.java
Mon Oct 19 10:43:18 2009
@@ -1454,11 +1454,11 @@
}
/**
- * Set the bounds of this node to the given value. These bounds are
stored
+ * Set the bounds of this node to the given position and size. These
bounds are stored
* in the local coordinate system of this node.
*
* If the width or height is less then or equal to zero then the
bound's
- * emtpy bit will be set to true.
+ * empty bit will be set to true.
*
* Subclasses must call the super.setBounds() method.
*
=======================================
---
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java
Thu Oct 15 06:40:46 2009
+++
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTPath.java
Mon Oct 19 10:43:18 2009
@@ -69,10 +69,6 @@
* @author Jesse Grosjean
*/
public class PSWTPath extends PNode {
-
- /**
- *
- */
private static final long serialVersionUID = 1L;
/**
@@ -92,15 +88,24 @@
private Paint strokePaint;
- boolean updatingBoundsFromPath;
- Shape origShape;
- Shape shape;
-
- PAffineTransform internalXForm;
- AffineTransform inverseXForm;
-
- double[] shapePts;
-
+ private boolean updatingBoundsFromPath;
+ private Shape origShape;
+ private Shape shape;
+
+ private PAffineTransform internalXForm;
+ private AffineTransform inverseXForm;
+
+ private double[] shapePts;
+
+ /**
+ * Creates a path representing the rectangle provided.
+ *
+ * @param x left of rectangle
+ * @param y top of rectangle
+ * @param width width of rectangle
+ * @param height height of rectangle
+ * @return created rectangle
+ */
public static PSWTPath createRectangle(final float x, final float y,
final float width, final float height) {
TEMP_RECTANGLE.setFrame(x, y, width, height);
final PSWTPath result = new PSWTPath(TEMP_RECTANGLE);
@@ -108,6 +113,17 @@
return result;
}
+ /**
+ * Creates a path representing the rounded rectangle provided.
+ *
+ * @param x left of rectangle
+ * @param y top of rectangle
+ * @param width width of rectangle
+ * @param height height of rectangle
+ * @param arcWidth width of the arc at the corners
+ * @param arcHeight height of arc at the corners
+ * @return created rounded rectangle
+ */
public static PSWTPath createRoundRectangle(final float x, final float
y, final float width, final float height,
final float arcWidth, final float arcHeight) {
TEMP_ROUNDRECTANGLE.setRoundRect(x, y, width, height, arcWidth,
arcHeight);
@@ -116,6 +132,16 @@
return result;
}
+ /**
+ * Creates a path representing an ellipse that covers the rectangle
+ * provided.
+ *
+ * @param x left of rectangle
+ * @param y top of rectangle
+ * @param width width of rectangle
+ * @param height height of rectangle
+ * @return created ellipse
+ */
public static PSWTPath createEllipse(final float x, final float y,
final float width, final float height) {
TEMP_ELLIPSE.setFrame(x, y, width, height);
final PSWTPath result = new PSWTPath(TEMP_ELLIPSE);
@@ -137,6 +163,9 @@
return result;
}
+ /**
+ * Creates an empty PSWTPath.
+ */
public PSWTPath() {
strokePaint = DEFAULT_STROKE_PAINT;
}
@@ -149,14 +178,23 @@
// ****************************************************************
// Stroke
// ****************************************************************
-
+ /**
+ * Returns the paint to use when drawing the stroke of the shape.
+ *
+ * @return path's stroke paint
+ */
public Paint getStrokePaint() {
return strokePaint;
}
- public void setStrokeColor(final Paint aPaint) {
+ /**
+ * Sets the paint to use when drawing the stroke of the shape.
+ *
+ * @param strokeColor new stroke color
+ */
+ public void setStrokeColor(final Paint strokeColor) {
final Paint old = strokePaint;
- strokePaint = aPaint;
+ strokePaint = strokeColor;
invalidatePaint();
firePropertyChange(PPath.PROPERTY_CODE_STROKE_PAINT,
PPath.PROPERTY_STROKE_PAINT, old, strokePaint);
}
@@ -201,6 +239,11 @@
}
}
+ /**
+ * Returns true if this shape intersects the bounds provided.
+ *
+ *
+ */
public boolean intersects(Rectangle2D aBounds) {
if (super.intersects(aBounds)) {
@@ -219,6 +262,9 @@
return false;
}
+ /**
+ * Recalculates the path's bounds by examining it's associated shape.
+ */
public void updateBoundsFromPath() {
updatingBoundsFromPath = true;
@@ -243,7 +289,11 @@
// ****************************************************************
// Painting
// ****************************************************************
-
+ /**
+ * Paints the path on the context provided.
+ *
+ * @param paintContext the context onto which the path will be painted
+ */
protected void paint(final PPaintContext paintContext) {
final Paint p = getPaint();
final SWTGraphics2D g2 = (SWTGraphics2D)
paintContext.getGraphics();
@@ -254,52 +304,12 @@
if (p != null) {
g2.setBackground((Color) p);
-
- final double lineWidth = g2.getTransformedLineWidth();
- if (shape instanceof Rectangle2D) {
- g2.fillRect(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth);
- }
- else if (shape instanceof Ellipse2D) {
- g2.fillOval(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth);
- }
- else if (shape instanceof Arc2D) {
- g2.fillArc(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth, shapePts[4], shapePts[5]);
- }
- else if (shape instanceof RoundRectangle2D) {
- g2.fillRoundRect(shapePts[0] + lineWidth / 2, shapePts[1]
+ lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth, shapePts[4], shapePts[5]);
- }
- else {
- g2.fill(shape);
- }
+ fillShape(g2);
}
if (strokePaint != null) {
g2.setColor((Color) strokePaint);
-
- final double lineWidth = g2.getTransformedLineWidth();
- if (shape instanceof Rectangle2D) {
- g2.drawRect(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth);
- }
- else if (shape instanceof Ellipse2D) {
- g2.drawOval(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth);
- }
- else if (shape instanceof Arc2D) {
- g2.drawArc(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth, shapePts[4], shapePts[5]);
- }
- else if (shape instanceof RoundRectangle2D) {
- g2.drawRoundRect(shapePts[0] + lineWidth / 2, shapePts[1]
+ lineWidth / 2, shapePts[2] - lineWidth,
- shapePts[3] - lineWidth, shapePts[4], shapePts[5]);
- }
- else {
- g2.draw(shape);
- }
+ drawShape(g2);
}
if (inverseXForm != null) {
@@ -307,10 +317,61 @@
}
}
- public void setShape(final Shape aShape) {
- shape = cloneShape(aShape);
+ private void drawShape(final SWTGraphics2D g2) {
+ final double lineWidth = g2.getTransformedLineWidth();
+ if (shape instanceof Rectangle2D) {
+ g2.drawRect(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
+ - lineWidth);
+ }
+ else if (shape instanceof Ellipse2D) {
+ g2.drawOval(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
+ - lineWidth);
+ }
+ else if (shape instanceof Arc2D) {
+ g2.drawArc(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
+ - lineWidth, shapePts[4], shapePts[5]);
+ }
+ else if (shape instanceof RoundRectangle2D) {
+ g2.drawRoundRect(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
+ shapePts[3] - lineWidth, shapePts[4], shapePts[5]);
+ }
+ else {
+ g2.draw(shape);
+ }
+ }
+
+ private void fillShape(final SWTGraphics2D g2) {
+ final double lineWidth = g2.getTransformedLineWidth();
+ if (shape instanceof Rectangle2D) {
+ g2.fillRect(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
+ - lineWidth);
+ }
+ else if (shape instanceof Ellipse2D) {
+ g2.fillOval(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
+ - lineWidth);
+ }
+ else if (shape instanceof Arc2D) {
+ g2.fillArc(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
+ - lineWidth, shapePts[4], shapePts[5]);
+ }
+ else if (shape instanceof RoundRectangle2D) {
+ g2.fillRoundRect(shapePts[0] + lineWidth / 2, shapePts[1] +
lineWidth / 2, shapePts[2] - lineWidth,
+ shapePts[3] - lineWidth, shapePts[4], shapePts[5]);
+ }
+ else {
+ g2.fill(shape);
+ }
+ }
+
+ /**
+ * Changes the underlying shape of this PSWTPath.
+ *
+ * @param newShape new associated shape of this PSWTPath
+ */
+ public void setShape(final Shape newShape) {
+ shape = cloneShape(newShape);
origShape = shape;
- updateShapePoints(aShape);
+ updateShapePoints(newShape);
firePropertyChange(PPath.PROPERTY_CODE_PATH, PPath.PROPERTY_PATH,
null, shape);
updateBoundsFromPath();
@@ -389,7 +450,7 @@
final Line2D l2 = (Line2D) aShape;
return new Line2D.Double(l2.getP1(), l2.getP2());
}
- else {
+ else {
final GeneralPath aPath = new GeneralPath();
aPath.append(aShape, false);
return aPath;
=======================================
---
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
Thu Oct 15 06:40:46 2009
+++
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/SWTGraphics2D.java
Mon Oct 19 10:43:18 2009
@@ -83,24 +83,37 @@
* @author Lance Good
*/
public class SWTGraphics2D extends Graphics2D {
-
private static final boolean DEFAULT_STRING_TRANSPARENCY = true;
+
+ /**
+ * The number of Graphics Contexts active as determined by called to
+ * incrementGCCount and decrementGCCount.
+ */
protected static int CACHE_COUNT = 0;
+ /** Map from font names to Fonts. */
protected static HashMap FONT_CACHE = new HashMap();
+ /** Map from awt colors to swt colors. */
protected static HashMap COLOR_CACHE = new HashMap();
+ /** Map from awt shapess to swt Paths. */
protected static HashMap SHAPE_CACHE = new HashMap();
+ /** Buffer used to extract the graphics device. */
protected static BufferedImage BUFFER = new BufferedImage(1, 1,
BufferedImage.TYPE_INT_ARGB);
- private static Point PT = new Point();
- private static Rectangle2D RECT = new Rectangle2D.Double();
- private static Rectangle2D LINE_RECT = new Rectangle2D.Double();
+ private static Point TEMP_POINT = new Point();
+ private static Rectangle2D TEMP_RECT = new Rectangle2D.Double();
+ private static Rectangle2D TEMP_LINE_RECT = new Rectangle2D.Double();
private static org.eclipse.swt.graphics.Rectangle SWT_RECT = new
org.eclipse.swt.graphics.Rectangle(0, 0, 0, 0);
+ /** The Underlying GraphicsContext provided by swt. */
protected GC gc;
+ /** Device onto which all graphics operations will ultimately take
place. */
protected Device device;
+ /** The current transform to apply to drawing operations. */
protected AffineTransform transform = new AffineTransform();
- private Transform swtTransform;
+ private final Transform swtTransform;
+ /** The current font to use when drawing text. */
protected org.eclipse.swt.graphics.Font curFont;
+ /** The current stroke width to use when drawing lines. */
protected double lineWidth = 1.0;
/**
@@ -123,9 +136,7 @@
// GET CLIP
// //////////////////
- /**
- * @see java.awt.Graphics#getClipBounds()
- */
+ /** {...@inheritdoc} */
public Rectangle getClipBounds() {
final org.eclipse.swt.graphics.Rectangle rect = gc.getClipping();
final Rectangle aRect = new Rectangle(rect.x, rect.y, rect.width,
rect.height);
@@ -138,10 +149,11 @@
return aRect;
}
+ /** {...@inheritdoc} */
public void clipRect(final int x, final int y, final int width, final
int height) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
- SWTShapeManager.awtToSWT(RECT, SWT_RECT);
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ SWTShapeManager.awtToSWT(TEMP_RECT, SWT_RECT);
org.eclipse.swt.graphics.Rectangle clip = gc.getClipping();
clip = clip.intersection(SWT_RECT);
@@ -149,10 +161,11 @@
gc.setClipping(clip);
}
+ /** {...@inheritdoc} */
public void setClip(final int x, final int y, final int width, final
int height) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
- SWTShapeManager.awtToSWT(RECT, SWT_RECT);
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ SWTShapeManager.awtToSWT(TEMP_RECT, SWT_RECT);
gc.setClipping(SWT_RECT);
}
@@ -174,7 +187,7 @@
}
/**
- * This method isn't really supported by SWT - so will use the shape
bounds
+ * This method isn't really supported by SWT - so will use the shape
bounds.
*
* @param clip the desired clipping region's shape, will be simplified
to
* its bounds
@@ -192,6 +205,7 @@
}
}
+ /** {...@inheritdoc} */
public Shape getClip() {
final org.eclipse.swt.graphics.Rectangle rect = gc.getClipping();
final Rectangle2D aRect = new Rectangle2D.Double(rect.x, rect.y,
rect.width, rect.height);
@@ -204,10 +218,11 @@
return aRect;
}
- // ///////////////////
- // DEVICE SPECIFIC
- // ///////////////////
-
+ /**
+ * Returns a dummy device configuration.
+ *
+ * @return a dummy device configuration
+ */
public GraphicsConfiguration getDeviceConfiguration() {
return ((Graphics2D)
BUFFER.getGraphics()).getDeviceConfiguration();
}
@@ -216,22 +231,26 @@
// COLOR METHODS
// //////////////
+ /** {...@inheritdoc} */
public Paint getPaint() {
return getColor();
}
+ /** {...@inheritdoc} */
public void setPaint(final Paint paint) {
if (paint instanceof Color) {
setColor((Color) paint);
}
}
+ /** {...@inheritdoc} */
public Color getColor() {
final org.eclipse.swt.graphics.Color color = gc.getForeground();
final Color awtColor = new Color(color.getRed(), color.getGreen(),
color.getBlue());
return awtColor;
}
+ /** {...@inheritdoc} */
public void setColor(final Color c) {
org.eclipse.swt.graphics.Color cachedColor =
(org.eclipse.swt.graphics.Color) COLOR_CACHE.get(c);
if (cachedColor == null) {
@@ -241,10 +260,16 @@
gc.setForeground(cachedColor);
}
- public void setColor(final org.eclipse.swt.graphics.Color c) {
- gc.setForeground(c);
+ /**
+ * Sets the foreground color to the provided swt color.
+ *
+ * @param foregroundColor new foreground color
+ */
+ public void setColor(final org.eclipse.swt.graphics.Color
foregroundColor) {
+ gc.setForeground(foregroundColor);
}
+ /** {...@inheritdoc} */
public void setBackground(final Color c) {
org.eclipse.swt.graphics.Color cachedColor =
(org.eclipse.swt.graphics.Color) COLOR_CACHE.get(c);
if (cachedColor == null) {
@@ -254,10 +279,16 @@
gc.setBackground(cachedColor);
}
- public void setBackground(final org.eclipse.swt.graphics.Color c) {
- gc.setBackground(c);
+ /**
+ * Sets the background color to the provided swt color.
+ *
+ * @param backgroundColor new background color
+ */
+ public void setBackground(final org.eclipse.swt.graphics.Color
backgroundColor) {
+ gc.setBackground(backgroundColor);
}
+ /** {...@inheritdoc} */
public Color getBackground() {
final org.eclipse.swt.graphics.Color color = gc.getBackground();
final Color awtColor = new Color(color.getRed(), color.getGreen(),
color.getBlue());
@@ -268,15 +299,26 @@
// FONT METHODS
// //////////////
+ /**
+ * Returns the current swt font to use when drawing.
+ *
+ * @return current swt font
+ */
public org.eclipse.swt.graphics.Font getSWTFont() {
return curFont;
}
+ /**
+ * Returns the font metrics of the current SWT font.
+ *
+ * @return font metrics of the current SWT font
+ */
public org.eclipse.swt.graphics.FontMetrics getSWTFontMetrics() {
gc.setFont(curFont);
return gc.getFontMetrics();
}
+ /** {...@inheritdoc} */
public Font getFont() {
if (curFont != null) {
int style = Font.PLAIN;
@@ -299,6 +341,7 @@
}
}
+ /** {...@inheritdoc} */
public void setFont(final Font font) {
final String fontString = "name=" + font.getFamily() + ";bold=" +
font.isBold() + ";italic=" + font.isItalic()
+ ";size=" + font.getSize();
@@ -306,10 +349,17 @@
curFont = getFont(fontString);
}
+ /** {...@inheritdoc} */
public void setFont(final org.eclipse.swt.graphics.Font font) {
curFont = font;
}
+ /**
+ * Returns the SWT font matching the given font string.
+ *
+ * @param fontString description of the font desired
+ * @return matching font, or null if not found
+ */
public org.eclipse.swt.graphics.Font getFont(final String fontString) {
org.eclipse.swt.graphics.Font cachedFont =
(org.eclipse.swt.graphics.Font) FONT_CACHE.get(fontString);
if (cachedFont == null) {
@@ -339,15 +389,18 @@
}
/**
+ * Deprecated since SWT now handles this.
+ *
* @deprecated
+ * @return font that's been transformed by the current transform
*/
protected org.eclipse.swt.graphics.Font getTransformedFont() {
if (curFont != null) {
final FontData fontData = curFont.getFontData()[0];
int height = fontData.getHeight();
- RECT.setRect(0, 0, height, height);
- SWTShapeManager.transform(RECT, transform);
- height = (int) (RECT.getHeight() + 0.5);
+ TEMP_RECT.setRect(0, 0, height, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ height = (int) (TEMP_RECT.getHeight() + 0.5);
final String fontString = "name=" + fontData.getName()
+ ";bold=" + ((fontData.getStyle() & SWT.BOLD) != 0)
+ ";italic=" + ((fontData.getStyle() & SWT.ITALIC) !=
0) + ";size=" + height;
@@ -360,46 +413,55 @@
// AFFINE TRANSFORM METHODS
// /////////////////////////
+ /** {...@inheritdoc} */
public void translate(final int x, final int y) {
transform.translate(x, y);
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public void translate(final double tx, final double ty) {
transform.translate(tx, ty);
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public void rotate(final double theta) {
transform.rotate(theta);
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public void rotate(final double theta, final double x, final double y)
{
transform.rotate(theta, x, y);
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public void scale(final double sx, final double sy) {
transform.scale(sx, sy);
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public void shear(final double shx, final double shy) {
transform.shear(shx, shy);
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public void transform(final AffineTransform Tx) {
transform.concatenate(Tx);
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public void setTransform(final AffineTransform Tx) {
transform = (AffineTransform) Tx.clone();
updateSWTTransform();
}
+ /** {...@inheritdoc} */
public AffineTransform getTransform() {
return (AffineTransform) transform.clone();
}
@@ -411,7 +473,7 @@
* Updates the SWT transform instance such that it matches AWTs
counterpart.
*/
private void updateSWTTransform() {
- double[] m = new double[6];
+ final double[] m = new double[6];
transform.getMatrix(m);
swtTransform.setElements((float) m[0], (float) m[1], (float) m[2],
(float) m[3], (float) m[4], (float) m[5]);
}
@@ -423,14 +485,13 @@
* @return the corresponding path object. Must be disposed() when no
longer
* used.
*/
-
- private Path pathIterator2Path(PathIterator iter) {
- float[] coords = new float[6];
-
- Path path = new Path(device);
+ private Path pathIterator2Path(final PathIterator iter) {
+ final float[] coords = new float[6];
+
+ final Path path = new Path(device);
while (!iter.isDone()) {
- int type = iter.currentSegment(coords);
+ final int type = iter.currentSegment(coords);
switch (type) {
case PathIterator.SEG_MOVETO:
@@ -452,6 +513,8 @@
case PathIterator.SEG_CUBICTO:
path.cubicTo(coords[0], coords[1], coords[2],
coords[3], coords[4], coords[5]);
break;
+ default:
+ // log this?
}
iter.next();
@@ -459,15 +522,12 @@
return path;
}
- // /////////////////////////////
- // /////////////////////////////
- // DRAWING AND FILLING METHODS
- // /////////////////////////////
-
+ /** {...@inheritdoc} */
public void clearRect(final int x, final int y, final int width, final
int height) {
fillRect(x, y, width, height);
}
+ /** {...@inheritdoc} */
public void draw(final Shape s) {
if (s instanceof Rectangle2D) {
final Rectangle2D r2 = (Rectangle2D) s;
@@ -495,6 +555,7 @@
}
}
+ /** {...@inheritdoc} */
public void fill(final Shape s) {
if (s instanceof Rectangle2D) {
final Rectangle2D r2 = (Rectangle2D) s;
@@ -522,11 +583,12 @@
}
}
+ /** {...@inheritdoc} */
public void drawPolyline(final int[] xPoints, final int[] yPoints,
final int nPoints) {
final int[] ptArray = new int[2 * nPoints];
for (int i = 0; i < nPoints; i++) {
- PT.setLocation(xPoints[i], yPoints[i]);
- transform.transform(PT, PT);
+ TEMP_POINT.setLocation(xPoints[i], yPoints[i]);
+ transform.transform(TEMP_POINT, TEMP_POINT);
ptArray[2 * i] = xPoints[i];
ptArray[2 * i + 1] = yPoints[i];
}
@@ -535,16 +597,18 @@
gc.drawPolyline(ptArray);
}
+ /** {...@inheritdoc} */
public void drawPolyline(final double[] pts) {
final int[] intPts = SWTShapeManager.transform(pts, transform);
gc.drawPolyline(intPts);
}
+ /** {...@inheritdoc} */
public void drawPolygon(final int[] xPoints, final int[] yPoints,
final int nPoints) {
final int[] ptArray = new int[2 * nPoints];
for (int i = 0; i < nPoints; i++) {
- PT.setLocation(xPoints[i], yPoints[i]);
- transform.transform(PT, PT);
+ TEMP_POINT.setLocation(xPoints[i], yPoints[i]);
+ transform.transform(TEMP_POINT, TEMP_POINT);
ptArray[2 * i] = xPoints[i];
ptArray[2 * i + 1] = yPoints[i];
}
@@ -552,16 +616,18 @@
gc.drawPolygon(ptArray);
}
+ /** {...@inheritdoc} */
public void fillPolygon(final double[] pts) {
final int[] intPts = SWTShapeManager.transform(pts, transform);
gc.fillPolygon(intPts);
}
+ /** {...@inheritdoc} */
public void fillPolygon(final int[] xPoints, final int[] yPoints,
final int nPoints) {
final int[] ptArray = new int[2 * nPoints];
for (int i = 0; i < nPoints; i++) {
- PT.setLocation(xPoints[i], yPoints[i]);
- transform.transform(PT, PT);
+ TEMP_POINT.setLocation(xPoints[i], yPoints[i]);
+ transform.transform(TEMP_POINT, TEMP_POINT);
ptArray[2 * i] = xPoints[i];
ptArray[2 * i + 1] = yPoints[i];
}
@@ -569,22 +635,33 @@
gc.fillPolygon(ptArray);
}
+ /** {...@inheritdoc} */
public void drawLine(final int x1, final int y1, final int x2, final
int y2) {
drawLine((double) x1, (double) y1, (double) x2, (double) y2);
}
- public void drawLine(double x1, double y1, double x2, double y2) {
- PT.setLocation(x1, y1);
- transform.transform(PT, PT);
- x1 = (int) PT.getX();
- y1 = (int) PT.getY();
- PT.setLocation(x2, y2);
- transform.transform(PT, PT);
- x2 = (int) PT.getX();
- y2 = (int) PT.getY();
+ /**
+ * Draws a line, using the current color, between the points (x1, y1)
and
+ * (x2, y2) in this graphics context's coordinate system.
+ *
+ * @param x1 the first point's x coordinate.
+ * @param y1 the first point's y coordinate.
+ * @param x2 the second point's x coordinate.
+ * @param y2 the second point's y coordinate.
+ */
+ public void drawLine(final double x1, final double y1, final double
x2, final double y2) {
+ TEMP_POINT.setLocation(x1, y1);
+ transform.transform(TEMP_POINT, TEMP_POINT);
+ final double transformedX1 = (int) TEMP_POINT.getX();
+ final double transformedY1 = (int) TEMP_POINT.getY();
+ TEMP_POINT.setLocation(x2, y2);
+ transform.transform(TEMP_POINT, TEMP_POINT);
+ final double transformedX2 = (int) TEMP_POINT.getX();
+ final double transformedY2 = (int) TEMP_POINT.getY();
gc.setLineWidth(getTransformedLineWidth());
- gc.drawLine((int) (x1 + 0.5), (int) (y1 + 0.5), (int) (x2 + 0.5),
(int) (y2 + 0.5));
+ gc.drawLine((int) (transformedX1 + 0.5), (int) (transformedY1 +
0.5), (int) (transformedX2 + 0.5),
+ (int) (transformedY2 + 0.5));
}
//
**************************************************************************
@@ -593,240 +670,538 @@
//
**************************************************************************
// *
+ /**
+ * Copies the image to the specified position.
+ *
+ * @param img swt image to be copied
+ * @param x x component of position
+ * @param y y component of position
+ */
public void copyArea(final org.eclipse.swt.graphics.Image img, final
double x, final double y) {
- PT.setLocation(x, y);
- transform.transform(PT, PT);
-
- gc.copyArea(img, (int) (PT.getX() + 0.5), (int) (PT.getY() + 0.5));
+ TEMP_POINT.setLocation(x, y);
+ transform.transform(TEMP_POINT, TEMP_POINT);
+
+ gc.copyArea(img, (int) (TEMP_POINT.getX() + 0.5), (int)
(TEMP_POINT.getY() + 0.5));
}
+ /** {...@inheritdoc} */
public void copyArea(final int x, final int y, final int width, final
int height, final int dx, final int dy) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
-
- PT.setLocation(dx, dy);
- transform.transform(PT, PT);
- gc.copyArea((int) RECT.getX(), (int) RECT.getY(), (int)
RECT.getWidth(), (int) RECT.getHeight(), (int) PT
- .getX(), (int) PT.getY());
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+
+ TEMP_POINT.setLocation(dx, dy);
+ transform.transform(TEMP_POINT, TEMP_POINT);
+ gc.copyArea((int) TEMP_RECT.getX(), (int) TEMP_RECT.getY(), (int)
TEMP_RECT.getWidth(), (int) TEMP_RECT
+ .getHeight(), (int) TEMP_POINT.getX(), (int)
TEMP_POINT.getY());
}
- public void drawString(String str, int x, int y, boolean
isTransparent) {
+ /**
+ * 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 (x, y) 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.
+ *
+ * @param str the string to be rendered
+ * @param x the x coordinate of the location where the String should be
+ * rendered
+ * @param y the y coordinate of the location where the String should be
+ * rendered
+ * @param isTransparent whether a background should be painted behind
the
+ * text
+ */
+ public void drawString(final String str, final int x, final int y,
final boolean isTransparent) {
gc.setTransform(swtTransform);
gc.drawString(str, x, y, isTransparent);
gc.setTransform(null);
}
+ /** {...@inheritdoc} */
public void drawString(final String str, final int x, final int y) {
drawString(str, x, y, DEFAULT_STRING_TRANSPARENCY);
}
- public void drawString(String str, double x, double 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 (x, y) 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.
+ *
+ * @param str the string to be rendered
+ * @param x the x coordinate of the location where the String should be
+ * rendered
+ * @param y the y coordinate of the location where the String should be
+ * rendered
+ */
+ public void drawString(final String str, final double x, final double
y) {
drawString(str, (int) (x + 0.5), (int) (y + 0.5));
}
- public void drawString(String str, double x, double y, boolean
isTransparent) {
+ /**
+ * 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 (x, y) 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.
+ *
+ * @param str the string to be rendered
+ * @param x the x coordinate of the location where the String should be
+ * rendered
+ * @param y the y coordinate of the location where the String should be
+ * rendered
+ * @param isTransparent whether a background should be painted behind
the
+ * text
+ */
+ public void drawString(final String str, final double x, final double
y, final boolean isTransparent) {
drawString(str, (int) (x + 0.5), (int) (y + 0.5), isTransparent);
}
+ /** {...@inheritdoc} */
public void drawString(final String str, final float x, final float y)
{
drawString(str, (int) (x + 0.5), (int) (y + 0.5));
}
- public void drawText(final String s, final double x, final double y) {
- drawString(s, (int) (x + 0.5), (int) (y + 0.5));
+ /**
+ * 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 (x, y) 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.
+ *
+ * @param str the string to be rendered
+ * @param x the x coordinate of the location where the String should be
+ * rendered
+ * @param y the y coordinate of the location where the String should be
+ * rendered
+ */
+ public void drawText(final String str, final double x, final double y)
{
+ drawString(str, (int) (x + 0.5), (int) (y + 0.5));
}
- public void drawText(final String s, final double x, final double y,
final int flags) {
- drawText(s, (int) (x + 0.5), (int) (y + 0.5), flags);
+ /**
+ * 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 (x, y) 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.
+ *
+ * @param str the string to be rendered
+ * @param x the x coordinate of the location where the String should be
+ * rendered
+ * @param y the y coordinate of the location where the String should be
+ * rendered
+ * @param flags flags to apply to the string as defined by SWT
+ */
+ public void drawText(final String str, final double x, final double y,
final int flags) {
+ drawText(str, (int) (x + 0.5), (int) (y + 0.5), flags);
}
+ /**
+ * 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 (x, y) 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.
+ *
+ * @param str the string to be rendered
+ * @param x the x coordinate of the location where the String should be
+ * rendered
+ * @param y the y coordinate of the location where the String should be
+ * rendered
+ * @param flags flags to apply to the string as defined by SWT
+ */
+ public void drawText(final String str, final int x, final int y, final
int flags) {
+ gc.setTransform(swtTransform);
+ gc.drawText(str, x, y, flags);
+ gc.setTransform(null);
+ }
+
+ /** {...@inheritdoc} */
public void drawRect(final int x, final int y, final int width, final
int height) {
drawRect((double) x, (double) y, (double) width, (double) height);
}
+ /**
+ * 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.
+ *
+ * @param x the x coordinate of the rectangle to be drawn.
+ * @param y the y coordinate of the rectangle to be drawn.
+ * @param width the width of the rectangle to be drawn.
+ * @param height the height of the rectangle to be drawn.
+ */
public void drawRect(final double x, final double y, final double
width, final double height) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
- SWTShapeManager.awtToSWT(RECT, SWT_RECT);
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ SWTShapeManager.awtToSWT(TEMP_RECT, SWT_RECT);
gc.setLineWidth(getTransformedLineWidth());
gc.drawRectangle(SWT_RECT);
}
+ /** {...@inheritdoc} */
public void fillRect(final int x, final int y, final int width, final
int height) {
fillRect((double) x, (double) y, (double) width, (double) height);
}
+ /**
+ * 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.
+ *
+ * @param x the x coordinate of the rectangle to be filled.
+ * @param y the y coordinate of the rectangle to be filled.
+ * @param width the width of the rectangle to be filled.
+ * @param height the height of the rectangle to be filled.
+ */
public void fillRect(final double x, final double y, final double
width, final double height) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
- SWTShapeManager.awtToSWT(RECT, SWT_RECT);
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ SWTShapeManager.awtToSWT(TEMP_RECT, SWT_RECT);
gc.fillRectangle(SWT_RECT);
}
+ /** {...@inheritdoc} */
public void drawRoundRect(final int x, final int y, final int width,
final int height, final int arcWidth,
final int arcHeight) {
drawRoundRect((double) x, (double) y, (double) width, (double)
height, (double) arcWidth, (double) arcHeight);
}
- public void drawRoundRect(double x, double y, double width, double
height, double arcWidth, double arcHeight) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
- x = RECT.getX();
- y = RECT.getY();
- width = RECT.getWidth();
- height = RECT.getHeight();
-
- RECT.setRect(0, 0, arcWidth, arcHeight);
- SWTShapeManager.transform(RECT, transform);
- arcWidth = RECT.getWidth();
- arcHeight = RECT.getHeight();
+ /**
+ * 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.
+ *
+ * @param x the x coordinate of the rectangle to be drawn.
+ * @param y the y coordinate of the rectangle to be drawn.
+ * @param width the width of the rectangle to be drawn.
+ * @param height the height of the rectangle to be drawn.
+ * @param arcWidth the horizontal diameter of the arc at the four
corners.
+ * @param arcHeight the vertical diameter of the arc at the four
corners.
+ */
+ public void drawRoundRect(final double x, final double y, final double
width, final double height,
+ final double arcWidth, final double arcHeight) {
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ final double tx = TEMP_RECT.getX();
+ final double ty = TEMP_RECT.getY();
+ final double twidth = TEMP_RECT.getWidth();
+ final double theight = TEMP_RECT.getHeight();
+
+ TEMP_RECT.setRect(0, 0, arcWidth, arcHeight);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ final double tarcWidth = TEMP_RECT.getWidth();
+ final double tarcHeight = TEMP_RECT.getHeight();
gc.setLineWidth(getTransformedLineWidth());
- gc.drawRoundRectangle((int) (x + 0.5), (int) (y + 0.5), (int)
(width + 0.5), (int) (height + 0.5),
- (int) (arcWidth + 0.5), (int) (arcHeight + 0.5));
+ gc.drawRoundRectangle((int) (tx + 0.5), (int) (ty + 0.5), (int)
(twidth + 0.5), (int) (theight + 0.5),
+ (int) (tarcWidth + 0.5), (int) (tarcHeight + 0.5));
}
+ /** {...@inheritdoc} */
public void fillRoundRect(final int x, final int y, final int width,
final int height, final int arcWidth,
final int arcHeight) {
fillRoundRect((double) x, (double) y, (double) width, (double)
height, (double) arcWidth, (double) arcHeight);
}
- public void fillRoundRect(double x, double y, double width, double
height, double arcWidth, double arcHeight) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
- x = RECT.getX();
- y = RECT.getY();
- width = RECT.getWidth();
- height = RECT.getHeight();
-
- RECT.setRect(0, 0, arcWidth, arcHeight);
- SWTShapeManager.transform(RECT, transform);
- arcWidth = RECT.getWidth();
- arcHeight = RECT.getHeight();
+ /**
+ * 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.
+ *
+ *...@param x the x coordinate of the rectangle to be filled.
+ *...@param y the y coordinate of the rectangle to be filled.
+ *...@param width the width of the rectangle to be filled.
+ *...@param height the height of the rectangle to be filled.
+ *...@param arcWidth the horizontal diameter of the arc at the four
corners.
+ *...@param arcHeight the vertical diameter of the arc at the four
corners.
+ */
+ public void fillRoundRect(final double x, final double y, final double
width, final double height,
+ final double arcWidth, final double arcHeight) {
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ final double tx = TEMP_RECT.getX();
+ final double ty = TEMP_RECT.getY();
+ final double twidth = TEMP_RECT.getWidth();
+ final double theight = TEMP_RECT.getHeight();
+
+ TEMP_RECT.setRect(0, 0, arcWidth, arcHeight);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+ final double tarcWidth = TEMP_RECT.getWidth();
+ final double tarcHeight = TEMP_RECT.getHeight();
gc.setLineWidth(getTransformedLineWidth());
- gc.fillRoundRectangle((int) (x + 0.5), (int) (y + 0.5), (int)
(width + 0.5), (int) (height + 0.5),
- (int) (arcWidth + 0.5), (int) (arcHeight + 0.5));
+ gc.fillRoundRectangle((int) (tx + 0.5), (int) (ty + 0.5), (int)
(twidth + 0.5), (int) (theight + 0.5),
+ (int) (tarcWidth + 0.5), (int) (tarcHeight + 0.5));
}
+ /** {...@inheritdoc} */
public void drawOval(final int x, final int y, final int width, final
int height) {
drawOval((double) x, (double) y, (double) width, (double) height);
}
+ /**
+ * 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.
+ *
+ * @param x the x coordinate of the upper left corner of the oval to be
+ * drawn.
+ * @param y the y coordinate of the upper left corner of the oval to be
+ * drawn.
+ * @param width the width of the oval to be drawn.
+ * @param height the height of the oval to be drawn.
+ */
public void drawOval(final double x, final double y, final double
width, final double height) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
gc.setLineWidth(getTransformedLineWidth());
- gc.drawOval((int) (RECT.getX() + 0.5), (int) (RECT.getY() + 0.5),
(int) (RECT.getWidth() + 0.5), (int) (RECT
- .getHeight() + 0.5));
+ gc.drawOval((int) (TEMP_RECT.getX() + 0.5), (int)
(TEMP_RECT.getY() + 0.5), (int) (TEMP_RECT.getWidth() + 0.5),
+ (int) (TEMP_RECT.getHeight() + 0.5));
}
+ /** {...@inheritdoc} */
public void fillOval(final int x, final int y, final int width, final
int height) {
fillOval((double) x, (double) y, (double) width, (double) height);
}
+ /**
+ * Fills an oval bounded by the specified rectangle with the current
color.
+ *
+ * @param x the x coordinate of the upper left corner of the oval to be
+ * filled.
+ * @param y the y coordinate of the upper left corner of the oval to be
+ * filled.
+ * @param width the width of the oval to be filled.
+ * @param height the height of the oval to be filled.
+ */
public void fillOval(final double x, final double y, final double
width, final double height) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
-
- gc.fillOval((int) (RECT.getX() + 0.5), (int) (RECT.getY() + 0.5),
(int) (RECT.getWidth() + 0.5), (int) (RECT
- .getHeight() + 0.5));
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+
+ gc.fillOval((int) (TEMP_RECT.getX() + 0.5), (int)
(TEMP_RECT.getY() + 0.5), (int) (TEMP_RECT.getWidth() + 0.5),
+ (int) (TEMP_RECT.getHeight() + 0.5));
}
+ /** {...@inheritdoc} */
public void drawArc(final int x, final int y, final int width, final
int height, final int startAngle,
final int extent) {
drawArc((double) x, (double) y, (double) width, (double) height,
(double) startAngle, (double) extent);
}
+ /**
+ * 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 (x,
+ * y) 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.
+ *
+ * @param x the x coordinate of the upper-left corner of the arc to be
+ * drawn.
+ * @param y the y coordinate of the upper-left corner of the arc to be
+ * drawn.
+ * @param width the width of the arc to be drawn.
+ * @param height the height of the arc to be drawn.
+ * @param startAngle the beginning angle.
+ * @param extent the angular extent of the arc, relative to the start
angle.
+ */
public void drawArc(final double x, final double y, final double
width, final double height,
final double startAngle, final double extent) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
gc.setLineWidth(getTransformedLineWidth());
- gc.drawArc((int) (RECT.getX() + 0.5), (int) (RECT.getY() + 0.5),
(int) (RECT.getWidth() + 0.5), (int) (RECT
- .getHeight() + 0.5), (int) (startAngle + 0.5), (int)
(startAngle + extent + 0.5));
+ gc.drawArc((int) (TEMP_RECT.getX() + 0.5), (int) (TEMP_RECT.getY()
+ 0.5), (int) (TEMP_RECT.getWidth() + 0.5),
+ (int) (TEMP_RECT.getHeight() + 0.5), (int) (startAngle +
0.5), (int) (startAngle + extent + 0.5));
}
+ /** {...@inheritdoc} */
public void fillArc(final int x, final int y, final int width, final
int height, final int startAngle,
final int extent) {
drawArc((double) x, (double) y, (double) width, (double) height,
(double) startAngle, (double) extent);
}
+ /**
+ * Draws a filledArc with the options provided.
+ *
+ * @param x the x coordinate of the upper-left corner of the arc to be
+ * filled.
+ * @param y the y coordinate of the upper-left corner of the arc to be
+ * filled.
+ * @param width the width of the arc to be filled.
+ * @param height the height of the arc to be filled.
+ * @param startAngle the beginning angle.
+ * @param extent the angular extent of the arc, relative to the start
angle.
+ */
public void fillArc(final double x, final double y, final double
width, final double height,
final double startAngle, final double extent) {
- RECT.setRect(x, y, width, height);
- SWTShapeManager.transform(RECT, transform);
-
- gc.drawArc((int) (RECT.getX() + 0.5), (int) (RECT.getY() + 0.5),
(int) (RECT.getWidth() + 0.5), (int) (RECT
- .getHeight() + 0.5), (int) (startAngle + 0.5), (int)
(startAngle + extent + 0.5));
+ TEMP_RECT.setRect(x, y, width, height);
+ SWTShapeManager.transform(TEMP_RECT, transform);
+
+ gc.drawArc((int) (TEMP_RECT.getX() + 0.5), (int) (TEMP_RECT.getY()
+ 0.5), (int) (TEMP_RECT.getWidth() + 0.5),
+ (int) (TEMP_RECT.getHeight() + 0.5), (int) (startAngle +
0.5), (int) (startAngle + extent + 0.5));
}
- public void drawPath(Path p) {
+ /**
+ * Draws the provided path.
+ *
+ * @param p path to draw
+ */
+ public void drawPath(final Path p) {
gc.setTransform(swtTransform);
gc.drawPath(p);
gc.setTransform(null);
}
- public void fillPath(Path p) {
+ /**
+ * Draws a filled version of the provided path.
+ *
+ * @param p path to draw filled
+ */
+ public void fillPath(final Path p) {
gc.setTransform(swtTransform);
gc.fillPath(p);
gc.setTransform(null);
}
- // ////////////////////////
- // SWT IMAGE METHODS
- // ////////////////////////
-
+ /**
+ * Draws the provided image at the position specified.
+ *
+ * @param image image to draw
***The diff for this file has been truncated for email.***
--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---