Class StrokeStyle
java.lang.Object
com.codename1.art.StrokeStyle
How a shape's outline is drawn: paint, width, caps, joins, dashes and alignment.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe stroke is centered on the path.static final intThe stroke lies inside the shape.static final intThe stroke lies outside the shape.static final intFlat ends at the path's end points.static final intRounded ends.static final intSquare ends that extend half the width past the end points.static final intCut corners.static final intSharp corners, cut to a bevel past the miter limit.static final intRounded corners. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()A deep copy.intOne of theALIGN_constants.intgetCap()One of theCAP_constants.float[]getDash()The dash pattern, as a copy, or null for a solid line.floatThe dash offset.intgetJoin()One of theJOIN_constants.floatThe miter limit.getPaint()The paint.floatgetWidth()The width.booleanFalse when the stroke is kept but not drawn, as Sketch allows.voidsetAlignment(int alignment) Sets the alignment.voidsetCap(int cap) Sets the cap.voidsetDash(float[] dash) Sets the dash pattern.voidsetDashOffset(float dashOffset) Sets the dash offset.voidsetEnabled(boolean enabled) Turns the stroke on or off.voidsetJoin(int join) Sets the join.voidsetMiterLimit(float miterLimit) Sets the miter limit.voidSets the paint.voidsetWidth(float width) Sets the width.
-
Field Details
-
CAP_BUTT
public static final int CAP_BUTTFlat ends at the path's end points.- See Also:
-
CAP_ROUND
public static final int CAP_ROUNDRounded ends.- See Also:
-
CAP_SQUARE
public static final int CAP_SQUARESquare ends that extend half the width past the end points.- See Also:
-
JOIN_MITER
public static final int JOIN_MITERSharp corners, cut to a bevel past the miter limit.- See Also:
-
JOIN_ROUND
public static final int JOIN_ROUNDRounded corners.- See Also:
-
JOIN_BEVEL
public static final int JOIN_BEVELCut corners.- See Also:
-
ALIGN_CENTER
public static final int ALIGN_CENTERThe stroke is centered on the path.- See Also:
-
ALIGN_INSIDE
public static final int ALIGN_INSIDEThe stroke lies inside the shape.- See Also:
-
ALIGN_OUTSIDE
public static final int ALIGN_OUTSIDEThe stroke lies outside the shape.- See Also:
-
-
Constructor Details
-
StrokeStyle
Creates a stroke.
Parameters
paint: what fills the outlinewidth: width in the shape's units
-
-
Method Details
-
copy
A deep copy. -
getPaint
The paint. -
setPaint
Sets the paint.
Parameters
paint: the new paint
-
getWidth
public float getWidth()The width. -
setWidth
public void setWidth(float width) Sets the width.
Parameters
width: the new width
-
getCap
public int getCap()One of theCAP_constants. -
setCap
public void setCap(int cap) Sets the cap.
Parameters
cap: one of theCAP_constants
-
getJoin
public int getJoin()One of theJOIN_constants. -
setJoin
public void setJoin(int join) Sets the join.
Parameters
join: one of theJOIN_constants
-
getMiterLimit
public float getMiterLimit()The miter limit. -
setMiterLimit
public void setMiterLimit(float miterLimit) Sets the miter limit.
Parameters
miterLimit: the ratio past which a miter becomes a bevel
-
getDash
public float[] getDash()The dash pattern, as a copy, or null for a solid line. -
setDash
public void setDash(float[] dash) Sets the dash pattern.
Parameters
dash: alternating on and off lengths; null for solid
-
getDashOffset
public float getDashOffset()The dash offset. -
setDashOffset
public void setDashOffset(float dashOffset) Sets the dash offset.
Parameters
dashOffset: how far into the pattern the line starts
-
getAlignment
public int getAlignment()One of theALIGN_constants. -
setAlignment
public void setAlignment(int alignment) Sets the alignment.
Parameters
alignment: one of theALIGN_constants
-
isEnabled
public boolean isEnabled()False when the stroke is kept but not drawn, as Sketch allows. -
setEnabled
public void setEnabled(boolean enabled) Turns the stroke on or off.
Parameters
enabled: true to draw it
-