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

Method draw

ij/src/main/java/ij/gui/Roi.java:1332–1400  ·  view source on GitHub ↗
(Graphics g)

Source from the content-addressed store, hash-verified

1330 }
1331
1332 public void draw(Graphics g) {
1333 Color color = strokeColor!=null?strokeColor:ROIColor;
1334 if (fillColor!=null) color = fillColor;
1335 if (Interpreter.isBatchMode() && imp!=null && imp.getOverlay()!=null && strokeColor==null && fillColor==null)
1336 return;
1337 g.setColor(color);
1338 mag = getMagnification();
1339 int sw = (int)(width*mag);
1340 int sh = (int)(height*mag);
1341 int sx1 = screenX(x);
1342 int sy1 = screenY(y);
1343 if (subPixelResolution() && bounds!=null) {
1344 sw = (int)(bounds.width*mag);
1345 sh = (int)(bounds.height*mag);
1346 sx1 = screenXD(bounds.x);
1347 sy1 = screenYD(bounds.y);
1348 }
1349 int sx2 = sx1+sw/2;
1350 int sy2 = sy1+sh/2;
1351 int sx3 = sx1+sw;
1352 int sy3 = sy1+sh;
1353 Graphics2D g2d = (Graphics2D)g;
1354 if (stroke!=null)
1355 g2d.setStroke(getScaledStroke());
1356 setRenderingHint(g2d);
1357 if (cornerDiameter>0) {
1358 int sArcSize = (int)Math.round(cornerDiameter*mag);
1359 if (fillColor!=null) {
1360 g.fillRoundRect(sx1, sy1, sw, sh, sArcSize, sArcSize);
1361 if (strokeColor!=null) {
1362 g.setColor(strokeColor);
1363 g.drawRoundRect(sx1, sy1, sw, sh, sArcSize, sArcSize);
1364 }
1365 } else
1366 g.drawRoundRect(sx1, sy1, sw, sh, sArcSize, sArcSize);
1367 } else {
1368 if (fillColor!=null) {
1369 if (!overlay && isActiveOverlayRoi()) {
1370 g.setColor(Color.cyan);
1371 g.drawRect(sx1, sy1, sw, sh);
1372 } else {
1373 if (!(this instanceof TextRoi)) {
1374 g.fillRect(sx1, sy1, sw, sh);
1375 if (strokeColor!=null) {
1376 g.setColor(strokeColor);
1377 g.drawRect(sx1, sy1, sw, sh);
1378 }
1379 } else
1380 g.drawRect(sx1, sy1, sw, sh);
1381 }
1382 } else
1383 g.drawRect(sx1, sy1, sw, sh);
1384 }
1385 if (clipboard==null && !overlay) {
1386 drawHandle(g, sx1, sy1);
1387 drawHandle(g, sx2, sy1);
1388 drawHandle(g, sx3, sy1);
1389 drawHandle(g, sx3, sy2);

Callers 15

RoiMethod · 0.95
drawOverlayMethod · 0.95
drawOverlayCanvasMethod · 0.95
updateAndDrawMethod · 0.45
getTransferDataMethod · 0.45
drawPlotObjectMethod · 0.45
drawBarChartMethod · 0.45
drawArrowMethod · 0.45
drawVerticalErrorBarsMethod · 0.45
drawFloatPolylineMethod · 0.45

Calls 15

isBatchModeMethod · 0.95
getMagnificationMethod · 0.95
screenXMethod · 0.95
screenYMethod · 0.95
subPixelResolutionMethod · 0.95
screenXDMethod · 0.95
screenYDMethod · 0.95
getScaledStrokeMethod · 0.95
setRenderingHintMethod · 0.95
isActiveOverlayRoiMethod · 0.95
drawHandleMethod · 0.95
drawPreviousRoiMethod · 0.95

Tested by

no test coverage detected