Greetings all. This is my first post to the list. I'm an Edinburgh-
based web programmer working for a local web development
company.
One of my current projects is to build a Java app which generates a
graphic and an HTML file containing an imagemap to "hotspot" the
graphic. To do this I need to figure a set of points around the edge
of the object.
The objects in question are instances of Arc2D and I've seen that
that this class has a getPathIterator() method which would appear
to do what I want but I can't find any documentation which explains
how to use it!
Here's what I've come up with so far:
Arc2D thisArc = new Arc2D.Double(x, y, w, h, startAngle,
angleSize, Arc2D.PIE);
PathIterator pi = thisArc.getPathIterator(null);
float[] coords = new float[6];
while (!pi.isDone()) {
pi.currentSegment(coords);
for (int c = 0; c < 6; c++) {
pi.next();
}
}
It's certainly doing something. However, I can't make any sense of
the values being put into the coords array. And besides, I only
need one co-ordinate per segment rather than 6!
Other options which occurred to me might be able to achieve
similar results include:
- mapping the Arc2D to a Polygon and extracting the vertex co-
ordinates.
- throwing a GeneralPath around the Arc2D and somehow
extracting the co-ordinates from that.
However, I have found no way to easily achieve either of these.
Can anyone out there offer some assistance?
Robbie
--------------------------------------------------------
Robert Baldock
[EMAIL PROTECTED]
http://www.rcb.easynet.co.uk/
--------------------------------------------------------
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/