FileDocCategorySizeDatePackage
Draw.javaAPI DocApache Ant 1.703158Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.types.optional.image

Draw

public class Draw extends TransformOperation
see
org.apache.tools.ant.taskdefs.optional.image.Image

Fields Summary
protected int
xloc
protected int
yloc
Constructors Summary
Methods Summary
public voidaddArc(Arc arc)
Add an arc.

param
arc the arc to add.

        instructions.add(arc);
    
public voidaddEllipse(Ellipse elip)
Add an ellipse.

param
elip the ellipse to add.

        instructions.add(elip);
    
public voidaddRectangle(Rectangle rect)
{@inheritDoc}.

        instructions.add(rect);
    
public voidaddText(Text text)
{@inheritDoc}.

        instructions.add(text);
    
public javax.media.jai.PlanarImageexecuteTransformOperation(javax.media.jai.PlanarImage image)
{@inheritDoc}.

        BufferedImage bi = image.getAsBufferedImage();
        Graphics2D graphics = (Graphics2D) bi.getGraphics();

        for (int i = 0; i < instructions.size(); i++) {
            ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
            if (instr instanceof DrawOperation) {
                PlanarImage op = ((DrawOperation) instr).executeDrawOperation();
                log("\tDrawing to x=" + xloc + " y=" + yloc);
                graphics.drawImage(op.getAsBufferedImage(), null, xloc, yloc);
            } else if (instr instanceof TransformOperation) {
                PlanarImage op
                    = ((TransformOperation) instr).executeTransformOperation(null);
                BufferedImage child = op.getAsBufferedImage();
                log("\tDrawing to x=" + xloc + " y=" + yloc);
                graphics.drawImage(child, null, xloc, yloc);
                PlanarImage.wrapRenderedImage(bi);
            }
        }
        image = PlanarImage.wrapRenderedImage(bi);

        return image;
    
public voidsetXloc(int x)
Set the X location.

param
x the value to use.

    // CheckStyle:VisibilityModifier ON

                   
        
        xloc = x;
    
public voidsetYloc(int y)
Set the Y location.

param
y the value to use.

        yloc = y;