Ejemplo n.º 1
0
  /**
   * Clip all segments at screen to make sure we don't have to render huge coordinates. This is
   * especially important for fill the GeneralPath.
   */
  private void addClippedSegments() {
    geogebra.common.awt.GRectangle viewRect =
        AwtFactory.prototype.newRectangle(0, 0, view.getWidth(), view.getHeight());
    MyPoint curP = null, prevP;

    int size = pathPoints.size();
    for (int i = 0; i < size; i++) {
      prevP = curP;
      curP = pathPoints.get(i);
      if (!curP.getLineTo() || prevP == null) {
        // moveTo point, make sure it is only slightly outside screen
        geogebra.common.awt.GPoint2D p = getPointCloseToScreen(curP.getX(), curP.getY());
        addToGeneralPath(p, false);
      } else {
        // clip line at screen
        addClippedLine(prevP, curP, viewRect);
      }
    }

    if (needClosePath) {
      // line from last point to first point
      addClippedLine(curP, pathPoints.get(0), viewRect);
      gp.closePath();
    }
  }
Ejemplo n.º 2
0
 private void addSimpleSegments() {
   int size = pathPoints.size();
   for (int i = 0; i < size; i++) {
     MyPoint curP = pathPoints.get(i);
     addToGeneralPath(curP, curP.getLineTo());
   }
   if (needClosePath) gp.closePath();
 }