Package com.jgraph.gaeawt.java.awt.geom

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


  }

  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(
View Full Code Here


  {
    // 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.getWidth(),
        (int) newBounds.getHeight());
  }
View Full Code Here

        for (int i = start; i < end; i++){
            width += charWidth(chars[i]);
        }

        Rectangle2D rect2D = new Rectangle2D.Float(minX, minY, width, height);
        return rect2D;

    }
View Full Code Here

     * @param frc specified FontRenderContext
     */
    @Override
    public Rectangle2D getMaxCharBounds(FontRenderContext frc){

        Rectangle2D rect2D = fPhysicalFonts[0].getMaxCharBounds(frc);
        float minY = (float)rect2D.getY();
        float maxWidth = (float)rect2D.getWidth();
        float maxHeight = (float)rect2D.getHeight();
        if (numFonts == 1){
            return rect2D;
        }

        for (int i = 1; i < numFonts; i++){
            if (fPhysicalFonts[i] != null){
                rect2D = fPhysicalFonts[i].getMaxCharBounds(frc);
                float y = (float)rect2D.getY();
                float mWidth = (float)rect2D.getWidth();
                float mHeight = (float)rect2D.getHeight();
                if (y < minY){
                    minY = y;
                }
                if (mWidth > maxWidth){
                    maxHeight = mWidth;
View Full Code Here

    /**
     * Creates visual bounds shape
     * @return visual bounds rectangle
     */
    public Rectangle2D getVisualBounds() {
        Rectangle2D bounds = null;

        for (int i=0; i<runSegments.size(); i++) {
            TextRunSegment s = runSegments.get(i);
            if (bounds != null) {
                Rectangle2D.union(bounds, s.getVisualBounds(), bounds);
View Full Code Here

    /**
     * Creates logical bounds shape
     * @return logical bounds rectangle
     */
    public Rectangle2D getLogicalBounds() {
        Rectangle2D bounds = null;

        for (int i=0; i<runSegments.size(); i++) {
            TextRunSegment s = runSegments.get(i);
            if (bounds != null) {
                Rectangle2D.union(bounds, s.getLogicalBounds(), bounds);
View Full Code Here

        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

    }

    public Rectangle getPixelBounds(FontRenderContext frc, float x, float y) {
        // default implementation - integer Rectangle, that encloses visual
        // bounds rectangle
        Rectangle2D visualRect = getVisualBounds();

        int minX = (int)Math.floor(visualRect.getMinX() + x);
        int minY = (int)Math.floor(visualRect.getMinY() + y);
        int width = (int)Math.ceil(visualRect.getMaxX() + x) - minX;
        int height = (int)Math.ceil(visualRect.getMaxY() + y) - minY;

        return new Rectangle(minX, minY, width, height);
    }
View Full Code Here

        return new Rectangle(minX, minY, width, height);
    }

    public Rectangle getGlyphPixelBounds(int index, FontRenderContext frc,
            float x, float y) {
        Rectangle2D visualRect = getGlyphVisualBounds(index).getBounds2D();

        int minX = (int)Math.floor(visualRect.getMinX() + x);
        int minY = (int)Math.floor(visualRect.getMinY() + y);
        int width = (int)Math.ceil(visualRect.getMaxX() + x) - minX;
        int height = (int)Math.ceil(visualRect.getMaxY() + y) - minY;

        return new Rectangle(minX, minY, width, height);
    }
View Full Code Here

        float maxX = 0;
        float maxY = 0;
        boolean firstIteration = true;

        for (int i = 0; i < this.getNumGlyphs(); i++) {
            Rectangle2D bounds = this.getGlyphVisualBounds(i).getBounds2D();
            if (bounds.getWidth() == 0){
                continue;
            }
            xm = (float)bounds.getX();
            ym = (float)bounds.getY();

            xM = (float)(xm + bounds.getWidth());

            yM = ym + (float) bounds.getHeight();

            if (firstIteration) {
                minX = xm;
                minY = ym;
                maxX = xM;
View Full Code Here

TOP

Related Classes of com.jgraph.gaeawt.java.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.