Package java.awt

Examples of java.awt.Rectangle.intersection()


                srcRect = srcTile.getBounds();

                // Ensure that the source tile doesn't lie outside the
                // destination tile.
                if(!dstRect.contains(srcRect)) {
                    srcRect = dstRect.intersection(srcRect);
                    srcTile =
                        srcTile.createChild(srcTile.getMinX(),
                                            srcTile.getMinY(),
                                            srcRect.width,
                                            srcRect.height,
View Full Code Here


        //
        // determine the source rectangle needed to compute the destRect
        //
        Rectangle srcRect = mapDestRect(destRect, 0);
        if (extender == null) {
            srcRect = srcRect.intersection(srcimg);
        } else {
            srcRect = srcRect.intersection(padimg);
        }

        if (!(srcRect.width > 0 && srcRect.height > 0)) {
View Full Code Here

        //
        Rectangle srcRect = mapDestRect(destRect, 0);
        if (extender == null) {
            srcRect = srcRect.intersection(srcimg);
        } else {
            srcRect = srcRect.intersection(padimg);
        }

        if (!(srcRect.width > 0 && srcRect.height > 0)) {
      if (setBackground)
          ImageUtil.fillBackground(dest, destRect1, backgroundValues);
View Full Code Here

      int xloc = curr.getXLoc()*tileWidth +tileGridXOff;
      int yloc = curr.getYLoc()*tileHeight+tileGridYOff;
      Rectangle tb = new Rectangle(xloc, yloc,
           curr.getWidth()*tileWidth,
           curr.getHeight()*tileHeight);
      tb = tb.intersection(bounds);
      Point loc = new Point(tb.x, tb.y);
      WritableRaster child = Raster.createPackedRaster
    (dbi, tb.width, tb.height, tb.width, masks, loc);
      genRect(child);
      if (use_INT_PACK) GraphicsUtil.copyData_INT_PACK(child, wr);
View Full Code Here

      int xloc = curr.getXLoc()*tileWidth +tileGridXOff;
      int yloc = curr.getYLoc()*tileHeight+tileGridYOff;
      Rectangle tb = new Rectangle(xloc, yloc,
           curr.getWidth()*tileWidth,
           curr.getHeight()*tileHeight);
      tb = tb.intersection(bounds);

      WritableRaster child =
    wr.createWritableChild(tb.x, tb.y, tb.width, tb.height,
               tb.x, tb.y, null);
      // System.out.println("Computing : " + child);
View Full Code Here

            } else {
                clipR   = clip.getBounds();

                if (clipR.intersects(crR) == false)
                    return; // Nothing to draw...
                clipR = clipR.intersection(crR);
            }

            Rectangle gcR = getDestinationBounds(g2d);
            // System.out.println("ClipRects: " + clipR + " -> " + gcR);
            if (gcR != null) {
View Full Code Here

        devShapeBounds = at.createTransformedShape(shape).getBounds();
        devClipBounds  = at.createTransformedShape(clip).getBounds();
        if (!devClipBounds.intersects(devShapeBounds)) {
            return true;
        }
        devBounds = devShapeBounds.intersection(devClipBounds);
        int devX = devBounds.x;
        int devY = devBounds.y;
        int devW = devBounds.width;
        int devH = devBounds.height;
View Full Code Here

    public Raster getData(Rectangle rect) {
        Rectangle r = (Rectangle)rect.clone();

        if (!r.intersects(getBounds()))
            return null;
        r = r.intersection(getBounds());
        r.translate(-getMinX(), - getMinY());

        Raster ret = bi.getData(r);
        return ret.createTranslatedChild(ret.getMinX()+getMinX(),
                                         ret.getMinY()+getMinY());
View Full Code Here

    final int spaceOnX = Math.max(s.width - f.width, 0);
    final int spaceOnY = Math.max(s.height - f.height, 0);
    final int x = (int) (horizontalPercent * spaceOnX) + s.x;
    final int y = (int) (verticalPercent * spaceOnY) + s.y;
    frame.setBounds(x, y, f.width, f.height);
    frame.setBounds(s.intersection(frame.getBounds()));
  }

  /**
   * Positions the specified frame at a random location on the screen while ensuring that the entire frame is visible
   * (provided that the frame is smaller than the screen).
View Full Code Here

    final int spaceOnX = Math.max(s.width - f.width, 0);
    final int spaceOnY = Math.max(s.height - f.height, 0);
    final int x = (int) (horizontalPercent * spaceOnX) + s.x;
    final int y = (int) (verticalPercent * spaceOnY) + s.y;
    frame.setBounds(x, y, f.width, f.height);
    frame.setBounds(s.intersection(frame.getBounds()));
  }

  /**
   * Positions the specified frame at a random location on the screen while ensuring that the entire frame is visible
   * (provided that the frame is smaller than the screen).
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.