peterreilly 2005/05/24 10:17:29
Modified: src/main/org/apache/tools/ant/types/optional/image Arc.java
ColorMapper.java DrawOperation.java Ellipse.java
Rectangle.java Rotate.java Scale.java Text.java
Log:
checkstyle - mostly removal of _
Revision Changes Path
1.7 +9 -8
ant/src/main/org/apache/tools/ant/types/optional/image/Arc.java
Index: Arc.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/Arc.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Arc.java 9 Feb 2004 21:05:37 -0000 1.6
+++ Arc.java 24 May 2005 17:17:29 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2002,2004 The Apache Software Foundation
+ * Copyright 2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,12 +48,12 @@
/**
* @todo refactor using an EnumeratedAttribute
*/
- public void setType(String str_type) {
- if (str_type.toLowerCase().equals("open")) {
+ public void setType(String strType) {
+ if (strType.toLowerCase().equals("open")) {
type = Arc2D.OPEN;
- } else if (str_type.toLowerCase().equals("pie")) {
+ } else if (strType.toLowerCase().equals("pie")) {
type = Arc2D.PIE;
- } else if (str_type.toLowerCase().equals("chord")) {
+ } else if (strType.toLowerCase().equals("chord")) {
type = Arc2D.CHORD;
}
}
@@ -65,9 +65,9 @@
Graphics2D graphics = (Graphics2D) bi.getGraphics();
if (!stroke.equals("transparent")) {
- BasicStroke b_stroke = new BasicStroke(stroke_width);
+ BasicStroke bStroke = new BasicStroke(stroke_width);
graphics.setColor(ColorMapper.getColorByName(stroke));
- graphics.setStroke(b_stroke);
+ graphics.setStroke(bStroke);
graphics.draw(new Arc2D.Double(stroke_width, stroke_width, width,
height, start, stop, type));
}
@@ -86,7 +86,8 @@
graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);
} else if (instr instanceof TransformOperation) {
graphics = (Graphics2D) bi.getGraphics();
- PlanarImage image = ((TransformOperation)
instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
+ PlanarImage image = ((TransformOperation) instr)
+
.executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
bi = image.getAsBufferedImage();
}
}
1.7 +32 -16
ant/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java
Index: ColorMapper.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/ColorMapper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ColorMapper.java 9 Mar 2004 16:48:43 -0000 1.6
+++ ColorMapper.java 24 May 2005 17:17:29 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2002,2004 The Apache Software Foundation
+ * Copyright 2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,55 +23,71 @@
* @see org.apache.tools.ant.taskdefs.optional.image.Image
*/
public final class ColorMapper {
+ /** black string */
public static final String COLOR_BLACK = "black";
+ /** blue string */
public static final String COLOR_BLUE = "blue";
+ /** cyan string */
public static final String COLOR_CYAN = "cyan";
+ /** black string */
public static final String COLOR_DARKGRAY = "darkgray";
+ /** gray string */
public static final String COLOR_GRAY = "gray";
+ /** lightgray string */
public static final String COLOR_LIGHTGRAY = "lightgray";
// Gotta atleast put in the proper spelling :-P
+ /** darkgrey string */
public static final String COLOR_DARKGREY = "darkgrey";
+ /** grey string */
public static final String COLOR_GREY = "grey";
+ /** lightgrey string */
public static final String COLOR_LIGHTGREY = "lightgrey";
+ /** green string */
public static final String COLOR_GREEN = "green";
+ /** magenta string */
public static final String COLOR_MAGENTA = "magenta";
+ /** orange string */
public static final String COLOR_ORANGE = "orange";
+ /** pink string */
public static final String COLOR_PINK = "pink";
+ /** reg string */
public static final String COLOR_RED = "red";
+ /** white string */
public static final String COLOR_WHITE = "white";
+ /** yellow string */
public static final String COLOR_YELLOW = "yellow";
/**
* @todo refactor to use an EnumeratedAttribute (maybe?)
*/
- public static final Color getColorByName(String color_name) {
- color_name = color_name.toLowerCase();
+ public static Color getColorByName(String colorName) {
+ colorName = colorName.toLowerCase();
- if (color_name.equals(COLOR_BLACK)) {
+ if (colorName.equals(COLOR_BLACK)) {
return Color.black;
- } else if (color_name.equals(COLOR_BLUE)) {
+ } else if (colorName.equals(COLOR_BLUE)) {
return Color.blue;
- } else if (color_name.equals(COLOR_CYAN)) {
+ } else if (colorName.equals(COLOR_CYAN)) {
return Color.cyan;
- } else if (color_name.equals(COLOR_DARKGRAY) ||
color_name.equals(COLOR_DARKGREY)) {
+ } else if (colorName.equals(COLOR_DARKGRAY) ||
colorName.equals(COLOR_DARKGREY)) {
return Color.darkGray;
- } else if (color_name.equals(COLOR_GRAY) ||
color_name.equals(COLOR_GREY)) {
+ } else if (colorName.equals(COLOR_GRAY) ||
colorName.equals(COLOR_GREY)) {
return Color.gray;
- } else if (color_name.equals(COLOR_LIGHTGRAY) ||
color_name.equals(COLOR_LIGHTGREY)) {
+ } else if (colorName.equals(COLOR_LIGHTGRAY) ||
colorName.equals(COLOR_LIGHTGREY)) {
return Color.lightGray;
- } else if (color_name.equals(COLOR_GREEN)) {
+ } else if (colorName.equals(COLOR_GREEN)) {
return Color.green;
- } else if (color_name.equals(COLOR_MAGENTA)) {
+ } else if (colorName.equals(COLOR_MAGENTA)) {
return Color.magenta;
- } else if (color_name.equals(COLOR_ORANGE)) {
+ } else if (colorName.equals(COLOR_ORANGE)) {
return Color.orange;
- } else if (color_name.equals(COLOR_PINK)) {
+ } else if (colorName.equals(COLOR_PINK)) {
return Color.pink;
- } else if (color_name.equals(COLOR_RED)) {
+ } else if (colorName.equals(COLOR_RED)) {
return Color.red;
- } else if (color_name.equals(COLOR_WHITE)) {
+ } else if (colorName.equals(COLOR_WHITE)) {
return Color.white;
- } else if (color_name.equals(COLOR_YELLOW)) {
+ } else if (colorName.equals(COLOR_YELLOW)) {
return Color.yellow;
}
return Color.black;
1.7 +3 -2
ant/src/main/org/apache/tools/ant/types/optional/image/DrawOperation.java
Index: DrawOperation.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/DrawOperation.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DrawOperation.java 9 Mar 2004 16:48:43 -0000 1.6
+++ DrawOperation.java 24 May 2005 17:17:29 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2002,2004 The Apache Software Foundation
+ * Copyright 2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
* Abstract method which is intended to create an image buffer
* and return it so it can be drawn into another object. Use
* an Alpha channel for a "transparent" background.
+ * @return a planar image
*/
- public PlanarImage executeDrawOperation();
+ PlanarImage executeDrawOperation();
}
1.7 +5 -4
ant/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java
Index: Ellipse.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/Ellipse.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Ellipse.java 9 Mar 2004 16:48:43 -0000 1.6
+++ Ellipse.java 24 May 2005 17:17:29 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2002,2004 The Apache Software Foundation
+ * Copyright 2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,9 +44,9 @@
Graphics2D graphics = (Graphics2D) bi.getGraphics();
if (!stroke.equals("transparent")) {
- BasicStroke b_stroke = new BasicStroke(stroke_width);
+ BasicStroke bStroke = new BasicStroke(stroke_width);
graphics.setColor(ColorMapper.getColorByName(stroke));
- graphics.setStroke(b_stroke);
+ graphics.setStroke(bStroke);
graphics.draw(new Ellipse2D.Double(0, 0, width, height));
}
@@ -63,7 +63,8 @@
graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);
} else if (instr instanceof TransformOperation) {
graphics = (Graphics2D) bi.getGraphics();
- PlanarImage image = ((TransformOperation)
instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
+ PlanarImage image = ((TransformOperation) instr)
+
.executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
bi = image.getAsBufferedImage();
}
}
1.8 +5 -4
ant/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java
Index: Rectangle.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/Rectangle.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Rectangle.java 9 Mar 2004 16:48:43 -0000 1.7
+++ Rectangle.java 24 May 2005 17:17:29 -0000 1.8
@@ -1,5 +1,5 @@
/*
- * Copyright 2002,2004 The Apache Software Foundation
+ * Copyright 2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,9 +55,9 @@
Graphics2D graphics = (Graphics2D) bi.getGraphics();
if (!stroke.equals("transparent")) {
- BasicStroke b_stroke = new BasicStroke(stroke_width);
+ BasicStroke bStroke = new BasicStroke(stroke_width);
graphics.setColor(ColorMapper.getColorByName(stroke));
- graphics.setStroke(b_stroke);
+ graphics.setStroke(bStroke);
if ((arcwidth != 0) || (archeight != 0)) {
graphics.drawRoundRect(0, 0, width, height, arcwidth,
archeight);
@@ -87,7 +87,8 @@
} else if (instr instanceof TransformOperation) {
graphics = (Graphics2D) bi.getGraphics();
PlanarImage image
- = ((TransformOperation)
instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
+ = ((TransformOperation) instr)
+
.executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
bi = image.getAsBufferedImage();
}
}
1.13 +5 -4
ant/src/main/org/apache/tools/ant/types/optional/image/Rotate.java
Index: Rotate.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/Rotate.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Rotate.java 9 Mar 2004 16:48:43 -0000 1.12
+++ Rotate.java 24 May 2005 17:17:29 -0000 1.13
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2004 The Apache Software Foundation
+ * Copyright 2002-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,12 +41,12 @@
public PlanarImage performRotate(PlanarImage image) {
- float t_angle = (float) (angle * (Math.PI / 180.0F));
+ float tAngle = (float) (angle * (Math.PI / 180.0F));
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
pb.add(0.0F);
pb.add(0.0F);
- pb.add(t_angle);
+ pb.add(tAngle);
pb.add(new InterpolationNearest());
return JAI.create("Rotate", pb, null);
}
@@ -72,7 +72,8 @@
bi = image.getAsBufferedImage();
graphics = (Graphics2D) bi.getGraphics();
System.out.println("Execing Transforms");
- image = ((TransformOperation)
instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
+ image = ((TransformOperation) instr)
+
.executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
bi = image.getAsBufferedImage();
}
}
1.13 +35 -32
ant/src/main/org/apache/tools/ant/types/optional/image/Scale.java
Index: Scale.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/Scale.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Scale.java 9 Mar 2004 16:48:43 -0000 1.12
+++ Scale.java 24 May 2005 17:17:29 -0000 1.13
@@ -29,10 +29,10 @@
*/
public class Scale extends TransformOperation implements DrawOperation {
- private String width_str = "100%";
- private String height_str = "100%";
- private boolean x_percent = true;
- private boolean y_percent = true;
+ private String widthStr = "100%";
+ private String heightStr = "100%";
+ private boolean xPercent = true;
+ private boolean yPercent = true;
private String proportions = "ignore";
public static class ProportionsAttribute extends EnumeratedAttribute {
@@ -52,68 +52,70 @@
* Sets the width of the image, either as an integer or a %. Defaults
to 100%.
*/
public void setWidth(String width) {
- width_str = width;
+ widthStr = width;
}
/**
* Sets the height of the image, either as an integer or a %. Defaults
to 100%.
*/
public void setHeight(String height) {
- height_str = height;
+ heightStr = height;
}
public float getWidth() {
float width = 0.0F;
- int perc_index = width_str.indexOf('%');
- if (perc_index > 0) {
- width = Float.parseFloat(width_str.substring(0, perc_index));
- x_percent = true;
+ int percIndex = widthStr.indexOf('%');
+ if (percIndex > 0) {
+ width = Float.parseFloat(widthStr.substring(0, percIndex));
+ xPercent = true;
return width / 100;
} else {
- x_percent = false;
- return Float.parseFloat(width_str);
+ xPercent = false;
+ return Float.parseFloat(widthStr);
}
}
public float getHeight() {
- int perc_index = height_str.indexOf('%');
- if (perc_index > 0) {
- float height = Float.parseFloat(height_str.substring(0,
perc_index));
- y_percent = true;
+ int percIndex = heightStr.indexOf('%');
+ if (percIndex > 0) {
+ float height = Float.parseFloat(heightStr.substring(0,
percIndex));
+ yPercent = true;
return height / 100;
} else {
- y_percent = false;
- return Float.parseFloat(height_str);
+ yPercent = false;
+ return Float.parseFloat(heightStr);
}
}
public PlanarImage performScale(PlanarImage image) {
ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
- float x_fl = getWidth();
- float y_fl = getHeight();
+ float xFl = getWidth();
+ float yFl = getHeight();
- if (!x_percent) {
- x_fl = (x_fl / image.getWidth());
+ if (!xPercent) {
+ xFl = (xFl / image.getWidth());
}
- if (!y_percent) {
- y_fl = (y_fl / image.getHeight());
+ if (!yPercent) {
+ yFl = (yFl / image.getHeight());
}
if ("width".equals(proportions)) {
- y_fl = x_fl;
+ yFl = xFl;
} else if ("height".equals(proportions)) {
- x_fl = y_fl;
+ xFl = yFl;
} else if ("fit".equals(proportions)) {
- x_fl = y_fl = Math.min(x_fl, y_fl);
+ yFl = Math.min(xFl, yFl);
+ xFl = yFl;
} else if ("cover".equals(proportions)) {
- x_fl = y_fl = Math.max(x_fl, y_fl);
+ yFl = Math.max(xFl, yFl);
+ xFl = yFl;
}
- pb.add(new Float(x_fl));
- pb.add(new Float(y_fl));
+ pb.add(new Float(xFl));
+ pb.add(new Float(yFl));
- log("\tScaling to " + (x_fl * 100) + "% x " + (y_fl * 100) + "%");
+ log("\tScaling to " + (xFl * 100) + "% x " + (yFl * 100) + "%");
return JAI.create("scale", pb);
}
@@ -127,7 +129,8 @@
return performScale(image);
} else if (instr instanceof TransformOperation) {
bi = image.getAsBufferedImage();
- image = ((TransformOperation)
instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
+ image = ((TransformOperation) instr)
+
.executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
bi = image.getAsBufferedImage();
}
}
1.7 +14 -10
ant/src/main/org/apache/tools/ant/types/optional/image/Text.java
Index: Text.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/types/optional/image/Text.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Text.java 9 Mar 2004 16:48:43 -0000 1.6
+++ Text.java 24 May 2005 17:17:29 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2002,2004 The Apache Software Foundation
+ * Copyright 2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
* @see org.apache.tools.ant.taskdefs.optional.image.Image
*/
public class Text extends ImageOperation implements DrawOperation {
- private String str_text = "";
+ private String strText = "";
private String font = "Arial";
private int point = 10;
private boolean bold = false;
@@ -37,7 +37,7 @@
private String color = "black";
public void setString(String str) {
- str_text = str;
+ strText = str;
}
public void setFont(String f) {
@@ -67,7 +67,7 @@
}
public PlanarImage executeDrawOperation() {
- log("\tCreating Text \"" + str_text + "\"");
+ log("\tCreating Text \"" + strText + "\"");
Color couloir = ColorMapper.getColorByName(color);
int width = 1;
@@ -75,23 +75,27 @@
BufferedImage bi = new BufferedImage(width, height,
BufferedImage.TYPE_4BYTE_ABGR_PRE);
Graphics2D graphics = (Graphics2D) bi.getGraphics();
- graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+ graphics.setRenderingHint(
+ RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ graphics.setRenderingHint(
+ RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
Font f = new Font(font, Font.PLAIN, point);
FontMetrics fmetrics = graphics.getFontMetrics(f);
height = fmetrics.getMaxAscent() + fmetrics.getMaxDescent();
- width = fmetrics.stringWidth(str_text);
+ width = fmetrics.stringWidth(strText);
bi = new BufferedImage(width, height,
BufferedImage.TYPE_4BYTE_ABGR_PRE);
graphics = (Graphics2D) bi.getGraphics();
- graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+ graphics.setRenderingHint(
+ RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ graphics.setRenderingHint(
+ RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics.setFont(f);
graphics.setColor(couloir);
- graphics.drawString(str_text, 0, height - fmetrics.getMaxDescent());
+ graphics.drawString(strText, 0, height - fmetrics.getMaxDescent());
PlanarImage image = PlanarImage.wrapRenderedImage(bi);
return image;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]