Package java.awt

Examples of java.awt.Shape


          Graphics2D grx = bi.createGraphics();
         
          int xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth));
          int yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight));

          Shape oldClipShape = grx.getClip();

          grx.clip(
            new Rectangle(
              0,
              0,
View Full Code Here


   */
  public void draw(Graphics2D grx, JRPrintFrame frame, int offsetX, int offsetY) throws JRException
  {
    setGraphics(grx);
   
    Shape oldClipShape = null;
    if (isClip)
    {
      oldClipShape = grx.getClip();
      grx.clip(
        new Rectangle(
View Full Code Here

   */
  private void draw(Collection elements) throws JRException
  {
    if (elements != null && elements.size() > 0)
    {
      Shape clipArea = grx.getClip();
      for(Iterator it = elements.iterator(); it.hasNext();)
      {
        JRPrintElement element = (JRPrintElement)it.next();
       
        if (
          (filter != null && !filter.isToExport(element))
          || !clipArea.intersects(
            element.getX() + elementOffset.getX() - ELEMENT_RECTANGLE_PADDING,
            element.getY() + elementOffset.getY() - ELEMENT_RECTANGLE_PADDING,
            element.getWidth() + 2 * ELEMENT_RECTANGLE_PADDING,
            element.getHeight() + 2 * ELEMENT_RECTANGLE_PADDING)
          )
 
View Full Code Here

            Graphics2D grx = bi.createGraphics();

            int xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth));
            int yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight));

            Shape oldClipShape = grx.getClip();

            grx.clip(
              new Rectangle(
                0,
                0,
View Full Code Here

                    AffineTransform transform = decorator.getTransform(this);

                    if (!transform.isIdentity()) {
                        // Apply the decorator's transform to the repaint area
                        Rectangle area = new Rectangle(x, y, width, height);
                        Shape transformedShape = transform.createTransformedShape(area);
                        Bounds tranformedBounds = new Bounds(transformedShape.getBounds());

                        // Limit the transformed area to the decorator's bounds
                        tranformedBounds = tranformedBounds.intersect(decorator.getBounds(this));

                        // Add the bounded area to the repaint region
View Full Code Here

       
        component = renderer.getTableCellRendererComponent(this, model.getValue(j, i), j, i, s);
        //  TODO Currently, ordinary components cannot be used as a renderer - something to do with the peer not be created
        component.setBounds(0, 0, w - 1, iRowHeight - 1);
        gImage.translate(x , y);
        Shape clip = gImage.getClip();
        gImage.setClip(0, 0, w -1 , iRowHeight - 1);
        component.paint(gImage);
        gImage.translate(-x , -y);
        gImage.setClip(clip);       
       
View Full Code Here

      /*
        NOTE: Local graphics state is purposely isolated from surrounding graphics state,
        so no inner operation can alter its subsequent scanning.
      */
      // Save outer graphics state!
      Shape clip = context.getClip();

      render(state);

      // Restore outer graphics state!
      context.setClip(clip);
View Full Code Here

      float highestElevation = Float.MIN_VALUE;
      for (HomePieceOfFurniture homePiece : this.home.getFurniture()) {
        if (homePiece != piece
            && !homePiece.isDoorOrWindow()
            && homePiece.isVisible()) {
          Shape shape = getPath(homePiece.getPoints());
          boolean surroundingPieceContainsPiece = true;
          for (float [] point : piecePoints) {
            if (!shape.contains(point [0], point [1])) {
              surroundingPieceContainsPiece = false;
              break;
            }
          }
          if (surroundingPieceContainsPiece) {
View Full Code Here

  private Geometry [] createWallGeometries(int wallSide, HomeTexture texture) {
    float [][] wallSidePoints = getWallSidePoints(wallSide);
    float [] textureReferencePoint = wallSide == LEFT_WALL_SIDE
        ? wallSidePoints [0]
        : wallSidePoints [wallSidePoints.length - 1];
    Shape wallShape = getShape(wallSidePoints);
    Area wallArea = new Area(wallShape);
    float wallHeightAtStart = getWallHeightAtStart();
    float wallHeightAtEnd = getWallHeightAtEnd();
    float maxWallHeight = Math.max(wallHeightAtStart, wallHeightAtEnd);
   
    // Compute wall angles and top line factors
    Wall wall = (Wall)getUserData();
    double wallYawAngle = Math.atan2(wall.getYEnd() - wall.getYStart(), wall.getXEnd() - wall.getXStart());
    double cosWallYawAngle = Math.cos(wallYawAngle);
    double sinWallYawAngle = Math.sin(wallYawAngle);
    double wallXStartWithZeroYaw = cosWallYawAngle * wall.getXStart() + sinWallYawAngle * wall.getYStart();
    double wallXEndWithZeroYaw = cosWallYawAngle * wall.getXEnd() + sinWallYawAngle * wall.getYEnd();
    boolean roundWall = wall.getArcExtent() != null && wall.getArcExtent() != 0;
    double topLineAlpha;
    double topLineBeta;
    if (wallHeightAtStart == wallHeightAtEnd) {
      topLineAlpha = 0;
      topLineBeta = wallHeightAtStart;
    } else {
      topLineAlpha = (wallHeightAtEnd - wallHeightAtStart) / (wallXEndWithZeroYaw - wallXStartWithZeroYaw);
      topLineBeta = wallHeightAtStart - topLineAlpha * wallXStartWithZeroYaw;
    }
   
    // Search which doors or windows intersect with this wall side
    List<DoorOrWindowArea> windowIntersections = new ArrayList<DoorOrWindowArea>();
    for (HomePieceOfFurniture piece : getVisibleDoorsAndWindows(this.home.getFurniture())) {
      if (piece.getElevation() < maxWallHeight) {
        Shape pieceShape = getShape(piece.getPoints());
        Area pieceArea = new Area(pieceShape);
        Area intersectionArea = new Area(wallShape);
        intersectionArea.intersect(pieceArea);
        if (!intersectionArea.isEmpty()) {
          windowIntersections.add(new DoorOrWindowArea(intersectionArea, Arrays.asList(new HomePieceOfFurniture [] {piece})));
View Full Code Here

              // Find the intersection of the door with home walls
              Area wallsDoorIntersection = new Area(getWallsArea());
              wallsDoorIntersection.intersect(new Area(getPath(doorPoints)));
              // Reduce the size of intersection to its half
              float [][] intersectionPoints = getPathPoints(getPath(wallsDoorIntersection), false);
              Shape halfDoorPath = null;
              if (intersectionPoints.length == 4) {
                float epsilon = 0.05f;
                for (int i = 0; i < intersectionPoints.length; i++) {
                  // Check point in room with rectangle intersection test otherwise we miss some points
                  if (roomPath.intersects(intersectionPoints [i][0] - epsilon / 2,
View Full Code Here

TOP

Related Classes of java.awt.Shape

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.