edu.rit.draw.item
Class DashedOutline
- java.lang.Object
-
- edu.rit.draw.item.DashedOutline
-
- All Implemented Interfaces:
- Outline, java.io.Externalizable, java.io.Serializable
public class DashedOutline extends java.lang.Object implements Outline
Class DashedOutline provides an object that outlines an area in a DrawingItem with a square-cornered dashed stroke in a solid color.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static floatNORMAL_DOWN_FACTORThe normal dashed outline down factor (10).static FillNORMAL_FILLThe normal dashed outline fill paint (black).static DashedOutlineNORMAL_OUTLINEThe normal dashed outline (width = 1, fill paint = black, down factor = 5, up factor = 3).static floatNORMAL_UP_FACTORThe normal dashed outline up factor (6).static floatNORMAL_WIDTHThe normal dashed outline width (1).
-
Constructor Summary
Constructors Constructor and Description DashedOutline()Construct a new dashed outline object with the normal width (1), the normal fill paint (black), the normal down factor (10), and the normal up factor (6).DashedOutline(DashedOutline theOutline)Construct a new dashed outline object with the same width, fill paint, down factor, and up factor as the given dashed outline object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description floatdown()Returns this dashed outline object's down factor.DashedOutlinedown(float theDownFactor)Set this dashed outline object's down factor.Fillfill()Returns this dashed outline object's fill paint.DashedOutlinefill(Fill theFill)Set this dashed outline object's fill paint.floatgetStrokeWidth()Returns the stroke width of this outline.voidreadExternal(java.io.ObjectInput in)Read this dashed outline object from the given object input stream.voidsetGraphicsContext(java.awt.Graphics2D g2d)Set the given graphics context's stroke and paint attributes as specified by this outline object.floatup()Returns this dashed outline object's up factor.DashedOutlineup(float theUpFactor)Set this dashed outline object's up factor.floatwidth()Returns this dashed outline object's width.DashedOutlinewidth(float theWidth)Set this dashed outline object's width.voidwriteExternal(java.io.ObjectOutput out)Write this dashed outline object to the given object output stream.
-
-
-
Field Detail
-
NORMAL_WIDTH
public static final float NORMAL_WIDTH
The normal dashed outline width (1).- See Also:
- Constant Field Values
-
NORMAL_FILL
public static final Fill NORMAL_FILL
The normal dashed outline fill paint (black).
-
NORMAL_DOWN_FACTOR
public static final float NORMAL_DOWN_FACTOR
The normal dashed outline down factor (10).- See Also:
- Constant Field Values
-
NORMAL_UP_FACTOR
public static final float NORMAL_UP_FACTOR
The normal dashed outline up factor (6).- See Also:
- Constant Field Values
-
NORMAL_OUTLINE
public static final DashedOutline NORMAL_OUTLINE
The normal dashed outline (width = 1, fill paint = black, down factor = 5, up factor = 3).
-
-
Constructor Detail
-
DashedOutline
public DashedOutline()
Construct a new dashed outline object with the normal width (1), the normal fill paint (black), the normal down factor (10), and the normal up factor (6).
-
DashedOutline
public DashedOutline(DashedOutline theOutline)
Construct a new dashed outline object with the same width, fill paint, down factor, and up factor as the given dashed outline object.- Parameters:
theOutline- Dashed outline object.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theOutline is null.
-
-
Method Detail
-
width
public float width()
Returns this dashed outline object's width.- Returns:
- Width.
-
width
public DashedOutline width(float theWidth)
Set this dashed outline object's width.- Parameters:
theWidth- Width.- Returns:
- This dashed outline object.
- Throws:
java.lang.IllegalArgumentException- (unchecked exception) Thrown if theWidth is less than or equal to 0.
-
fill
public Fill fill()
Returns this dashed outline object's fill paint.- Returns:
- Fill paint.
-
fill
public DashedOutline fill(Fill theFill)
Set this dashed outline object's fill paint.- Parameters:
theFill- Fill paint.- Returns:
- This dashed outline object.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theFill is null.
-
down
public float down()
Returns this dashed outline object's down factor. The down factor is the length, relative to this dashed outline object's width, that the "pen" is "down" drawing a dash.- Returns:
- Down factor.
-
down
public DashedOutline down(float theDownFactor)
Set this dashed outline object's down factor. The down factor is the length, relative to this dashed outline object's width, that the "pen" is "down" drawing a dash.- Parameters:
theDownFactor- Down factor.- Returns:
- This dashed outline object.
- Throws:
java.lang.IllegalArgumentException- (unchecked exception) Thrown if theDownFactor is less than or equal to 0.
-
up
public float up()
Returns this dashed outline object's up factor. The up factor is the length, relative to this dashed outline object's width, that the "pen" is "up" between dashes.- Returns:
- Up factor.
-
up
public DashedOutline up(float theUpFactor)
Set this dashed outline object's up factor. The down factor is the length, relative to this dashed outline object's width, that the "pen" is "up" between dashes.- Parameters:
theUpFactor- Up factor.- Returns:
- This dashed outline object.
- Throws:
java.lang.IllegalArgumentException- (unchecked exception) Thrown if theUpFactor is less than or equal to 0.
-
getStrokeWidth
public float getStrokeWidth()
Returns the stroke width of this outline.- Specified by:
getStrokeWidthin interfaceOutline- Returns:
- Stroke width.
-
setGraphicsContext
public void setGraphicsContext(java.awt.Graphics2D g2d)
Set the given graphics context's stroke and paint attributes as specified by this outline object.- Specified by:
setGraphicsContextin interfaceOutline- Parameters:
g2d- 2-D graphics context.
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionWrite this dashed outline object to the given object output stream.- Specified by:
writeExternalin interfacejava.io.Externalizable- Parameters:
out- Object output stream.- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this dashed outline object from the given object input stream.- Specified by:
readExternalin interfacejava.io.Externalizable- Parameters:
in- Object input stream.- Throws:
java.io.IOException- Thrown if an I/O error occurred.java.lang.ClassNotFoundException- Thrown if any class needed to deserialize this dashed outline object cannot be found.
-
-
DMelt 3.0 © DataMelt by jWork.ORG