Title: Message
You can use a GeneralPath to draw the contour.
 
But you will probably need some other data-structure/object that represents your contour.
This class should hold all of your contour's control points.
When the mouse moves, you will need to cycle through the contour-objects control points to see if you have a hit on any of the control points.
 
You can optimize this somewhat by first getting the bounding box for your contour/GeneralPath and see if the mouse is in the bounding box, if it is, then cycle through all control points to see if you have a hit.
 
You will need to do hit testing on the control point.
 
For mouseMoved() if hit is true, change the cursor.
 
For mousePressed() if hit is true, initiate a point move operation.
 
For mouseDragged() with each mouse event you need to
 
1. reposition the control point
2. update the GeneralPath based on the new position of the control point and
3. redraw the contour.
 
Ted Hill
-----Original Message-----
From: Discussion list for Java 2D API [mailto:[EMAIL PROTECTED] On Behalf Of Archana Chilukuri
Sent: Tuesday, April 12, 2005 5:42 PM
To: [EMAIL PROTECTED]
Subject: [JAVA2D] editing contours in java2d

Hi all,
 
I understand that we can draw free hand contours using general path with lineto function.
 
Does anyone know how we could edit these contours with mouse drags. In the initial position the contour would be displayed with some control
points on it. When the user drags the control point, the contour should spline through the control point. So the curve looks like adjusting itself to where
the control point has been moved.
 
Please help.....
 
thanks,
 
 

This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information.Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. If you are the intended recipient, please be advised that the content of this message is subject to access, review and disclosure by the sender's Email System Administrator.


=========================================================================== 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".
=========================================================================== 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