void drawOutline(ImageProcessor ip, Roi roi, int count) {
   if (showChoice == OVERLAY_OUTLINES || showChoice == OVERLAY_MASKS) {
     if (overlay == null) {
       overlay = new Overlay();
       overlay.drawLabels(true);
       overlay.setLabelFont(new Font("SansSerif", Font.PLAIN, fontSize));
     }
     Roi roi2 = (Roi) roi.clone();
     roi2.setStrokeColor(Color.cyan);
     if (lineWidth != 1) roi2.setStrokeWidth(lineWidth);
     if (showChoice == OVERLAY_MASKS) roi2.setFillColor(Color.cyan);
     overlay.add(roi2);
   } else {
     Rectangle r = roi.getBounds();
     int nPoints = ((PolygonRoi) roi).getNCoordinates();
     int[] xp = ((PolygonRoi) roi).getXCoordinates();
     int[] yp = ((PolygonRoi) roi).getYCoordinates();
     int x = r.x, y = r.y;
     if (!inSituShow) ip.setValue(0.0);
     ip.moveTo(x + xp[0], y + yp[0]);
     for (int i = 1; i < nPoints; i++) ip.lineTo(x + xp[i], y + yp[i]);
     ip.lineTo(x + xp[0], y + yp[0]);
     if (showChoice != BARE_OUTLINES) {
       String s = ResultsTable.d2s(count, 0);
       ip.moveTo(r.x + r.width / 2 - ip.getStringWidth(s) / 2, r.y + r.height / 2 + fontSize / 2);
       if (!inSituShow) ip.setValue(1.0);
       ip.drawString(s);
     }
   }
 }
Пример #2
0
 /** @deprecated replaced by ImagePlus.setOverlay(ij.gui.Overlay) */
 public void setDisplayList(Vector list) {
   if (list != null) {
     Overlay list2 = new Overlay();
     list2.setVector(list);
     setOverlay(list2);
   } else setOverlay(null);
   if (overlay != null)
     overlay.drawLabels(overlay.size() > 0 && overlay.get(0).getStrokeColor() == null);
   else customRoi = false;
   repaint();
 }