Package com.google.code.appengine.awt.geom

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


        TextRunSegment segment;

        double endOfPrevSeg = -1;
        for (int i = 0; i < runSegments.size(); i++) {
            segment = runSegments.get(i);
            Rectangle2D bounds = segment.getVisualBounds();
            if ((bounds.getMinX() <= x && bounds.getMaxX() >= x) || // We are in the segment
               (endOfPrevSeg < x && bounds.getMinX() > x)) { // We are somewhere between the segments
                return segment.hitTest(x,y);
            }
            endOfPrevSeg = bounds.getMaxX();
        }

        return isLTR() ? TextHitInfo.trailing(text.length) : TextHitInfo.leading(0);
    }
View Full Code Here


        }

        if (d.swapBfFg) {
            // Fill background area
            g2d.setPaint(d.fg);
            Rectangle2D bgArea = trs.getLogicalBounds();
            Rectangle2D toFill =
                    new Rectangle2D.Double(
                            bgArea.getX() + xOffset,
                            bgArea.getY() + yOffset,
                            bgArea.getWidth(),
                            bgArea.getHeight()
                    );
            g2d.fill(toFill);

            // Set foreground color
            g2d.setPaint(d.bg == null ? Color.WHITE : d.bg);
        } else {
            if (d.bg != null) { // Fill background area
                g2d.setPaint(d.bg);
                Rectangle2D bgArea = trs.getLogicalBounds();
                Rectangle2D toFill =
                        new Rectangle2D.Double(
                                bgArea.getX() + xOffset,
                                bgArea.getY() + yOffset,
                                bgArea.getWidth(),
                                bgArea.getHeight()
View Full Code Here

        double minx = segmentBounds.getMinX();
        double miny = segmentBounds.getMinY();
        double maxx = segmentBounds.getMaxX();
        double maxy = segmentBounds.getMaxY();

        Rectangle2D lb = trs.getLogicalBounds();

        if (d.swapBfFg || d.bg != null) {
            minx = Math.min(lb.getMinX() - trs.x, minx);
            miny = Math.min(lb.getMinY() - trs.y, miny);
            maxx = Math.max(lb.getMaxX() - trs.x, maxx);
            maxy = Math.max(lb.getMaxY() - trs.y, maxy);
        }

        if (d.ulOn || d.imUlStroke != null || d.strikeThrough) {
            minx = Math.min(lb.getMinX() - trs.x, minx);
            maxx = Math.max(lb.getMaxX() - trs.x, maxx);

            d.getStrokes(trs.metrics);

            if (d.ulStroke != null) {
                maxy = Math.max(
View Full Code Here

        // Returns visual bounds of this segment
        @Override
        Rectangle2D getVisualBounds() {
            if (visualBounds == null) {
                Rectangle2D bounds = ga.getBounds();

                // First and last chars can be out of logical bounds, so we calculate
                // (bounds.getWidth() - ga.getAdvance()) which is exactly the difference
                bounds.setRect(
                        bounds.getMinX() + x,
                        bounds.getMinY() + y,
                        bounds.getWidth() - ga.getAdvance() + getAdvance(),
                        bounds.getHeight()
                );
                visualBounds = TextDecorator.extendVisualBounds(this, bounds, decoration);
            }

            return (Rectangle2D) visualBounds.clone();
View Full Code Here

            if (limit > length) {
                limit = length;
            }

            Rectangle2D charBounds = ga.getBounds();
            charBounds.setRect(
                    charBounds.getX() + ga.getAdvance() * start + x,
                    charBounds.getY() + y,
                    charBounds.getWidth() + ga.getAdvance() * (limit - start),
                    charBounds.getHeight()
            );

            return charBounds;
        }
View Full Code Here

            } else
            // chartType == ChartType.LINE
            // for Line Charts, fill the shape
            {
              //---get the bounds of the shape
              Rectangle2D shapeBounds = ( (Shape) this.shapes.get( labelIndex ) ).getBounds2D();
              double XOffset = shapeBounds.getWidth() / 2;
              double YOffset = shapeBounds.getHeight() / 2;

              g2d.setStroke(this.lineChartProperties.getLineStrokes()[ labelIndex]);

              Line2D.Double line = new Line2D.Double(0, YOffset, this.legendProperties.getIconLineStrokeLength(), YOffset);
              g2d.draw( line );
View Full Code Here

        return bounds;
    }

    public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM) {
        Rectangle2D newBounds = getBounds2D(src);

        // Destination image should include (0,0) + positive part
        // of the area bounded by newBounds (in source coordinate system).
        double dstWidth = newBounds.getX() + newBounds.getWidth();
        double dstHeight = newBounds.getY() + newBounds.getHeight();

        if (dstWidth <= 0 || dstHeight <= 0) {
            // awt.251=Transformed width ({0}) and height ({1}) should be greater than 0
            throw new RasterFormatException(
                    Messages.getString("awt.251", dstWidth, dstHeight)); //$NON-NLS-1$
View Full Code Here

    public WritableRaster createCompatibleDestRaster (Raster src) {
        // Here approach is other then in createCompatibleDestImage -
        // destination should include only
        // transformed image, but not (0,0) in source coordinate system

        Rectangle2D newBounds = getBounds2D(src);
        return src.createCompatibleWritableRaster(
                (int) newBounds.getX(), (int) newBounds.getY(),
                (int) newBounds.getWidth(), (int)newBounds.getHeight()
        );
    }
View Full Code Here

    @Override
    public Rectangle2D createIntersection(Rectangle2D r) {
        if (r instanceof Rectangle) {
            return intersection((Rectangle) r);
        }
        Rectangle2D dst = new Rectangle2D.Double();
        Rectangle2D.intersect(this, r, dst);
        return dst;
    }
View Full Code Here

    @Override
    public Rectangle2D createUnion(Rectangle2D r) {
        if (r instanceof Rectangle) {
            return union((Rectangle)r);
        }
        Rectangle2D dst = new Rectangle2D.Double();
        Rectangle2D.union(this, r, dst);
        return dst;
    }
View Full Code Here

TOP

Related Classes of com.google.code.appengine.awt.geom.Rectangle2D

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.