Package java.awt.geom

Examples of java.awt.geom.AffineTransform.rotate()


            at.translate(0, viewBox.getWidth());
            at.rotate(-Math.PI / 2.0);
            break;
        case 180:
            at.translate(viewBox.getWidth(), viewBox.getHeight());
            at.rotate(-Math.PI);
            break;
        case 270:
            at.scale(viewBox.getWidth() / viewBox.getHeight(), viewBox.getHeight() / viewBox.getWidth());
            at.translate(viewBox.getHeight(), 0);
            at.rotate(-Math.PI * 1.5);
 
View Full Code Here


            at.rotate(-Math.PI);
            break;
        case 270:
            at.scale(viewBox.getWidth() / viewBox.getHeight(), viewBox.getHeight() / viewBox.getWidth());
            at.translate(viewBox.getHeight(), 0);
            at.rotate(-Math.PI * 1.5);
        default:
            //no additional transformations necessary
        }
        //Compensate for Crop Boxes not starting at 0,0
        at.translate(-viewBox.getLowerLeftX(), -viewBox.getLowerLeftY());
View Full Code Here

    AffineTransformOp op = new AffineTransformOp(xform, AffineTransformOp.TYPE_BICUBIC);
    BufferedImage img = new BufferedImage(30, 40, BufferedImage.TYPE_INT_RGB);
    harness.check(op.getBounds2D(img), new Rectangle2D.Float(-40, 0, 40, 30));

    // Do it again, but result in a diamond (not another level rectangle)
    xform.rotate(Math.PI / 3);
    op = new AffineTransformOp(xform, AffineTransformOp.TYPE_BICUBIC);
    harness.check(op.getBounds2D(img), new Rectangle2D.Float(-45.980762f,
                                                             -34.641018f,
                                                             45.980762f,
                                                             49.641018f));
View Full Code Here

                                                             45.980762f,
                                                             49.641018f));
   
    // Rotation about a point
    xform.setToIdentity();
    xform.rotate(Math.PI / 2, 10, 15);
    op = new AffineTransformOp(xform, AffineTransformOp.TYPE_BICUBIC);
    harness.check(op.getBounds2D(img), new Rectangle2D.Float(-15, 5, 40, 30));
  }
 
  private void testScale(TestHarness harness)
View Full Code Here

    AffineTransform xform = AffineTransform.getRotateInstance(Math.PI / 2);
    AffineTransformOp op = new AffineTransformOp(xform, AffineTransformOp.TYPE_BICUBIC);
    harness.check(op.getPoint2D(new Point2D.Double(5, 5), null), new Point2D.Double(-5,5));

    // Do it again, but result in a diamond (not another level rectangle)
    xform.rotate(Math.PI / 3);
    op = new AffineTransformOp(xform, AffineTransformOp.TYPE_BICUBIC);
    harness.check(op.getPoint2D(new Point2D.Double(5, 5), null), new Point2D.Double(-6.830127018922193, -1.8301270189221923));
   
    // Rotation about a point
    xform.setToIdentity();
View Full Code Here

    op = new AffineTransformOp(xform, AffineTransformOp.TYPE_BICUBIC);
    harness.check(op.getPoint2D(new Point2D.Double(5, 5), null), new Point2D.Double(-6.830127018922193, -1.8301270189221923));
   
    // Rotation about a point
    xform.setToIdentity();
    xform.rotate(Math.PI / 2, 10, 2);
    op = new AffineTransformOp(xform, AffineTransformOp.TYPE_BICUBIC);
    harness.check(op.getPoint2D(new Point2D.Double(5, 5), null), new Point2D.Double(7,-3));
  }
 
  private void testScale(TestHarness harness)
View Full Code Here

            PDRectangle crop = page.getCropBox();
            float cx = crop.getWidth() / 2f;
            float cy = crop.getHeight() / 2f;
            AffineTransform transform = new AffineTransform();
            transform.translate(cx, cy);
            transform.rotate(Math.toRadians(45));
            transform.translate(-190 /* sw/2 */, 0);
            contentStream.setTextMatrix(transform);
            contentStream.drawString(text);
            contentStream.endText();
            contentStream.close();
View Full Code Here

          transform.translate(playerChips[stackTemp[i].get(j)].x, playerChips[stackTemp[i].get(j)].y);
   
          if(playerChips[stackTemp[i].get(j)].isShift())
          {
      //      System.out.println("Imagen con shift");
            transform.rotate(Math.toRadians(180), playerChips[stackTemp[i].get(j)].width/2, playerChips[stackTemp[i].get(j)].height/2 );
          }
        //  System.out.println("Coloreando ficha : "+ i + "_" + j);
          g2d.drawImage(playerChips[stackTemp[i].get(j)].getImg(), transform, this);
        }
      }
View Full Code Here

        shearY);
      charAttsList.add(cf);
      text = new TextLayout(chars[i] + "", getFont(fontName), new FontRenderContext(null,
        false, false));
      textAt = new AffineTransform();
      textAt.rotate(rotation);
      textAt.shear(shearX, shearY);
      shape = text.getOutline(textAt);
      width += (int)shape.getBounds2D().getWidth();
      if (height < (int)shape.getBounds2D().getHeight() + rise)
      {
View Full Code Here

        CharAttributes cf = (CharAttributes)charAttsList.get(i);
        TextLayout text = new TextLayout(cf.getChar() + "", getFont(cf.getName()),
          gfx.getFontRenderContext());
        AffineTransform textAt = new AffineTransform();
        textAt.translate(curWidth, height - cf.getRise());
        textAt.rotate(cf.getRotation());
        textAt.shear(cf.getShearX(), cf.getShearY());
        Shape shape = text.getOutline(textAt);
        curWidth += shape.getBounds().getWidth();
        gfx.setXORMode(Color.BLACK);
        gfx.fill(shape);
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.