Package java.awt.geom

Examples of java.awt.geom.Area$Intersection


    public boolean checkClip(Shape cl) {
        if (getData().clip == null) {
            if (cl != null) {
                return true;
            }
        } else if (!new Area(getData().clip).equals(new Area(cl))) {
            return true;
        }
        //TODO check for clips that are larger than the current
        return false;
    }
View Full Code Here


     *
     * @param cl the new clip in the current state
     */
    public void setClip(Shape cl) {
        if (getData().clip != null) {
            Area newClip = new Area(getData().clip);
            newClip.intersect(new Area(cl));
            getData().clip = new GeneralPath(newClip);
        } else {
            getData().clip = cl;
        }
    }
View Full Code Here

     * @param shape
     * @return the master shape
     */
    private final Master createMaster(RenderContext ctx, Shape shape,
                                      double ascent) {
        final Area area = new Area(shape);
        final double scale = MASTER_HEIGHT / ascent;

        area.transform(AffineTransform.getScaleInstance(scale, scale));
        final Rectangle bounds = area.getBounds();
        // System.out.println("createMaster bounds " + bounds);
        // area.transform(AffineTransform.getTranslateInstance(-bounds.getMinX(),
        // -bounds.getMinY()));
        // bounds = area.getBounds();

        final int minX = (int) (bounds.getMinX() - 0.5);
        final int maxX = (int) (bounds.getMaxX() + 0.5);
        final int minY = (int) (bounds.getMinY() - 0.5);
        final int maxY = (int) (bounds.getMaxY() + 0.5);
        final int width = maxX - minX;
        final int height = maxY - minY;

        BitSet bits = (BitSet) ctx.getObject(BITS_NAME);
        if (bits == null) {
            bits = new BitSet(width * height);
            ctx.setObject(BITS_NAME, bits);
        } else {
            bits.clear();
        }
        int ofs = 0;
        for (int y = maxY; y > minY; y--) {
            for (int x = minX; x < maxX; x++) {
                if (area.contains(x, y)) {
                    bits.set(ofs);
                }
                ofs++;
            }
        }
View Full Code Here

    }

    public final GlyphRenderer getRenderer(Glyph g, double ascent) {
        GlyphRenderer r = (GlyphRenderer) ctx.getObject(g);
        if (r == null) {
            Area area;
            if (g instanceof ShapedGlyph)
                area = new Area(((ShapedGlyph) g).getShape());
            else
                area = new Area(g.getBBox());

            r = new GlyphRenderer(ctx, area, ascent);
            ctx.setObject(g, r);
        }
        return r;
View Full Code Here

                gp.lineTo(boxes[5].x, boxes[5].y);
                gp.lineTo(boxes[6].x, boxes[6].y);
                gp.lineTo(boxes[7].x, boxes[7].y);
                gp.closePath();
            }
            areas[nAreas++] = new Area(gp);
        }

        mergeAreas(shape, areas, nAreas);
    }
View Full Code Here

    if (onStroke)
    {
      s = getStroke().createStrokedShape(s);
    }
    s = getTransform().createTransformedShape(s);
    final Area area = new Area(s);
    final Shape clip = getClip();
    if (clip != null)
    {
      area.intersect(new Area(clip));
    }
    return area.intersects(rect.x, rect.y, rect.width, rect.height);
  }
View Full Code Here

    }

    final Rectangle2D boundsCorrected = bounds.getBounds2D();
    boundsCorrected.setRect(-DELTA, -DELTA,
        DELTA + boundsCorrected.getWidth(), DELTA + boundsCorrected.getHeight());
    final Area a = new Area(boundsCorrected);
    if (a.isEmpty())
    {
      // don't clip  ... Area does not like lines
      // operations with lines always result in an empty Bounds:(0,0,0,0) area
      return new GeneralPath();
    }

    final Area clipArea = new Area(s);
    a.intersect(clipArea);
    return a;

  }
View Full Code Here

    setFont(new Font("sanserif", Font.PLAIN, 12));
    this.cb = cb;
    cb.saveState();
    this.width = width;
    this.height = height;
    clip = new Area(new Rectangle2D.Float(0, 0, width, height));
    clip(clip);
    oldStroke = strokeOne;
    stroke = strokeOne;
    originalStroke = strokeOne;
    setStrokeDiff(stroke, null);
View Full Code Here

    if (onStroke)
    {
      s = stroke.createStrokedShape(s);
    }
    s = transform.createTransformedShape(s);
    final Area area = new Area(s);
    if (clip != null)
    {
      area.intersect(clip);
    }
    return area.intersects(rect.x, rect.y, rect.width, rect.height);
  }
View Full Code Here

    g2.setFont(this.font);
    g2.cb = this.cb.getDuplicate();
    g2.cb.saveState();
    g2.width = this.width;
    g2.height = this.height;
    g2.followPath(new Area(new Rectangle2D.Float(0, 0, width, height)), PdfGraphics2D.CLIP);
    if (this.clip != null)
    {
      g2.clip = new Area(this.clip);
    }
    g2.stroke = stroke;
    g2.originalStroke = originalStroke;
    g2.strokeOne = (BasicStroke) g2.transformStroke(g2.strokeOne);
    g2.oldStroke = g2.strokeOne;
View Full Code Here

TOP

Related Classes of java.awt.geom.Area$Intersection

Copyright © 2018 www.massapicom. 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.