com.mebigfatguy.polycasso
Class PolygonData

java.lang.Object
  extended by com.mebigfatguy.polycasso.PolygonData
All Implemented Interfaces:
java.lang.Cloneable

public class PolygonData
extends java.lang.Object
implements java.lang.Cloneable

a class for holding the information for one polygon, including points, color and alpha level.


Constructor Summary
PolygonData(java.awt.Color c, float xpar, java.awt.Polygon poly)
          creates a polygon data structure with required information
 
Method Summary
 java.lang.Object clone()
          clones this polygon data data
 void draw(java.awt.Graphics2D g)
          draws this polygondata on a specified graphics object
 float getAlpha()
          gets the transparency of this polygon: 0.0 is transparent, 1.0 is opaque
 java.awt.Color getColor()
          retrieves the color of this polygon
 java.awt.Polygon getPolygon()
          retrieve the polygon (points) of this polygondata
static PolygonData randomPoly(java.awt.Dimension size, int maxPoints)
          creates a totally random polygon that is limited by the specified size
 void setAlpha(float xpar)
          sets the transparency of this polygon: 0.0 is transparent, 1.0 is opaque
 void setColor(java.awt.Color newColor)
          sets the color of this polygon
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PolygonData

public PolygonData(java.awt.Color c,
                   float xpar,
                   java.awt.Polygon poly)
creates a polygon data structure with required information

Parameters:
c - the color of the polygon
xpar - the alpha level of the polygon
poly - the points of the polygon
Method Detail

getPolygon

public java.awt.Polygon getPolygon()
retrieve the polygon (points) of this polygondata

Returns:
a polygon

getAlpha

public float getAlpha()
gets the transparency of this polygon: 0.0 is transparent, 1.0 is opaque

Returns:
the transparency value

setAlpha

public void setAlpha(float xpar)
sets the transparency of this polygon: 0.0 is transparent, 1.0 is opaque

Parameters:
xpar - the transparency value

getColor

public java.awt.Color getColor()
retrieves the color of this polygon

Returns:
the polygon color

setColor

public void setColor(java.awt.Color newColor)
sets the color of this polygon

Parameters:
newColor - the new color to use

randomPoly

public static PolygonData randomPoly(java.awt.Dimension size,
                                     int maxPoints)
creates a totally random polygon that is limited by the specified size

Parameters:
size - the maximum size of the bounding box of the polygon
maxPoints - the maximum number of points to generate
Returns:
a random polygon

clone

public java.lang.Object clone()
clones this polygon data data

Overrides:
clone in class java.lang.Object
Returns:
a copy of the polygon data

draw

public void draw(java.awt.Graphics2D g)
draws this polygondata on a specified graphics object

Parameters:
g - the graphics object on which to draw this polygon

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2009-2010 MeBigFatGuy.com. All Rights Reserved.