package graphics.java;
import factories.Boxes;
import graphics.common.Size;
import graphics.common.Point;
import graphics.common.Size2D;
import graphics.common.GraphicsObject;
import graphics.common.Point2D;
import factories.Points;
import factories.Sizes;
import graphics.common.Box;
import java.awt.Color;
import java.awt.Graphics2D;
public class Oval implements GraphicsObject {
private Point mPoint;
private Size mSize;
private Color mColor;
public Oval() {
mPoint = new Point2D( 0.0, 0.0 );
mSize = new Size2D( 0.0, 0.0 );
mColor = new Color( 0, 0, 0 );
}
public Oval( Point p, Size s ) {
mPoint = p;
mSize = s;
mColor = new Color( 0, 0, 0 );
}
public Oval( Point p, Size s, Color c ) {
mPoint = p;
mSize = s;
mColor = c;
}
public void setColor( Color c ) {
mColor = c;
}
@Override
public void draw( Graphics2D g, double delta ) {
Color orig = g.getColor();
g.setColor( mColor );
g.fillOval( (int) mPoint.getX(), (int) mPoint.getY(),
(int) mSize.getWidth(), (int) mSize.getHeight() );
g.setColor( orig );
}
@Override
public String getName() {
return "ellipse";
}
@Override
public Point[] getPoints() {
Point[] ret = { mPoint };
return ret;
}
@Override
public Size[] getSize() {
Size[] ret = { mSize };
return ret;
}
@Override
public Box[] getBox() {
return new Box[] { Boxes.get( mPoint, mSize ) };
}
@Override
public void dispose() {
}
}