import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import java.io.File;


/**
 * TODO Put here a description of what this class does.
 *
 * @author Bryan Warner
 *         Created Apr 10, 2008.
 */
public class EllipseFillTool extends Tool{
	/**
	 * this constructor is pulled from the superclass. to make the icon and the name of the tool
	 *
	 */
	public EllipseFillTool(){
		super(20,new File("Ellispefill.bmp"),"filled ellipse");			
	}
		
		
	@Override
	public void finish(){
		this.x=-1;
		this.y=-1;
		Graphics2D g  = this.c.getImage().createGraphics();
		g.setColor(this.c.getPaint().cc.getColor());
		g.fill(this.c.getShape());
		this.c.setShape(null);
		this.c.repaint();
	}
	@Override
	public void Paint(Canvas c, int x, int y){
		if(this.x != -1 && this.y != -1){
			Ellipse2D.Double e = new Ellipse2D.Double(this.x,this.y,x-this.x,y-this.y);
			this.c.setShape(e);
		}
		else{
		this.c = c;
		this.x = x;
		this.y = y;
		}
	}

}