|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolox.util.PSemanticStroke
edu.umd.cs.piccolox.util.PFixedWidthStroke
public class PFixedWidthStroke
PFixedWidthStroke is the same as BasicStroke
except that
PFixedWidthStroke has a fixed width on the screen so that even when the
canvas view is zooming its width stays the same in canvas coordinates.
PSemanticStroke.createStrokedShape(Shape)
checks if the scale has changed since the
last usage and if that's the case calls newStroke(float)
to get a
new Stroke
instance to delegate to.
CAUTION! this implementation falls short for large scaling factors -
the effective miterlimit might drop below 1.0 which isn't permitted by
BasicStroke
and therefore limited to a minimal 1.0 by this
implementation. A more sophisticated implementation might use the approach
mentioned at http://code.google.com/p/piccolo2d/issues/detail?id=49
CAUTION! after extreme scaling this implementation seems to change to internal state of the base stroke. Try PathExample with extreme zoom in and zoom back to the original scale. The pickable circles disappear. Strange!
PPath
,
BasicStroke
,
Serialized FormField Summary |
---|
Fields inherited from class edu.umd.cs.piccolox.util.PSemanticStroke |
---|
stroke, THRESHOLD |
Constructor Summary | |
---|---|
PFixedWidthStroke()
Constructs a simple PFixedWidthStroke with the default stroke. |
|
PFixedWidthStroke(float width)
Constructs a simple PFixedWidthStroke with the width provided. |
|
PFixedWidthStroke(float width,
int cap,
int join)
Constructs a PFixedWidthStroke with the stroke properties provided. |
|
PFixedWidthStroke(float width,
int cap,
int join,
float miterlimit)
Constructs a PFixedWidthStroke with the stroke properties provided. |
|
PFixedWidthStroke(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dashPhase)
Constructs a PFixedWidthStroke with the stroke properties provided. |
Method Summary | |
---|---|
Object |
clone()
Throws an exception since PFixedWidthStrokes are not serializable. |
float[] |
getDashArray()
Returns the array representing the lengths of the dash segments. |
float |
getDashPhase()
Returns the current dash phase. |
int |
getEndCap()
Returns the end cap style. |
int |
getLineJoin()
Returns the line join style. |
float |
getLineWidth()
Returns the line width. |
float |
getMiterLimit()
Returns the miter limit of this node. |
protected Stroke |
newStroke(float activeScale)
Returns a stroke equivalent to this one, but scaled by the scale provided. |
protected Object |
readResolve()
Is it really necessary to implement Serializable ? |
Methods inherited from class edu.umd.cs.piccolox.util.PSemanticStroke |
---|
createStrokedShape, equals, getActiveScale, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PFixedWidthStroke()
public PFixedWidthStroke(float width)
width
- desired width of the strokepublic PFixedWidthStroke(float width, int cap, int join)
width
- width of strokecap
- cap to use in strokejoin
- join to use in strokepublic PFixedWidthStroke(float width, int cap, int join, float miterlimit)
width
- width of strokecap
- cap to use in strokejoin
- join to use in strokemiterlimit
- miter limit of strokepublic PFixedWidthStroke(float width, int cap, int join, float miterlimit, float[] dash, float dashPhase)
width
- width of strokecap
- cap to use in strokejoin
- join to use in strokemiterlimit
- miter limit of strokedash
- array of dash lengthsdashPhase
- phase to use when rendering dashesMethod Detail |
---|
public Object clone()
clone
in class Object
public float[] getDashArray()
public float getDashPhase()
public int getEndCap()
public int getLineJoin()
PFixedWidthStroke
as one
of the static int
values that define possible line
join styles.public float getLineWidth()
public float getMiterLimit()
protected Stroke newStroke(float activeScale)
newStroke
in class PSemanticStroke
activeScale
- scale to apply to the new stoke
protected Object readResolve() throws ObjectStreamException
Serializable
?
ObjectStreamException
- doesn't actually throw this at all, why's
this here?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |