package com.gamepatriot.androidframework.framework;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;

/**
 * An AndroidShape implementation should provide a variety of methods to build and attach {@link AndroidBasicShape}s. In addition, the implementation should organizing them 
 * in a display list so they can be referenced and displayed by an {@link AndroidRenderer} implementation.
 * 
 * @author Pete Schmitz, May 9, 2013
 *
 */
public interface AndroidShape {
	
	/**
	 * Set the position of this AndroidShape, all {@link AndroidBasicShape} children will have their draws adjusted by this position.
	 * @param $x		The pixel-X position.
	 * @param $y		The pixel-Y position.
	 */
	public void setPosition(int $x, int $y);
	
	/** Set the default paint that childing basic shapes should use if they don't have an individual paint reference of their own. **/
	public void setDefaultPaint();
	
	/** 
	 * Enable shadows for all {@link AndroidBasicShape}s that this shape is parenting.
	 * @param $radius		The radius that the shadow should be.
	 * @param $offsetX		The pixel-X offset of the shadow.
	 * @param $offsetY		The pixel-Y offset of the shadow.
	 * @param $color		The color of the shadow.
	 */
	public void enableShadows(float $radius, float $offsetX, float $offsetY, int $color);
	
	/** Disable shadows for all {@link AndroidBasicShape}s that this shape is parenting. **/
	public void disableShadows();
	
	/**
	 * Draw all {@link AndroidBasicShape}s that this shape is parenting on the supplied canvas.
	 * @param $canvas		The canvas to draw on.
	 */
	public void draw(Canvas $canvas);
	
	/** Remove all {@link AndroidBasicShapes} from this shape's display list. **/
	public void clear();
	
	/** 
	 * Add a circle to this shape.
	 * 
	 * @param $p			The center point of the circle.
	 * @param $radius		The radius of the circle.
	 */
	public AndroidBasicShape addCircle(Point $p, float $radius);
	
	/** 
	 * Add a circle to this shape.
	 * 
	 * @param $p			The center point of the circle.
	 * @param $radius		The radius of the circle.
	 */
	public AndroidBasicShape addCircle(PointF $p, float $radius);
	
	/** 
	 * Add a circle to this shape.
	 * 
	 * @param $x			The center-X position of the circle.
	 * @param $y			The center-Y position of the circle.
	 * @param $radius		The radius of the circle.
	 */
	public AndroidBasicShape addCircle(int $x, int $y, float $radius);
	
	/** 
	 * Add a circle to this shape.
	 * 
	 * @param $p			The center point of the circle.
	 * @param $radius		The radius of the circle.
	 * @param $paint		The paint to be used while drawing the circle.
	 */
	public AndroidBasicShape addCircle(Point $p, float $radius, Paint $paint);
	
	/** 
	 * Add a circle to this shape.
	 * 
	 * @param $p			The center point of the circle.
	 * @param $radius		The radius of the circle.
	 * @param $paint		The paint to be used while drawing the circle.
	 */
	public AndroidBasicShape addCircle(PointF $p, float $radius, Paint $paint);
	
	/** 
	 * Add a circle to this shape.
	 * 
	 * @param $x			The center-X position of the circle.
	 * @param $y			The center-Y position of the circle.
	 * @param $radius		The radius of the circle.
	 * @param $paint		The paint to be used while drawing the circle.
	 */
	public AndroidBasicShape addCircle(int $x, int $y, float $radius, Paint $paint);
	
	/** 
	 * Add a rectangle to this shape.
	 * 
	 * @param $r			The rectangle to draw.
	 */
	public AndroidBasicShape addRect(Rect $r);
	
	/** 
	 * Add a rectangle to this shape.
	 * 
	 * @param $r			The rectangle to draw.
	 */
	public AndroidBasicShape addRect(RectF $r);
	
	/** 
	 * Add a rectangle to this shape.
	 * 
	 * @param $x			The X-position of the rectangle.
	 * @param $y			The Y-position of the rectangle.
	 * @param $width		The width of the rectangle.
	 * @param $height		The height of the rectangle.
	 */
	public AndroidBasicShape addRect(int $x, int $y, int $width, int $height);
	
	/** 
	 * Add a rectangle to this shape.
	 * 
	 * @param $r			The rectangle to draw.
	 * @param $paint		The paint to be used while drawing the rectangle.
	 */
	public AndroidBasicShape addRect(Rect $r, Paint $paint);
	
	/** 
	 * Add a rectangle to this shape.
	 * 
	 * @param $r			The rectangle to draw.
	 * @param $paint		The paint to be used while drawing the rectangle.
	 */
	public AndroidBasicShape addRect(RectF $r, Paint $paint);
	
	/** 
	 * Add a rectangle to this shape.
	 * 
	 * @param $x			The X-position of the rectangle.
	 * @param $y			The Y-position of the rectangle.
	 * @param $width		The width of the rectangle.
	 * @param $height		The height of the rectangle.
	 * @param $paint		The paint to be used while drawing the rectangle.
	 */
	public AndroidBasicShape addRect(int $x, int $y, int $width, int $height, Paint $paint);
	
	/** 
	 * Add a line to this shape.
	 * 
	 * @param $p1			The point to draw from.
	 * @param $p2			The point to draw to.
	 */
	public AndroidBasicShape addLine(Point $p1, Point $p2);
	
	/** 
	 * Add a line to this shape.
	 * 
	 * @param $p1			The point to draw from.
	 * @param $p2			The point to draw to.
	 */
	public AndroidBasicShape addLine(PointF $p1, PointF $p2);
	
	/** 
	 * Add a line to this shape.
	 * 
	 * @param $x1			The X-position to draw from.
	 * @param $y1			The Y-position to draw from.
	 * @param $x2			The X-position to draw to.
	 * @param $y2			The Y-position to draw to.
	 */
	public AndroidBasicShape addLine(int $x1, int $y1, int $x2, int $y2);
	
	/** 
	 * Add a line to this shape.
	 * 
	 * @param $p1			The point to draw from.
	 * @param $p2			The point to draw to.
	 * @param $paint		The paint to be used while drawing the line.
	 */
	public AndroidBasicShape addLine(Point $p1, Point $p2, Paint $paint);
	
	/** 
	 * Add a line to this shape.
	 * 
	 * @param $p1			The point to draw from.
	 * @param $p2			The point to draw to.
	 * @param $paint		The paint to be used while drawing the line.
	 */
	public AndroidBasicShape addLine(PointF $p1, PointF $p2, Paint $paint);
	
	/** 
	 * Add a line to this shape.
	 * 
	 * @param $x1			The X-position to draw from.
	 * @param $y1			The Y-position to draw from.
	 * @param $x2			The X-position to draw to.
	 * @param $y2			The Y-position to draw to.
	 * @param $paint		The paint to be used while drawing the line.
	 */
	public AndroidBasicShape addLine(int $x1, int $y1, int $x2, int $y2, Paint $paint);
	
	/** 
	 * Add text to this shape.
	 * 
	 * @param $text			The text to draw.
	 * @param $size			The font size of the text.
	 * @param $p			The point to draw from.
	 */
	public AndroidBasicShape addText(String $text, float $size, Point $p);
	
	/** 
	 * Add text to this shape.
	 * 
	 * @param $text			The text to draw.
	 * @param $size			The font size of the text.
	 * @param $p			The point to draw from.
	 */
	public AndroidBasicShape addText(String $text, float $size, PointF $p);
	
	/** 
	 * Add text to this shape.
	 * 
	 * @param $text			The text to draw.
	 * @param $size			The font size of the text.
	 * @param $x			The X-position to draw from.
	 * @param $y			The Y-position to draw from.
	 */
	public AndroidBasicShape addText(String $text, float $size, int $x, int $y);
	
	/** 
	 * Add text to this shape.
	 * 
	 * @param $text			The text to draw.
	 * @param $size			The font size of the text.
	 * @param $p			The point to draw from.
	 * @param $paint		The paint to draw the text with.
	 */
	public AndroidBasicShape addText(String $text, float $size, Point $p, Paint $paint);
	
	/** 
	 * Add text to this shape.
	 * 
	 * @param $text			The text to draw.
	 * @param $size			The font size of the text.
	 * @param $p			The point to draw from.
	 * @param $paint		The paint to draw the text with.
	 */
	public AndroidBasicShape addText(String $text, float $size, PointF $p, Paint $paint);
	
	/** 
	 * Add text to this shape.
	 * 
	 * @param $text			The text to draw.
	 * @param $size			The font size of the text.
	 * @param $x			The X-position to draw from.
	 * @param $y			The Y-position to draw from.
	 * @param $paint		The paint to draw the text with.
	 */
	public AndroidBasicShape addText(String $text, float $size, int $x, int $y, Paint $paint);
	
	/** 
	 * Add a polygon to this shape.
	 * 
	 * @param $points		The points to draw the polygon's path with ({x1, y1, x2, y2, ... }).
	 */
	public AndroidBasicShape addPoly(float[] $points);
	
	/** 
	 * Add a polygon to this shape.
	 * 
	 * @param $x			The center-X position of the polygon.
	 * @param $y			The center-Y position of the polygon.
	 * @param $numberPoints	The number of sides/points the polygon will contain.
	 * @param $degreeAngle	The rotation of the polygon.
	 * @param $radius		The radius the polygon will be drawn at.
	 */
	public AndroidBasicShape addPoly(int $x, int $y, int $numberPoints, float $degreeAngle, float $radius);
	
	/** 
	 * Add a polygon to this shape.
	 * 
	 * @param $points		The points to draw then polygon's path with ({x1, y1, x2, y2, ... }).
	 * @param $paint		The paint to draw the polygon with.
	 */
	public AndroidBasicShape addPoly(float[] $points, Paint $paint);
	
	/** 
	 * Add a polygon to this shape.
	 * 
	 * @param $x			The center-X position of the polygon.
	 * @param $y			The center-Y position of the polygon.
	 * @param $numberPoints	The number of sides/points the polygon should contain.
	 * @param $degreeAngle	The rotation of the polygon.
	 * @param $radius		The radius the polygon will be drawn at.
	 * @param $paint		The paint to draw the polygon with.
	 */
	public AndroidBasicShape addPoly(int $x, int $y, int $numberPoints, float $degreeAngle, float $radius, Paint $paint);
	
	/** 
	 * Remove an {@link AndroidBasicShape} from this shape's display list.
	 * 
	 * @param $bShape		The shape to remove.
	 * @return				Whether or not this shape was the AndroidBasicShape's parent and was removed.
	 */
	public boolean removeBasicShape(AndroidBasicShape $bShape);
	
	/** Return the parent of this shape; null if no parent. **/
	public AndroidScreen getParent();
	
	/** Remove this shape from its parent if it has one. **/
	public void removeFromParent();
	
	/** Return whether or not this shape has a parent. **/
	public boolean hasParent();
	
	/** Assign a parent to this shape. **/
	public void setParent(AndroidScreen $screen);
	
}
