(ShapeRoi roi, double xscale, double yscale, boolean centered)
| 121 | } |
| 122 | |
| 123 | private static Roi scaleShape(ShapeRoi roi, double xscale, double yscale, boolean centered) { |
| 124 | Rectangle r = roi.getBounds(); |
| 125 | Shape shape = roi.getShape(); |
| 126 | AffineTransform at = new AffineTransform(); |
| 127 | at.scale(xscale, yscale); |
| 128 | if (!centered) |
| 129 | at.translate(r.x, r.y); |
| 130 | Shape shape2 = at.createTransformedShape(shape); |
| 131 | Roi roi2 = new ShapeRoi(shape2); |
| 132 | if (centered) { |
| 133 | int xbase = (int)(centered?r.x-(r.width*xscale-r.width)/2.0:r.x); |
| 134 | int ybase = (int)(centered?r.y-(r.height*yscale-r.height)/2.0:r.y); |
| 135 | roi2.setLocation(xbase, ybase); |
| 136 | } |
| 137 | roi2.copyAttributes(roi); |
| 138 | double width = roi.getStrokeWidth(); |
| 139 | if (width!=0) |
| 140 | roi2.setStrokeWidth(width*xscale); |
| 141 | return roi2; |
| 142 | } |
| 143 | |
| 144 | private static Roi scaleText(TextRoi roi, double xscale, double yscale, boolean centered) { |
| 145 | Rectangle bounds = roi.getBounds(); |
no test coverage detected