MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / drawRoundedRect

Method drawRoundedRect

ij/src/main/java/ij/gui/Roi.java:1539–1549  ·  view source on GitHub ↗
(ImageProcessor ip)

Source from the content-addressed store, hash-verified

1537 }
1538
1539 private void drawRoundedRect(ImageProcessor ip) {
1540 int margin = (int)getStrokeWidth()/2;
1541 BufferedImage bi = new BufferedImage(width+margin*2+1, height+margin*2+1, BufferedImage.TYPE_BYTE_GRAY);
1542 Graphics2D g = bi.createGraphics();
1543 if (stroke!=null)
1544 g.setStroke(stroke);
1545 g.drawRoundRect(margin, margin, width, height, cornerDiameter, cornerDiameter);
1546 ByteProcessor mask = new ByteProcessor(bi);
1547 ip.setRoi(x-margin, y-margin, width+margin*2+1, height+margin*2+1);
1548 ip.fill(mask);
1549 }
1550
1551 /** Returns whether the center of pixel (x,y) is contained in the Roi.
1552 * The position of a pixel center determines whether a pixel is selected.

Callers 1

drawPixelsMethod · 0.95

Calls 4

getStrokeWidthMethod · 0.95
setStrokeMethod · 0.80
setRoiMethod · 0.45
fillMethod · 0.45

Tested by

no test coverage detected