edu.umd.cs.piccolox.util
Class PFixedWidthStroke
java.lang.Object
edu.umd.cs.piccolox.util.PSemanticStroke
edu.umd.cs.piccolox.util.PFixedWidthStroke
- All Implemented Interfaces:
- java.awt.Stroke, java.io.Serializable
public class PFixedWidthStroke
- extends PSemanticStroke
- implements java.io.Serializable
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!
- Version:
- 1.0
- Author:
- Jesse Grosjean, Marcus Rohrmoser
- See Also:
PPath
,
BasicStroke
,
Serialized Form
Constructor Summary |
PFixedWidthStroke()
|
PFixedWidthStroke(float width)
|
PFixedWidthStroke(float width,
int cap,
int join)
|
PFixedWidthStroke(float width,
int cap,
int join,
float miterlimit)
|
PFixedWidthStroke(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dash_phase)
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
PFixedWidthStroke
public PFixedWidthStroke()
PFixedWidthStroke
public PFixedWidthStroke(float width)
PFixedWidthStroke
public PFixedWidthStroke(float width,
int cap,
int join)
PFixedWidthStroke
public PFixedWidthStroke(float width,
int cap,
int join,
float miterlimit)
PFixedWidthStroke
public PFixedWidthStroke(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dash_phase)
clone
public java.lang.Object clone()
- Overrides:
clone
in class java.lang.Object
getDashArray
public float[] getDashArray()
getDashPhase
public float getDashPhase()
getEndCap
public int getEndCap()
getLineJoin
public int getLineJoin()
getLineWidth
public float getLineWidth()
getMiterLimit
public float getMiterLimit()
newStroke
protected java.awt.Stroke newStroke(float activeScale)
- Description copied from class:
PSemanticStroke
- Factory to create a new internal stroke delegate. Made protected to
enable custom re-implementations.
- Specified by:
newStroke
in class PSemanticStroke
readResolve
protected java.lang.Object readResolve()
throws java.io.ObjectStreamException
- Is it really necessary to implement
Serializable
?
- Throws:
java.io.ObjectStreamException