Examples of GeneralPath


Examples of ae.java.awt.geom.GeneralPath

            Rectangle2D result = null;
            if (sgv.invdtx == null) {
                result = new Rectangle2D.Float();
                result.setRect(strike.getGlyphOutlineBounds(glyphID)); // don't mutate cached rect
            } else {
                GeneralPath gp = strike.getGlyphOutline(glyphID, 0, 0);
                gp.transform(sgv.invdtx);
                result = gp.getBounds2D();
            }
            result.setRect(result.getMinX() + x + dx, result.getMinY() + y + dy,
                           result.getWidth(), result.getHeight());
            return result;
        }
View Full Code Here

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

    public void transform(AffineTransform t) {
        t.transform(points, 0, points, 0, pointSize / 2);
    }

    public Shape createTransformedShape(AffineTransform t) {
        GeneralPath p = (GeneralPath)clone();
        if (t != null) {
            p.transform(t);
        }
        return p;
    }
View Full Code Here

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

    }

    public Shape getOutline(AffineTransform xform) {
        breaker.createAllSegments();

        GeneralPath outline = breaker.getOutline();

        if (outline != null && xform != null) {
            outline.transform(xform);
        }

        return outline;
    }
View Full Code Here

Examples of java.awt.geom.GeneralPath

      int thresh = Math.max(Line.ON_LINE_THRESH, getStrokeWidth() / 2);
      PolyUtil.ClosestResult result = PolyUtil.getClosestPoint(loc,
          closed, handles);
      return result.getDistanceSq() < thresh * thresh;
    } else if (type == DrawAttr.PAINT_FILL) {
      GeneralPath path = getPath();
      return path.contains(loc.getX(), loc.getY());
    } else { // fill and stroke
      GeneralPath path = getPath();
      if (path.contains(loc.getX(), loc.getY())) return true;
      int width = getStrokeWidth();
      PolyUtil.ClosestResult result = PolyUtil.getClosestPoint(loc,
          closed, handles);
      return result.getDistanceSq() < (width * width) / 4;
    }
View Full Code Here

Examples of java.awt.geom.GeneralPath

    int stroke = getStrokeWidth();
    bounds = stroke < 2 ? bds : bds.expand(stroke / 2);
  }

  private GeneralPath getPath() {
    GeneralPath p = path;
    if (p == null) {
      p = new GeneralPath();
      Handle[] hs = handles;
      if (hs.length > 0) {
        boolean first = true;
        for (Handle h : hs) {
          if (first) {
            p.moveTo(h.getX(), h.getY());
            first = false;
          } else {
            p.lineTo(h.getX(), h.getY());
          }
        }
      }
      path = p;
    }
View Full Code Here

Examples of java.awt.geom.GeneralPath

      GraphicsUtil.drawCenteredArc(g, -7050, 85, 90, -53);
    }
    paintShield(g, -width, 0, width, height);
    */
   
    GeneralPath path;
    if (width < 40) {
      path = PATH_NARROW;
    } else if (width < 60) {
      path = PATH_MEDIUM;
    } else {
View Full Code Here

Examples of java.awt.geom.GeneralPath

    }
    */
  }
 
  private static GeneralPath computeShield(int width, int height) {
    GeneralPath base;
    if (width < 40) {
      base = SHIELD_NARROW;
    } else if (width < 60) {
      base = SHIELD_MEDIUM;
    } else {
      base = SHIELD_WIDE;
    }

    if (height <= width) { // no wings
      return base;
    } else { // we need to add wings
      int wingHeight = (height - width) / 2;
      int dx = Math.min(20, wingHeight / 4);
     
      GeneralPath path = new GeneralPath();
      path.moveTo(-width, -height / 2);
      path.quadTo(-width + dx, -(width + height) / 4, -width, -width / 2);
      path.append(base, true);
      path.quadTo(-width + dx, (width + height) / 4, -width, height / 2);
      return path;
    }
  }
View Full Code Here

Examples of java.awt.geom.GeneralPath

    Location loc0 = OrGate.FACTORY.getInputOffset(attrs, 0);
    Location locn = OrGate.FACTORY.getInputOffset(attrs, inputs - 1);
    int totalHeight = 10 + loc0.manhattanDistanceTo(locn);
    if (totalHeight < width) totalHeight = width;
   
    GeneralPath path = computeShield(width, totalHeight);
    for (int i = 0; i < inputs; i++) {
      Location loci = OrGate.FACTORY.getInputOffset(attrs, i);
      Point2D p = new Point2D.Float(loci.getX() + 1, loci.getY());
      int iters = 0;
      while (path.contains(p) && iters < 15) {
        iters++;
        p.setLocation(p.getX() + 1, p.getY());
      }
      if (iters >= 15) iters = 0;
      lengths[i] = iters;
View Full Code Here

Examples of java.awt.geom.GeneralPath

  public Shape getShape()
  {
    if (polygon == null)
    {
      polygon = new GeneralPath();

      for (int i = 0; i < coordinates.length; i += 2)
      {
        float coordinateX = coordinates[i];
        float coordinateY = coordinates[i + 1];
View Full Code Here

Examples of java.awt.geom.GeneralPath

    if (segments == null)
    {
      return null;
    }

    final GeneralPath path = new GeneralPath();
    path.setWindingRule(wRule);
    for (int i = 0; i < segments.length; i++)
    {
      final int segmentType = segments[i].getSegmentType();
      switch (segmentType)
      {
        case PathIterator.SEG_CLOSE:
        {
          path.closePath();
          break;
        }
        case PathIterator.SEG_CUBICTO:
        {
          path.curveTo(segments[i].getX1(), segments[i].getY1(),
              segments[i].getX2(), segments[i].getY2(),
              segments[i].getX3(), segments[i].getY3());
          break;
        }
        case PathIterator.SEG_LINETO:
        {
          path.lineTo(segments[i].getX1(), segments[i].getY1());
          break;
        }
        case PathIterator.SEG_MOVETO:
        {
          path.moveTo(segments[i].getX1(), segments[i].getY1());
          break;
        }
        case PathIterator.SEG_QUADTO:
        {
          path.quadTo(segments[i].getX1(), segments[i].getY1(),
              segments[i].getX2(), segments[i].getY2());
          break;
        }
        default:
          throw new IllegalStateException("Unexpected result from path iterator.");
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.