git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@475076 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -23,30 +23,53 @@ import java.awt.Graphics2D; | |||||
| import java.awt.geom.Arc2D; | import java.awt.geom.Arc2D; | ||||
| import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||
| /** | |||||
| * Draw an arc. | |||||
| */ | |||||
| public class Arc extends BasicShape implements DrawOperation { | public class Arc extends BasicShape implements DrawOperation { | ||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| protected int width = 0; | protected int width = 0; | ||||
| protected int height = 0; | protected int height = 0; | ||||
| protected int start = 0; | protected int start = 0; | ||||
| protected int stop = 0; | protected int stop = 0; | ||||
| protected int type = Arc2D.OPEN; | protected int type = Arc2D.OPEN; | ||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** | |||||
| * Set the width. | |||||
| * @param width the width of the arc. | |||||
| */ | |||||
| public void setWidth(int width) { | public void setWidth(int width) { | ||||
| this.width = width; | this.width = width; | ||||
| } | } | ||||
| /** | |||||
| * Set the height. | |||||
| * @param height the height of the arc. | |||||
| */ | |||||
| public void setHeight(int height) { | public void setHeight(int height) { | ||||
| this.height = height; | this.height = height; | ||||
| } | } | ||||
| /** | |||||
| * Set the start of the arc. | |||||
| * @param start the start of the arc. | |||||
| */ | |||||
| public void setStart(int start) { | public void setStart(int start) { | ||||
| this.start = start; | this.start = start; | ||||
| } | } | ||||
| /** | |||||
| * Set the stop of the arc. | |||||
| * @param stop the stop of the arc. | |||||
| */ | |||||
| public void setStop(int stop) { | public void setStop(int stop) { | ||||
| this.stop = stop; | this.stop = stop; | ||||
| } | } | ||||
| /** | /** | ||||
| * Set the type of arc. | |||||
| * @param strType the type to use - open, pie or chord. | |||||
| * @todo refactor using an EnumeratedAttribute | * @todo refactor using an EnumeratedAttribute | ||||
| */ | */ | ||||
| public void setType(String strType) { | public void setType(String strType) { | ||||
| @@ -59,6 +82,7 @@ public class Arc extends BasicShape implements DrawOperation { | |||||
| } | } | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage executeDrawOperation() { | public PlanarImage executeDrawOperation() { | ||||
| BufferedImage bi = new BufferedImage(width + (stroke_width * 2), | BufferedImage bi = new BufferedImage(width + (stroke_width * 2), | ||||
| height + (stroke_width * 2), BufferedImage.TYPE_4BYTE_ABGR_PRE); | height + (stroke_width * 2), BufferedImage.TYPE_4BYTE_ABGR_PRE); | ||||
| @@ -17,20 +17,38 @@ | |||||
| */ | */ | ||||
| package org.apache.tools.ant.types.optional.image; | package org.apache.tools.ant.types.optional.image; | ||||
| /** Draw a basic shape */ | |||||
| public abstract class BasicShape extends ImageOperation implements DrawOperation { | public abstract class BasicShape extends ImageOperation implements DrawOperation { | ||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| // CheckStyle:MemberNameCheck OFF - bc | |||||
| protected int stroke_width = 0; | protected int stroke_width = 0; | ||||
| // CheckStyle:MemberNameCheck ON | |||||
| protected String fill = "transparent"; | protected String fill = "transparent"; | ||||
| protected String stroke = "black"; | protected String stroke = "black"; | ||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** | |||||
| * Set the fill attribute. | |||||
| * @param col the color value to use. | |||||
| */ | |||||
| public void setFill(String col) { | public void setFill(String col) { | ||||
| fill = col; | fill = col; | ||||
| } | } | ||||
| /** | |||||
| * Set the stroke attribute. | |||||
| * @param col the color value to use. | |||||
| */ | |||||
| public void setStroke(String col) { | public void setStroke(String col) { | ||||
| stroke = col; | stroke = col; | ||||
| } | } | ||||
| /** | |||||
| * Set the stroke width attribute. | |||||
| * @param width the value to use. | |||||
| */ | |||||
| public void setStrokewidth(int width) { | public void setStrokewidth(int width) { | ||||
| stroke_width = width; | stroke_width = width; | ||||
| } | } | ||||
| @@ -24,6 +24,10 @@ import java.awt.Color; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public final class ColorMapper { | public final class ColorMapper { | ||||
| /** private constructor for Utility class */ | |||||
| private ColorMapper() { | |||||
| } | |||||
| /** black string */ | /** black string */ | ||||
| public static final String COLOR_BLACK = "black"; | public static final String COLOR_BLACK = "black"; | ||||
| /** blue string */ | /** blue string */ | ||||
| @@ -59,6 +63,9 @@ public final class ColorMapper { | |||||
| public static final String COLOR_YELLOW = "yellow"; | public static final String COLOR_YELLOW = "yellow"; | ||||
| /** | /** | ||||
| * Convert a color name to a color value. | |||||
| * @param colorName a string repr of the color. | |||||
| * @return the color value. | |||||
| * @todo refactor to use an EnumeratedAttribute (maybe?) | * @todo refactor to use an EnumeratedAttribute (maybe?) | ||||
| */ | */ | ||||
| public static Color getColorByName(String colorName) { | public static Color getColorByName(String colorName) { | ||||
| @@ -26,34 +26,54 @@ import java.awt.image.BufferedImage; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public class Draw extends TransformOperation { | public class Draw extends TransformOperation { | ||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| protected int xloc = 0; | protected int xloc = 0; | ||||
| protected int yloc = 0; | protected int yloc = 0; | ||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** | |||||
| * Set the X location. | |||||
| * @param x the value to use. | |||||
| */ | |||||
| public void setXloc(int x) { | public void setXloc(int x) { | ||||
| xloc = x; | xloc = x; | ||||
| } | } | ||||
| /** | |||||
| * Set the Y location. | |||||
| * @param y the value to use. | |||||
| */ | |||||
| public void setYloc(int y) { | public void setYloc(int y) { | ||||
| yloc = y; | yloc = y; | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public void addRectangle(Rectangle rect) { | public void addRectangle(Rectangle rect) { | ||||
| instructions.add(rect); | instructions.add(rect); | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public void addText(Text text) { | public void addText(Text text) { | ||||
| instructions.add(text); | instructions.add(text); | ||||
| } | } | ||||
| /** | |||||
| * Add an ellipse. | |||||
| * @param elip the ellipse to add. | |||||
| */ | |||||
| public void addEllipse(Ellipse elip) { | public void addEllipse(Ellipse elip) { | ||||
| instructions.add(elip); | instructions.add(elip); | ||||
| } | } | ||||
| /** | |||||
| * Add an arc. | |||||
| * @param arc the arc to add. | |||||
| */ | |||||
| public void addArc(Arc arc) { | public void addArc(Arc arc) { | ||||
| instructions.add(arc); | instructions.add(arc); | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage executeTransformOperation(PlanarImage image) { | public PlanarImage executeTransformOperation(PlanarImage image) { | ||||
| BufferedImage bi = image.getAsBufferedImage(); | BufferedImage bi = image.getAsBufferedImage(); | ||||
| Graphics2D graphics = (Graphics2D) bi.getGraphics(); | Graphics2D graphics = (Graphics2D) bi.getGraphics(); | ||||
| @@ -24,21 +24,32 @@ import java.awt.geom.Ellipse2D; | |||||
| import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||
| /** | /** | ||||
| * | |||||
| * Draw an ellipse. | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public class Ellipse extends BasicShape implements DrawOperation { | public class Ellipse extends BasicShape implements DrawOperation { | ||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| protected int width = 0; | protected int width = 0; | ||||
| protected int height = 0; | protected int height = 0; | ||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** | |||||
| * Set the width. | |||||
| * @param width the width of the elipse. | |||||
| */ | |||||
| public void setWidth(int width) { | public void setWidth(int width) { | ||||
| this.width = width; | this.width = width; | ||||
| } | } | ||||
| /** | |||||
| * Set the height. | |||||
| * @param height the height of the elipse. | |||||
| */ | |||||
| public void setHeight(int height) { | public void setHeight(int height) { | ||||
| this.height = height; | this.height = height; | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage executeDrawOperation() { | public PlanarImage executeDrawOperation() { | ||||
| BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE); | BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE); | ||||
| @@ -25,25 +25,47 @@ import java.util.Vector; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public abstract class ImageOperation extends DataType { | public abstract class ImageOperation extends DataType { | ||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| protected Vector instructions = new Vector(); | protected Vector instructions = new Vector(); | ||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** | |||||
| * Add a rotate to the operation. | |||||
| * @param instr the rotate to add. | |||||
| */ | |||||
| public void addRotate(Rotate instr) { | public void addRotate(Rotate instr) { | ||||
| instructions.add(instr); | instructions.add(instr); | ||||
| } | } | ||||
| /** | |||||
| * Add a draw to the operation. | |||||
| * @param instr the draw to add. | |||||
| */ | |||||
| public void addDraw(Draw instr) { | public void addDraw(Draw instr) { | ||||
| instructions.add(instr); | instructions.add(instr); | ||||
| } | } | ||||
| /** | |||||
| * Add a rectangle to the operation. | |||||
| * @param instr the rectangle to add. | |||||
| */ | |||||
| public void addRectangle(Rectangle instr) { | public void addRectangle(Rectangle instr) { | ||||
| instructions.add(instr); | instructions.add(instr); | ||||
| } | } | ||||
| /** | |||||
| * Add text to the operation. | |||||
| * @param instr the text to add. | |||||
| */ | |||||
| public void addText(Text instr) { | public void addText(Text instr) { | ||||
| instructions.add(instr); | instructions.add(instr); | ||||
| } | } | ||||
| /** | |||||
| * Add a scale to the operation. | |||||
| * @param instr the scale to add. | |||||
| */ | |||||
| public void addScale(Scale instr) { | public void addScale(Scale instr) { | ||||
| instructions.add(instr); | instructions.add(instr); | ||||
| } | } | ||||
| } | |||||
| } | |||||
| @@ -27,27 +27,46 @@ import java.awt.image.BufferedImage; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public class Rectangle extends BasicShape implements DrawOperation { | public class Rectangle extends BasicShape implements DrawOperation { | ||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| protected int width = 0; | protected int width = 0; | ||||
| protected int height = 0; | protected int height = 0; | ||||
| protected int arcwidth = 0; | protected int arcwidth = 0; | ||||
| protected int archeight = 0; | protected int archeight = 0; | ||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** | |||||
| * Set the width. | |||||
| * @param w the value to use. | |||||
| */ | |||||
| public void setWidth(int w) { | public void setWidth(int w) { | ||||
| width = w; | width = w; | ||||
| } | } | ||||
| /** | |||||
| * Set the height. | |||||
| * @param h the value to use. | |||||
| */ | |||||
| public void setHeight(int h) { | public void setHeight(int h) { | ||||
| height = h; | height = h; | ||||
| } | } | ||||
| /** | |||||
| * Set the arc width. | |||||
| * @param w the value to use. | |||||
| */ | |||||
| public void setArcwidth(int w) { | public void setArcwidth(int w) { | ||||
| arcwidth = w; | arcwidth = w; | ||||
| } | } | ||||
| /** | |||||
| * Set the arc height. | |||||
| * @param h the value to use. | |||||
| */ | |||||
| public void setArcheight(int h) { | public void setArcheight(int h) { | ||||
| archeight = h; | archeight = h; | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage executeDrawOperation() { | public PlanarImage executeDrawOperation() { | ||||
| log("\tCreating Rectangle w=" + width + " h=" + height + " arcw=" | log("\tCreating Rectangle w=" + width + " h=" + height + " arcw=" | ||||
| + arcwidth + " arch=" + archeight); | + arcwidth + " arch=" + archeight); | ||||
| @@ -30,7 +30,11 @@ import java.awt.Graphics2D; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public class Rotate extends TransformOperation implements DrawOperation { | public class Rotate extends TransformOperation implements DrawOperation { | ||||
| private static final float HALF_CIRCLE = 180.0F; | |||||
| // CheckStyle:VisibilityModifier OFF - bc | |||||
| protected float angle = 0.0F; | protected float angle = 0.0F; | ||||
| // CheckStyle:VisibilityModifier ON | |||||
| /** | /** | ||||
| * Sets the angle of rotation in degrees. | * Sets the angle of rotation in degrees. | ||||
| @@ -41,8 +45,9 @@ public class Rotate extends TransformOperation implements DrawOperation { | |||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage performRotate(PlanarImage image) { | public PlanarImage performRotate(PlanarImage image) { | ||||
| float tAngle = (float) (angle * (Math.PI / 180.0F)); | |||||
| float tAngle = (float) (angle * (Math.PI / HALF_CIRCLE)); | |||||
| ParameterBlock pb = new ParameterBlock(); | ParameterBlock pb = new ParameterBlock(); | ||||
| pb.addSource(image); | pb.addSource(image); | ||||
| pb.add(0.0F); | pb.add(0.0F); | ||||
| @@ -54,8 +59,9 @@ public class Rotate extends TransformOperation implements DrawOperation { | |||||
| /** | /** | ||||
| * Performs the image rotation when being handled as a TransformOperation. | |||||
| * Performs the image rotation when being handled as a TransformOperation. | |||||
| * @param image The image to perform the transformation on. | * @param image The image to perform the transformation on. | ||||
| * @return the transformed image. | |||||
| */ | */ | ||||
| public PlanarImage executeTransformOperation(PlanarImage image) { | public PlanarImage executeTransformOperation(PlanarImage image) { | ||||
| BufferedImage bi = null; | BufferedImage bi = null; | ||||
| @@ -89,6 +95,7 @@ public class Rotate extends TransformOperation implements DrawOperation { | |||||
| * It absolutely requires that there be a DrawOperation nested beneath it, | * It absolutely requires that there be a DrawOperation nested beneath it, | ||||
| * but only the FIRST DrawOperation will be handled since it can only return | * but only the FIRST DrawOperation will be handled since it can only return | ||||
| * ONE image. | * ONE image. | ||||
| * @return the image. | |||||
| */ | */ | ||||
| public PlanarImage executeDrawOperation() { | public PlanarImage executeDrawOperation() { | ||||
| for (int i = 0; i < instructions.size(); i++) { | for (int i = 0; i < instructions.size(); i++) { | ||||
| @@ -29,6 +29,7 @@ import java.awt.image.renderable.ParameterBlock; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public class Scale extends TransformOperation implements DrawOperation { | public class Scale extends TransformOperation implements DrawOperation { | ||||
| private static final int HUNDRED = 100; | |||||
| private String widthStr = "100%"; | private String widthStr = "100%"; | ||||
| private String heightStr = "100%"; | private String heightStr = "100%"; | ||||
| @@ -36,7 +37,9 @@ public class Scale extends TransformOperation implements DrawOperation { | |||||
| private boolean yPercent = true; | private boolean yPercent = true; | ||||
| private String proportions = "ignore"; | private String proportions = "ignore"; | ||||
| /** Enumerated class for proportions attribute. */ | |||||
| public static class ProportionsAttribute extends EnumeratedAttribute { | public static class ProportionsAttribute extends EnumeratedAttribute { | ||||
| /** {@inheritDoc}. */ | |||||
| public String[] getValues() { | public String[] getValues() { | ||||
| return new String[] {"ignore", "width", "height", "cover", "fit"}; | return new String[] {"ignore", "width", "height", "cover", "fit"}; | ||||
| } | } | ||||
| @@ -44,13 +47,16 @@ public class Scale extends TransformOperation implements DrawOperation { | |||||
| /** | /** | ||||
| * Sets the behaviour regarding the image proportions. | * Sets the behaviour regarding the image proportions. | ||||
| * @param pa the enumerated value. | |||||
| */ | */ | ||||
| public void setProportions(ProportionsAttribute pa) { | public void setProportions(ProportionsAttribute pa) { | ||||
| proportions = pa.getValue(); | proportions = pa.getValue(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Sets the width of the image, either as an integer or a %. Defaults to 100%. | |||||
| * Sets the width of the image, either as an integer or a %. | |||||
| * Defaults to 100%. | |||||
| * @param width the value to use. | |||||
| */ | */ | ||||
| public void setWidth(String width) { | public void setWidth(String width) { | ||||
| widthStr = width; | widthStr = width; | ||||
| @@ -58,36 +64,46 @@ public class Scale extends TransformOperation implements DrawOperation { | |||||
| /** | /** | ||||
| * Sets the height of the image, either as an integer or a %. Defaults to 100%. | * Sets the height of the image, either as an integer or a %. Defaults to 100%. | ||||
| * @param height the value to use. | |||||
| */ | */ | ||||
| public void setHeight(String height) { | public void setHeight(String height) { | ||||
| heightStr = height; | heightStr = height; | ||||
| } | } | ||||
| /** | |||||
| * Get the width. | |||||
| * @return the value converted from the width string. | |||||
| */ | |||||
| public float getWidth() { | public float getWidth() { | ||||
| float width = 0.0F; | float width = 0.0F; | ||||
| int percIndex = widthStr.indexOf('%'); | int percIndex = widthStr.indexOf('%'); | ||||
| if (percIndex > 0) { | if (percIndex > 0) { | ||||
| width = Float.parseFloat(widthStr.substring(0, percIndex)); | width = Float.parseFloat(widthStr.substring(0, percIndex)); | ||||
| xPercent = true; | xPercent = true; | ||||
| return width / 100; | |||||
| return width / HUNDRED; | |||||
| } else { | } else { | ||||
| xPercent = false; | xPercent = false; | ||||
| return Float.parseFloat(widthStr); | return Float.parseFloat(widthStr); | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Get the height. | |||||
| * @return the value converted from the height string. | |||||
| */ | |||||
| public float getHeight() { | public float getHeight() { | ||||
| int percIndex = heightStr.indexOf('%'); | int percIndex = heightStr.indexOf('%'); | ||||
| if (percIndex > 0) { | if (percIndex > 0) { | ||||
| float height = Float.parseFloat(heightStr.substring(0, percIndex)); | float height = Float.parseFloat(heightStr.substring(0, percIndex)); | ||||
| yPercent = true; | yPercent = true; | ||||
| return height / 100; | |||||
| return height / HUNDRED; | |||||
| } else { | } else { | ||||
| yPercent = false; | yPercent = false; | ||||
| return Float.parseFloat(heightStr); | return Float.parseFloat(heightStr); | ||||
| } | } | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage performScale(PlanarImage image) { | public PlanarImage performScale(PlanarImage image) { | ||||
| ParameterBlock pb = new ParameterBlock(); | ParameterBlock pb = new ParameterBlock(); | ||||
| pb.addSource(image); | pb.addSource(image); | ||||
| @@ -116,12 +132,14 @@ public class Scale extends TransformOperation implements DrawOperation { | |||||
| pb.add(new Float(xFl)); | pb.add(new Float(xFl)); | ||||
| pb.add(new Float(yFl)); | pb.add(new Float(yFl)); | ||||
| log("\tScaling to " + (xFl * 100) + "% x " + (yFl * 100) + "%"); | |||||
| log("\tScaling to " + (xFl * HUNDRED) + "% x " | |||||
| + (yFl * HUNDRED) + "%"); | |||||
| return JAI.create("scale", pb); | return JAI.create("scale", pb); | ||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage executeTransformOperation(PlanarImage image) { | public PlanarImage executeTransformOperation(PlanarImage image) { | ||||
| BufferedImage bi = null; | BufferedImage bi = null; | ||||
| for (int i = 0; i < instructions.size(); i++) { | for (int i = 0; i < instructions.size(); i++) { | ||||
| @@ -139,6 +157,7 @@ public class Scale extends TransformOperation implements DrawOperation { | |||||
| } | } | ||||
| /** {@inheritDoc}. */ | |||||
| public PlanarImage executeDrawOperation() { | public PlanarImage executeDrawOperation() { | ||||
| for (int i = 0; i < instructions.size(); i++) { | for (int i = 0; i < instructions.size(); i++) { | ||||
| ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); | ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); | ||||
| @@ -30,31 +30,50 @@ import java.awt.image.BufferedImage; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public class Text extends ImageOperation implements DrawOperation { | public class Text extends ImageOperation implements DrawOperation { | ||||
| private static final int DEFAULT_POINT = 10; | |||||
| private String strText = ""; | private String strText = ""; | ||||
| private String font = "Arial"; | private String font = "Arial"; | ||||
| private int point = 10; | |||||
| private int point = DEFAULT_POINT; | |||||
| private boolean bold = false; | private boolean bold = false; | ||||
| private boolean italic = false; | private boolean italic = false; | ||||
| private String color = "black"; | private String color = "black"; | ||||
| /** | |||||
| * Set the string to be used as text. | |||||
| * @param str the string to be used. | |||||
| */ | |||||
| public void setString(String str) { | public void setString(String str) { | ||||
| strText = str; | strText = str; | ||||
| } | } | ||||
| /** | |||||
| * Set the font to be used to draw the text. | |||||
| * @param f the font to be used. | |||||
| */ | |||||
| public void setFont(String f) { | public void setFont(String f) { | ||||
| font = f; | font = f; | ||||
| } | } | ||||
| /** | |||||
| * Set the number of points to be used. | |||||
| * @param p an integer value as a string. | |||||
| */ | |||||
| public void setPoint(String p) { | public void setPoint(String p) { | ||||
| point = Integer.parseInt(p); | point = Integer.parseInt(p); | ||||
| } | } | ||||
| /** | |||||
| * Set the color of the text. | |||||
| * @param c the color name. | |||||
| */ | |||||
| public void setColor(String c) { | public void setColor(String c) { | ||||
| color = c; | color = c; | ||||
| } | } | ||||
| /** | /** | ||||
| * @todo is this used? | * @todo is this used? | ||||
| * @param state not used at the moment. | |||||
| */ | */ | ||||
| public void setBold(boolean state) { | public void setBold(boolean state) { | ||||
| bold = state; | bold = state; | ||||
| @@ -62,11 +81,16 @@ public class Text extends ImageOperation implements DrawOperation { | |||||
| /** | /** | ||||
| * @todo is this used? | * @todo is this used? | ||||
| * @param state not used at the moment. | |||||
| */ | */ | ||||
| public void setItalic(boolean state) { | public void setItalic(boolean state) { | ||||
| italic = state; | italic = state; | ||||
| } | } | ||||
| /** | |||||
| * Draw the text. | |||||
| * @return the resultant image. | |||||
| */ | |||||
| public PlanarImage executeDrawOperation() { | public PlanarImage executeDrawOperation() { | ||||
| log("\tCreating Text \"" + strText + "\""); | log("\tCreating Text \"" + strText + "\""); | ||||
| @@ -23,10 +23,15 @@ import javax.media.jai.PlanarImage; | |||||
| * @see org.apache.tools.ant.taskdefs.optional.image.Image | * @see org.apache.tools.ant.taskdefs.optional.image.Image | ||||
| */ | */ | ||||
| public abstract class TransformOperation extends ImageOperation { | public abstract class TransformOperation extends ImageOperation { | ||||
| /** | |||||
| * Performs the transformations. | |||||
| * @param img The image to perform the transformation on. | |||||
| * @return the transformed image. | |||||
| */ | |||||
| public abstract PlanarImage executeTransformOperation(PlanarImage img); | public abstract PlanarImage executeTransformOperation(PlanarImage img); | ||||
| /** {@inheritDoc}. */ | |||||
| public void addRectangle(Rectangle instr) { | public void addRectangle(Rectangle instr) { | ||||
| instructions.add(instr); | instructions.add(instr); | ||||
| } | } | ||||
| } | |||||
| } | |||||