I also am trying to find a way of expanding a shape...  I still haven't had any 
luck with anything I've tried, but it sounds like you may have something that 
works.

I've tried two different things.  My original solution was to use a flattened 
path iterator to go over the shape and create padded line segments which 
consisted of three shapes - a rectangle and two semicircles.  I then took the 
union of the original shape and these areas to construct the final area.  
Conceptually, it made sense to me, but in practice it was EXTREMELY slow and 
resource intensive for some reason (I suspect because these areas tended to 
overlap).

After that, I found this thread.  I tried the suggested code snippet (using 
CAP_ROUND and JOIN_ROUND), and it almost works.  However, the area I get when I 
create the stroked shape has holes in it other than the original shape.  Can 
you explain this?  Also, how would you go about finding the outermost shape in 
the region?  I don't think you can rely on comparing the results of the 
getBounds() functions; I thought that there was no guarantee on how closely the 
bounds will fit.  My solution was to calculate the area of the different 
subshapes and choose the one with the largest area.  For some reason though, it 
doesn't seem to be working right...  I am going to look in to that more, but I 
was hoping that someone who had been working on this problem had found a good 
solution for it.

Thanks!
[Message sent by forum member 'randofu' (randofu)]

http://forums.java.net/jive/thread.jspa?messageID=145565

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to