(Overlay overlay, Graphics g)
| 337 | } |
| 338 | |
| 339 | @AstroImageJ(reason = "widen access to public", modified = true) |
| 340 | public void drawOverlay(Overlay overlay, Graphics g) { |
| 341 | if (imp!=null && imp.getHideOverlay() && overlay!=showAllOverlay) |
| 342 | return; |
| 343 | flattening = imp!=null && ImagePlus.flattenTitle.equals(imp.getTitle()); |
| 344 | if (imp!=null && showAllOverlay!=null && overlay!=showAllOverlay) |
| 345 | overlay.drawLabels(false); |
| 346 | Color labelColor = overlay.getLabelColor(); |
| 347 | if (labelColor==null) labelColor = Color.white; |
| 348 | initGraphics(overlay, g, labelColor, Roi.getColor()); |
| 349 | int n = overlay.size(); |
| 350 | int currentImage = imp!=null?imp.getCurrentSlice():-1; |
| 351 | int stackSize = imp.getStackSize(); |
| 352 | if (stackSize==1) |
| 353 | currentImage = -1; |
| 354 | int channel=0, slice=0, frame=0; |
| 355 | boolean hyperstack = imp.isHyperStack(); |
| 356 | if (imp.getNChannels()>1) |
| 357 | hyperstack = true; |
| 358 | if (hyperstack) { |
| 359 | channel = imp.getChannel(); |
| 360 | slice = imp.getSlice(); |
| 361 | frame = imp.getFrame(); |
| 362 | } |
| 363 | drawNames = overlay.getDrawNames() && overlay.getDrawLabels(); |
| 364 | boolean drawLabels = drawNames || overlay.getDrawLabels(); |
| 365 | if (drawLabels) |
| 366 | labelRects = new Rectangle[n]; |
| 367 | else |
| 368 | labelRects = null; |
| 369 | font = overlay.getLabelFont(); |
| 370 | if (overlay.scalableLabels() && font!=null) { |
| 371 | double mag = getMagnification(); |
| 372 | if (mag!=1.0) |
| 373 | font = font.deriveFont((float)(font.getSize()*mag)); |
| 374 | } |
| 375 | Roi activeRoi = imp.getRoi(); |
| 376 | boolean roiManagerShowAllMode = overlay==showAllOverlay && !Prefs.showAllSliceOnly; |
| 377 | for (int i=0; i<n; i++) { |
| 378 | if (overlay==null) break; |
| 379 | Roi roi = overlay.get(i); |
| 380 | if (roi==null) break; |
| 381 | int c = roi.getCPosition(); |
| 382 | int z = roi.getZPosition(); |
| 383 | int t = roi.getTPosition(); |
| 384 | if (hyperstack) { |
| 385 | int position = roi.getPosition(); |
| 386 | if (position>0) { |
| 387 | if (imp.getNChannels()==stackSize) { |
| 388 | c = position; |
| 389 | z = t = 0; |
| 390 | } else if (imp.getNSlices()==stackSize) { |
| 391 | z = position; |
| 392 | c = t = 0; |
| 393 | } else if (imp.getNFrames()==stackSize) { |
| 394 | t = position; |
| 395 | c = z = 0; |
| 396 | } |
no test coverage detected