예제 #1
0
 public void drawPixels(ImageProcessor ip) {
   int saveWidth = ip.getLineWidth();
   if (getStrokeWidth() > 1f) ip.setLineWidth((int) Math.round(getStrokeWidth()));
   double offset = getOffset(0.5);
   if (xSpline != null) {
     ip.moveTo(
         x + (int) (Math.round(xSpline[0]) + offset), y + (int) Math.round(ySpline[0] + offset));
     for (int i = 1; i < splinePoints; i++)
       ip.lineTo(
           x + (int) (Math.round(xSpline[i]) + offset), y + (int) Math.round(ySpline[i] + offset));
     if (type == POLYGON || type == FREEROI || type == TRACED_ROI)
       ip.lineTo(
           x + (int) (Math.round(xSpline[0]) + offset), y + (int) Math.round(ySpline[0] + offset));
   } else if (xpf != null) {
     ip.moveTo(x + (int) (Math.round(xpf[0]) + offset), y + (int) Math.round(ypf[0] + offset));
     for (int i = 1; i < nPoints; i++)
       ip.lineTo(x + (int) (Math.round(xpf[i]) + offset), y + (int) Math.round(ypf[i] + offset));
     if (type == POLYGON || type == FREEROI || type == TRACED_ROI)
       ip.lineTo(x + (int) (Math.round(xpf[0]) + offset), y + (int) Math.round(ypf[0] + offset));
   } else {
     ip.moveTo(x + xp[0], y + yp[0]);
     for (int i = 1; i < nPoints; i++) ip.lineTo(x + xp[i], y + yp[i]);
     if (type == POLYGON || type == FREEROI || type == TRACED_ROI) ip.lineTo(x + xp[0], y + yp[0]);
   }
   ip.setLineWidth(saveWidth);
   updateFullWindow = true;
 }