Draws the shape of this object onto the specified ImageProcessor. This method will always draw a flattened version of the actual shape (i.e., all curve segments will be approximated by line segments).
(ImageProcessor ip)
| 998 | * (i.e., all curve segments will be approximated by line segments). |
| 999 | */ |
| 1000 | public void drawPixels(ImageProcessor ip) { |
| 1001 | PathIterator pIter = shape.getPathIterator(new AffineTransform(), flatness); |
| 1002 | float[] coords = new float[6]; |
| 1003 | float sx=0f, sy=0f; |
| 1004 | while (!pIter.isDone()) { |
| 1005 | int segType = pIter.currentSegment(coords); |
| 1006 | switch(segType) { |
| 1007 | case PathIterator.SEG_MOVETO: |
| 1008 | sx = coords[0]; |
| 1009 | sy = coords[1]; |
| 1010 | ip.moveTo(x+(int)sx, y+(int)sy); |
| 1011 | break; |
| 1012 | case PathIterator.SEG_LINETO: |
| 1013 | ip.lineTo(x+(int)coords[0], y+(int)coords[1]); |
| 1014 | break; |
| 1015 | case PathIterator.SEG_CLOSE: |
| 1016 | ip.lineTo(x+(int)sx, y+(int)sy); |
| 1017 | break; |
| 1018 | default: break; |
| 1019 | } |
| 1020 | pIter.next(); |
| 1021 | } |
| 1022 | } |
| 1023 | |
| 1024 | /** Returns this ROI's mask pixels as a ByteProcessor with pixels "in" the mask |
| 1025 | * set to white (255) and pixels "outside" the mask set to black (0). |
no test coverage detected