
Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
> in V.J.Hardy's book "Java 2D API graphics" you can find implementation of
> ShapeStroke.
> You can download GLF here http://java.sun.com/developer/Books/2dgraphics/
Thanks for the link. I'll have to check the book out next time I'm at the
store.
ShapeStroke doesn't offset or rotate the shape as it goes, but it should
provide good reference. As do the author's other strokes, TextStroke and
WaveStroke.
TextStroke aligns the text with the local curve, so that may provide a hint
as to how to rotate it. WaveStroke uses a generalized Transform, so that
may provide help too.
Starting with the first link I posted
(http://www.java2s.com/ExampleCode/2D-Graphics-GUI/CustomStrokes.htm)
SloppyStroke, I see how to access the coordinates as you traverse the curve.
If I have two consecutive points, calculating a slope, m, and then
offsetting the points by -1/m isn't too bad. However, the bookkeeping of
the points as the iterator moves along the curve is potentially nasty...
I also came across www.psc-cavers.org/carto , a tool for cartographers,
which has a custom hatched stroke. I haven't quite managed to pull it out
so I can test it to see what it does...
Rob
Rob McDonald - 06 Jan 2006 22:20 GMT
> I also came across www.psc-cavers.org/carto , a tool for cartographers,
> which has a custom hatched stroke. I haven't quite managed to pull it out
> so I can test it to see what it does...
This tool's strokes look like they'll do the trick nicely. Or at least
provide a very close foundation.
Thanks for the pointers.
Rob