Package paintingcanvas.drawable
Interface Outlineable<T extends Drawable<T>>
-
- Type Parameters:
T
- the type of the object
- All Superinterfaces:
Animatable
,Drawable<T>
- All Known Implementing Classes:
Circle
,DrawableBase.InteractableShape
,DrawableBase.OutlineableDrawableBase
,DrawableBase.Shape
,Ellipse
,Image
,Path
,Polygon
,Rectangle
,Square
,Triangle
public interface Outlineable<T extends Drawable<T>> extends Drawable<T>
Elements that can be outlined.
If stroke is null, the outline should be removed.
Also provides fill methods because yes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.awt.Color
getOutlineColor()
Gets the outline colorjava.awt.Stroke
getOutlineStroke()
Gets the outline strokevoid
internalSetFilled(boolean filled)
void
internalSetOutlineColor(java.awt.Color color)
void
internalSetOutlineStroke(java.awt.Stroke stroke)
default T
removeOutline()
Removes the outline from the shapedefault T
setFilled(boolean filled)
Set whether this object is filled or notdefault T
setOutline(int thickness)
Sets the parameters for the outline of the shape, with the color defaulting to blackdefault T
setOutline(int thickness, java.awt.Color color)
Sets the parameters for the outline of the shapedefault T
setOutline(java.awt.Color color)
Sets the outline color of the shape-
Methods inherited from interface paintingcanvas.animation.Animatable
Modifier and Type Method Description default AnimationBuilder
colorTo(int hex, double duration)
Change the color ofthis
to the specifiedcolor
overduration
seconds.default AnimationBuilder
colorTo(int r, int g, int b, double duration)
Change the color ofthis
to the specifiedcolor
overduration
seconds.default AnimationBuilder
colorTo(int r, int g, int b, int a, double duration)
Change the color ofthis
to the specifiedcolor
overduration
seconds.default AnimationBuilder
colorTo(java.awt.Color color, double duration)
Change the color ofthis
to the specifiedcolor
overduration
seconds.default AnimationBuilder
colorTo(java.lang.String name, double duration)
Change the color ofthis
to the specifiedcolor
overduration
seconds.default AnimationBuilder
colorTo(Hue hue, double duration)
Change the color ofthis
to the specifiedcolor
overduration
seconds.Drawable<?>
drawable()
Get theDrawable
element from thisAnimatable
.default AnimationBuilder
fadeIn(double duration)
Fadethis
in overduration
seconds.default AnimationBuilder
fadeOut(double duration)
Fadethis
out overduration
seconds.default AnimationBuilder
moveBy(int x, int y, double duration)
Movethis
by the specifiedx
andy
overduration
seconds.default AnimationBuilder
moveHorizontalBy(int x, double duration)
Movethis
by the specifiedx
horizontally overduration
seconds.default AnimationBuilder
moveTo(int x, int y, double duration)
Movethis
to the specifiedx
andy
overduration
secondsdefault AnimationBuilder
moveVerticalBy(int y, double duration)
Movethis
by the specifiedy
vertically overduration
seconds.default AnimationBuilder
rotateBy(int angle, double duration)
Rotatethis
byangle
degrees overduration
seconds.default AnimationBuilder
rotateTo(int angle, double duration)
Rotatethis
to the specifiedangle
degrees overduration
seconds.
-
Methods inherited from interface paintingcanvas.drawable.Drawable
Modifier and Type Method Description default AnimationBuilder
animate()
Start animating this object.default T
bringToFront()
Brings the object in front of all other objects.java.awt.Point
center(java.awt.Graphics2D g)
Get the object's centerpointdefault Drawable<?>
drawable()
Get theDrawable
element from thisAnimatable
.default void
erase()
Erase this object from the canvas.int
getLayer()
Gets the current layer of the object.T
getThis()
T
hide()
Hide the Object.void
internalSetLayer(int layer)
void
render(java.awt.Graphics2D g)
Actually render the object itselfdefault T
sendToBack()
Puts the object behind all other objects.default T
setLayer(int layer)
Puts the object on a specific layer.T
show()
Show the Object
-
-
-
-
Method Detail
-
internalSetOutlineStroke
void internalSetOutlineStroke(java.awt.Stroke stroke)
-
internalSetOutlineColor
void internalSetOutlineColor(java.awt.Color color)
-
internalSetFilled
void internalSetFilled(boolean filled)
-
getOutlineColor
java.awt.Color getOutlineColor()
Gets the outline color- Returns:
- the outline color
-
getOutlineStroke
java.awt.Stroke getOutlineStroke()
Gets the outline stroke- Returns:
- the outline stroke
-
setOutline
default T setOutline(int thickness, java.awt.Color color)
Sets the parameters for the outline of the shape// the circle is red outlined by a black outline Circle c = new Circle(100, 100, 50); c.setOutline(5); c.setColor(Color.RED); // now just the outline is rendered c.setFilled(false);
- Parameters:
color
- the color of the outlinethickness
- the thickness of the outline- Returns:
- the original object to allow method chaining
-
setOutline
default T setOutline(java.awt.Color color)
Sets the outline color of the shape// the circle is red outlined by a black outline Circle c = new Circle(100, 100, 50); c.setOutline(5); c.setColor(Color.RED); // now the outline is blue c.setOutline(Color.BLUE);
- Parameters:
color
- the color of the outline- Returns:
- the original object to allow method chaining
-
setOutline
default T setOutline(int thickness)
Sets the parameters for the outline of the shape, with the color defaulting to black// the circle is red outlined by a green outline Circle c = new Circle(100, 100, 50); c.setOutline(5, Color.GREEN); c.setColor(Color.RED); // now just the outline is rendered c.setFilled(false);
- Parameters:
thickness
- the thickness of the outline- Returns:
- the original object to allow method chaining
-
removeOutline
default T removeOutline()
Removes the outline from the shape- Returns:
- the original object to allow method chaining
-
setFilled
default T setFilled(boolean filled)
Set whether this object is filled or not// draw just an outline: Circle c = new Circle(100, 100, 50, Color.RED); c.setOutline(5); c.setFilled(false);
- Parameters:
filled
- the value to setthis.filled
to- Returns:
- the original object to allow method chaining
- See Also:
setOutline(int)
-
-