ImageJ base code to get access to all the classes and their methods to test new Plugins. https://imagejdocu.tudor.lu/howto/plugins/the_imagej_eclipse_howto
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

2 years ago
  1. // Spray Can Tool
  2. var width=100, dotSize=1, rate=6;
  3. macro 'Spray Can Tool - C123D20D22D24D41D43D62D82Da2C037L93b3D84Dc4L75d5L757f Ld5dfLa7d7LabdbLa9d9LacdcLa7ac' {
  4. setLineWidth(dotSize);
  5. radius=width/2; radius2=radius*radius;
  6. start = getTime();
  7. autoUpdate(false);
  8. n = 25*exp(0.9*(10-rate));
  9. if (n<=5) n = 0;
  10. while (true) {
  11. getCursorLoc(x, y, z, flags);
  12. if (flags&16==0) exit();
  13. x2 = (random()-0.5)*width;
  14. y2 = (random()-0.5)*width;
  15. if (x2*x2+y2*y2<radius2) {
  16. x += x2;
  17. y += y2;
  18. drawLine(x, y, x, y);
  19. if (getTime()>start+50) {
  20. updateDisplay();
  21. start = getTime();
  22. }
  23. }
  24. for (i=0; i<n; i++);
  25. }
  26. }
  27. macro 'Spray Can Tool Options' {
  28. Dialog.create("Spray Can Options");
  29. Dialog.addNumber("Spray Width (pixels):", width);
  30. Dialog.addNumber("Dot Size (pixels):", dotSize);
  31. Dialog.addNumber("Flow Rate (1-10):", rate);
  32. Dialog.show();
  33. width = Dialog.getNumber();
  34. dotSize = Dialog.getNumber();
  35. rate = Dialog.getNumber();
  36. if (rate<1) rate = 1;
  37. if (rate>10) rate = 10;
  38. }