|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--Forms.Forms
|
+--Forms.MyPolygon
This class construct a new polygon.
Forms| Field Summary | |
protected int |
lastX
The last x coordinate the polygon has been translated. |
protected int |
lastY
The last y coordinate the polygon has been translated. |
protected Polygon |
polygon
The polygon. |
protected boolean |
polygonDrawn
Boolean to know if the polygon is drawn or not. |
protected int |
precision
The precision of the polygon i.e: The user must specifies the last point of the polygon at least precision near the first point. |
| Fields inherited from class Forms.Forms |
rectangle |
| Constructor Summary | |
MyPolygon(int precision)
The constructor. |
|
| Method Summary | |
void |
drawPolygon(int[] pixels,
int width,
int height,
int x,
int y,
Color color)
This method draw a polygon in a given array of pixels with the specified color. |
void |
drawPolygonWithTexture(int[] pixels,
int width,
int height,
Texture texture)
This method draw a polygon with the given texture. |
void |
drawSegment(int[] pixels,
int width,
int height,
int[] firstPoint,
int[] secondPoint,
Color colorSegment)
This method draw a segment in a given array of pixels. |
boolean |
isSelected(int x,
int y)
This method tells if a point is in the polygon or not. |
void |
optimizeDrawing(AnimatedImage animatedImage)
This method optimize the drawing of the polygon. |
boolean |
polygonDrawn()
This method tells if the polygon is finished or not. |
protected float[] |
returnLineParameters(int[] firstPoint,
int[] secondPoint)
This method return the line parameters m and h. |
void |
translate(int x,
int y,
int maxWidth,
int maxHeight)
This method translate the polygon to the specified point. |
| Methods inherited from class Forms.Forms |
height,
height,
rectangle,
width,
width,
xOrigin,
xOrigin,
yOrigin,
yOrigin |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected boolean polygonDrawn
protected int precision
protected int lastX
protected int lastY
protected Polygon polygon
| Constructor Detail |
public MyPolygon(int precision)
precision - The precision of the polygon (see the variable upper).| Method Detail |
public void drawPolygon(int[] pixels,
int width,
int height,
int x,
int y,
Color color)
pixels - The array of pixels on which we want to draw the polygon.width - The width of the array of pixels.height - The height of the arra of pixels.x - The x coordinate of the current point to be drawn.y - The y coordinate of the current point to be drawn.color - The color we want to draw the polygon.
public void drawSegment(int[] pixels,
int width,
int height,
int[] firstPoint,
int[] secondPoint,
Color colorSegment)
pixels - The array of pixels on which we want to draw the segment.width - The width of the array of pixels.height - The height of the array of pixels.firstPoint - The first point of the segment.secondPoint - The second point of the segment.colorSegment - The color we want to draw the segment.
public void drawPolygonWithTexture(int[] pixels,
int width,
int height,
Texture texture)
throws TextureError
pixels - The array of pixels on which we want to draw the polygon.width - The width of the array of pixels.height - The height of the array of pixels.texture - The texture of the polygon.public void optimizeDrawing(AnimatedImage animatedImage)
protected float[] returnLineParameters(int[] firstPoint,
int[] secondPoint)
firstPoint - The first point of the line.secondPoint - The second point of the line.
public boolean isSelected(int x,
int y)
x - The x coordinate of the point we test if it's containing in the polygon.y - The y coordinate of the point we test if it's containing in the polygon.
public void translate(int x,
int y,
int maxWidth,
int maxHeight)
x - The x coordinate the center of the polygon must be translated.y - The y coordinate the center of the polygon must be translated.maxWidth - The maximum width the polygon must be translated. This prevent the polygon from going out of the the animatedImage.maxHeight - The maximum height the polygon must be translated. This prevent the polygon from going out of the the animatedImage.public boolean polygonDrawn()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||