Package ch.epfl.cs107.play.engine.actor
Class ShapeGraphics
java.lang.Object
ch.epfl.cs107.play.math.Node
ch.epfl.cs107.play.engine.actor.ShapeGraphics
- All Implemented Interfaces:
Graphics,Attachable,Positionable
Contains information to render a single shape, which can be attached to any positionable.
-
Constructor Summary
ConstructorsConstructorDescriptionShapeGraphics(Shape shape, Color fillColor, Color outlineColor, float thickness) Creates a new shape graphics.ShapeGraphics(Shape shape, Color fillColor, Color outlineColor, float thickness, float alpha, float depth) Creates a new shape graphics. -
Method Summary
Modifier and TypeMethodDescriptionvoidRenders itself on specified canvas.floatgetAlpha()floatgetDepth()getShape()floatvoidsetAlpha(float alpha) Sets transparency.voidsetDepth(float depth) Sets rendering depth.voidsetFillColor(Color fillColor) Sets fill color.voidsetOutlineColor(Color outlineColor) Sets outline color.voidSets shape.voidsetThickness(float thickness) Sets outline thickness.Methods inherited from class ch.epfl.cs107.play.math.Node
getParent, getPosition, getRelativeTransform, getTransform, getVelocity, setParent, setRelativeTransform
-
Constructor Details
-
ShapeGraphics
public ShapeGraphics(Shape shape, Color fillColor, Color outlineColor, float thickness, float alpha, float depth) Creates a new shape graphics.- Parameters:
shape- (Shape): shape, may be nullfillColor- (Color): fill color, may be nulloutlineColor- (Color): outline color, may be nullthickness- (float): outline thicknessalpha- (float): transparency, between 0 (invisible) and 1 (opaque)depth- (float): render priority, lower-values drawn first
-
ShapeGraphics
Creates a new shape graphics.- Parameters:
shape- (Shape): shape, may be nullfillColor- (Color): fill color, may be nulloutlineColor- (Color): outline color, may be nullthickness- (float): outline thickness
-
-
Method Details
-
setShape
Sets shape.- Parameters:
shape- (Shape): new shape, may be null
-
getShape
- Returns:
- (Shape): current shape, may be null
-
setFillColor
Sets fill color.- Parameters:
fillColor- (Color): color, may be null
-
getFillColor
- Returns:
- (Color): fill color, may be null
-
setOutlineColor
Sets outline color.- Parameters:
outlineColor- (Color): color, may be null
-
getOutlineColor
- Returns:
- (Color): outline color, may be null
-
setThickness
public void setThickness(float thickness) Sets outline thickness.- Parameters:
thickness- (float): outline thickness
-
getThickness
public float getThickness()- Returns:
- (float): outline thickness
-
setAlpha
public void setAlpha(float alpha) Sets transparency.- Parameters:
alpha- (float): transparency, between 0 (invisible) and 1 (opaque)
-
getAlpha
public float getAlpha()- Returns:
- (float): transparency, between 0 (invisible) and 1 (opaque)
-
setDepth
public void setDepth(float depth) Sets rendering depth.- Parameters:
depth- (float): render priority, lower-values drawn first
-
getDepth
public float getDepth()- Returns:
- (float): render priority, lower-values drawn first
-
draw
Description copied from interface:GraphicsRenders itself on specified canvas.
-