Examples of PathIterator


Examples of ae.java.awt.geom.PathIterator

            } else {
                gp = strike.getGlyphOutline(glyphID, 0, 0);
                gp.transform(sgv.invdtx);
                gp.transform(AffineTransform.getTranslateInstance(x + dx, y + dy));
            }
            PathIterator iterator = gp.getPathIterator(null);
            result.append(iterator, false);
        }
View Full Code Here

Examples of com.google.code.appengine.awt.geom.PathIterator

    dst.moveToCount = src.moveToCount;
    dst.offsets = src.offsets.clone();
  }

    private int containsExact(double x, double y) {
        PathIterator pi = getPathIterator(null);
        int crossCount = Crossing.crossPath(pi, x, y);
       
        if (Crossing.isInsideEvenOdd(crossCount)) {
            return 1;
        }

        double[] segmentCoords = new double[6];
        double[] resultPoints = new double[6];
        int rule;
        double curX = -1;
        double curY = -1;
        double moveX = -1;
        double moveY = -1;
       
        for (pi = getPathIterator(null); !pi.isDone(); pi.next()) {
            rule = pi.currentSegment(segmentCoords);
            switch (rule) {
                case PathIterator.SEG_MOVETO:
                    moveX = curX = segmentCoords[0];
                    moveY = curY = segmentCoords[1];
                    break;
View Full Code Here

Examples of com.jgraph.gaeawt.java.awt.geom.PathIterator

     * @param flatness - the rasterization flatness
     * @return a MultiRectArea of rasterized shape
     */
    public MultiRectArea rasterize(Shape shape, double flatness) {

        PathIterator path = shape.getPathIterator(null, flatness);

        // Shape is empty
        if (path.isDone()) {
            return new MultiRectArea();
        }

        makeBuffer(path, flatness);

View Full Code Here

Examples of java.awt.geom.PathIterator

            ensureStrokeColor();
        } else if (drawType==FILL) {
            ensureFillColor();
        }
           
        PathIterator points;
        if (drawType == CLIP) {
            points = s.getPathIterator(IDENTITY);
        } else {
            points = s.getPathIterator(_transform);
        }
        float[] coords = new float[6];
        int traces = 0;
        while(!points.isDone()) {
            ++traces;
            int segtype = points.currentSegment(coords);
            normalizeY(coords);
            switch(segtype) {
                case PathIterator.SEG_CLOSE:
                    cb.closePath();
                    break;
                   
                case PathIterator.SEG_CUBICTO:
                    cb.curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
                    break;
                   
                case PathIterator.SEG_LINETO:
                    cb.lineTo(coords[0], coords[1]);
                    break;
                   
                case PathIterator.SEG_MOVETO:
                    cb.moveTo(coords[0], coords[1]);
                    break;
                   
                case PathIterator.SEG_QUADTO:
                    cb.curveTo(coords[0], coords[1], coords[2], coords[3]);
                    break;
            }
            points.next();
        }
       
        switch (drawType) {
        case FILL:
            if (traces > 0) {
                if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
                    cb.eoFill();
                else
                    cb.fill();
            }
            break;
        case STROKE:
            if (traces > 0)
                cb.stroke();
            break;
        default: //drawType==CLIP
            if (traces == 0)
                cb.rectangle(0, 0, 0, 0);
            if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
                cb.eoClip();
            else
                cb.clip();
            cb.newPath();
        }
View Full Code Here

Examples of java.awt.geom.PathIterator

    }
    if (dataArea.isEmpty() == false)
    {
      a.intersect(new Area(dataArea));
    }
    final PathIterator pathIterator = a.getPathIterator(null, 2);
    final FloatList floats = new FloatList(100);
    final float[] coords = new float[6];
    while (pathIterator.isDone() == false)
    {
      final int retval = pathIterator.currentSegment(coords);
      if (retval == PathIterator.SEG_MOVETO ||
          retval == PathIterator.SEG_LINETO)
      {
        floats.add(coords[0]);
        floats.add(coords[1]);
      }
      pathIterator.next();
    }

    if (floats.size() == 0)
    {
      return null;
View Full Code Here

Examples of java.awt.geom.PathIterator

    {
      throw new ObjectFactoryException("Class is not assignable");
    }

    final Shape s = (Shape) o;
    final PathIterator pi = s.getPathIterator(AffineTransform.getTranslateInstance(0, 0));
    if (pi.getWindingRule() == PathIterator.WIND_EVEN_ODD)
    {
      setParameter(GeneralPathObjectDescription.WINDING_RULE_NAME, GeneralPathObjectDescription.WINDING_RULE_EVEN_ODD);
    }
    else
    {
      setParameter(GeneralPathObjectDescription.WINDING_RULE_NAME, GeneralPathObjectDescription.WINDING_RULE_NON_ZERO);
    }

    final float[] points = new float[GeneralPathObjectDescription.MAX_POINTS];
    final ArrayList segments = new ArrayList();
    while (pi.isDone() == false)
    {
      final int type = pi.currentSegment(points);
      final PathIteratorSegment seg = new PathIteratorSegment();
      switch (type)
      {
        case PathIterator.SEG_CLOSE:
        {
          seg.setSegmentType(PathIterator.SEG_CLOSE);
          break;
        }
        case PathIterator.SEG_CUBICTO:
        {
          seg.setSegmentType(PathIterator.SEG_CUBICTO);
          seg.setX1(points[0]);
          seg.setY1(points[1]);
          seg.setX2(points[2]);
          seg.setY2(points[3]);
          seg.setX3(points[4]);
          seg.setY3(points[5]);
          break;
        }
        case PathIterator.SEG_LINETO:
        {
          seg.setSegmentType(PathIterator.SEG_LINETO);
          seg.setX1(points[0]);
          seg.setY1(points[1]);
          break;
        }
        case PathIterator.SEG_MOVETO:
        {
          seg.setSegmentType(PathIterator.SEG_MOVETO);
          seg.setX1(points[0]);
          seg.setY1(points[1]);
          break;
        }
        case PathIterator.SEG_QUADTO:
        {
          seg.setSegmentType(PathIterator.SEG_QUADTO);
          seg.setX1(points[0]);
          seg.setY1(points[1]);
          seg.setX2(points[2]);
          seg.setY2(points[3]);
          break;
        }
        default:
          throw new IllegalStateException("Unexpected result from PathIterator.");
      }
      segments.add(seg);
      pi.next();
    }

    setParameter(GeneralPathObjectDescription.SEGMENTS_NAME, segments.toArray(
        new PathIteratorSegment[segments.size()]));
  }
View Full Code Here

Examples of java.awt.geom.PathIterator

    }
    else if (drawType == PdfGraphics2D.FILL)
    {
      setFillPaint();
    }
    final PathIterator points;
    if (drawType == PdfGraphics2D.CLIP)
    {
      points = s.getPathIterator(PdfGraphics2D.IDENTITY);
    }
    else
    {
      points = s.getPathIterator(transform);
    }
    final float[] coords = new float[6];
    int traces = 0;
    while (!points.isDone())
    {
      ++traces;
      final int segtype = points.currentSegment(coords);
      normalizeY(coords);
      switch (segtype)
      {
        case PathIterator.SEG_CLOSE:
          cb.closePath();
          break;

        case PathIterator.SEG_CUBICTO:
          cb.curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
          break;

        case PathIterator.SEG_LINETO:
          cb.lineTo(coords[0], coords[1]);
          break;

        case PathIterator.SEG_MOVETO:
          cb.moveTo(coords[0], coords[1]);
          break;

        case PathIterator.SEG_QUADTO:
          cb.curveTo(coords[0], coords[1], coords[2], coords[3]);
          break;
        default:
          throw new IllegalStateException("Invalid segment type in path");
      }
      points.next();
    }
    switch (drawType)
    {
      case PdfGraphics2D.FILL:
        if (traces > 0)
        {
          if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
          {
            cb.eoFill();
          }
          else
          {
            cb.fill();
          }
        }
        break;
      case PdfGraphics2D.STROKE:
        if (traces > 0)
        {
          cb.stroke();
        }
        break;
      default: //drawType==CLIP
        if (traces == 0)
        {
          cb.rectangle(0, 0, 0, 0);
        }
        if (points.getWindingRule() == PathIterator.WIND_EVEN_ODD)
        {
          cb.eoClip();
        }
        else
        {
View Full Code Here

Examples of java.awt.geom.PathIterator

            Debug.message("omgraphic", "OMArc: null projection in generate!");
            return false;
        }

        GeneralPath gp, gp1, gp2;
        PathIterator pi;
        AffineTransform af = null;

        switch (renderType) {
        case RENDERTYPE_OFFSET:
            if (!proj.isPlotable(center)) {
View Full Code Here

Examples of java.awt.geom.PathIterator

    public void draw(Graphics g, Shape s) {

        if (decorations.isEmpty())
            return;

        PathIterator pi = s.getPathIterator(null, FLATNESS);
        int segType;
        double[] segCoords = new double[6];

        LinkedList points = new LinkedList();
        Point2D firstPoint = null;
        Point2D point;

        // split path in polylines
        do {
            segType = pi.currentSegment(segCoords);
            point = new Point2D.Double(segCoords[0], segCoords[1]);

            switch (segType) {
            case PathIterator.SEG_MOVETO:
                if (firstPoint == null)
                    firstPoint = point;

                if (points.size() > 0) {
                    // draw decorations for the previous polyline
                    draw(g, points);
                }
                // init a new polyline
                points.clear();
                points.add(point);
                break;
            case PathIterator.SEG_LINETO:
                points.add(point);
                break;
            case PathIterator.SEG_CLOSE:
                points.add(firstPoint);
                break;
            }
            pi.next();
        } while (!pi.isDone());

        // draw decorations for the last poly
        if (points.size() > 0) {
            draw(g, points);
        }
View Full Code Here

Examples of java.awt.geom.PathIterator

        if (getNeedToRegenerate() || shape == null) {
            return distance;
        }

        PathIterator pi2 = shape.getPathIterator(null);
        FlatteningPathIterator pi = new FlatteningPathIterator(pi2, .25);
        double[] coords = new double[6];
        int count = 0;
        double startPntX = 0;
        double startPntY = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.