• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Polygon lasso drawing

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use Java to implement a feature that is very like to polygon lasso tool in any image processing software, like FireWords, PhotoShop.

Basically, when a user clicks the polygon lasso icon I provided, he is ready to start to draw a polygon lasso. When he clicks anywhere in a drawing area, a dot will show up there; clicks again, a new dot will apprear. There is a solid or arrow between two dots. The last dot must overlap the first dot and it represents the drawing is finished and a polygon will appear; all points are decided by my clicks.

There are several constraints:

1. A user can only click selected times, i.e.: he can only click 5 times. Clicks beyond 5 times will not be accepted (no dot appeared)

2. A user must click selected times, i.e.: he must click 5 times. If he just clicks twice and decides to terminate the drawing, all dots and connected lines will disappear

3. The last dot and the first dot must be overlapped. Please note: As long as two points are very close, say, 2 px, we still say they are overlapped.

4. If the last dot and the first dot does not overlapped, I may choose to accept or not accept the drawing. If I do not accept it, all dots and connected lines will disappear

Any suggestion and/or sample code?

Thank you for your time.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic