(ImageProcessor ip)
| 53 | } |
| 54 | |
| 55 | public void run(ImageProcessor ip) { |
| 56 | if (enlarge && gd.wasOKed()) synchronized(this) { |
| 57 | if (!isEnlarged) { |
| 58 | enlargeCanvas(); |
| 59 | isEnlarged=true; |
| 60 | } |
| 61 | } |
| 62 | if (isEnlarged) { //enlarging may have made the ImageProcessor invalid, also for the parallel threads |
| 63 | int slice = pfr.getSliceNumber(); |
| 64 | if (imp.getStackSize()==1) |
| 65 | ip = imp.getProcessor(); |
| 66 | else |
| 67 | ip = imp.getStack().getProcessor(slice); |
| 68 | } |
| 69 | ip.setInterpolationMethod(interpolationMethod); |
| 70 | if (fillWithBackground) |
| 71 | ip.setBackgroundColor(Toolbar.getBackgroundColor()); |
| 72 | else |
| 73 | ip.setBackgroundValue(0); |
| 74 | ip.rotate(angle); |
| 75 | if (!gd.wasOKed()) |
| 76 | drawGridLines(gridLines); |
| 77 | if (overlay!=null && !imp.getHideOverlay()) { |
| 78 | Overlay overlay2 = overlay.rotate(angle, ip.getWidth()/2, ip.getHeight()/2); |
| 79 | if (overlay2!=null && overlay2.size()>0) |
| 80 | imp.setOverlay(overlay2); |
| 81 | } |
| 82 | if (isEnlarged && imp.getStackSize()==1) { |
| 83 | imp.changes = true; |
| 84 | imp.updateAndDraw(); |
| 85 | Undo.setup(Undo.COMPOUND_FILTER_DONE, imp); |
| 86 | } |
| 87 | if (done) { // remove grid |
| 88 | Overlay ovly = imp.getOverlay(); |
| 89 | if (ovly!=null) { |
| 90 | ovly.remove(GRID); |
| 91 | if (ovly.size()==0) imp.setOverlay(null); |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | void enlargeCanvas() { |
| 97 | imp.unlock(); |
nothing calls this directly
no test coverage detected