Example #1
0
 public void drawScaledImage(BufferedImage im, int x, int y, int w, int h) {
   float scaleX = w * 1.0f / im.getWidth();
   float scaleY = h * 1.0f / im.getHeight();
   AffineTransform tx = new AffineTransform();
   tx.scale(scaleX, scaleY);
   BufferedImageOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
   drawImage(im, op, x, y);
 }
Example #2
0
 private AffineTransform makeTransform(Object o) {
   AffineTransform r = (AffineTransform) ((AffineTransform) o).clone();
   // System.out.println("r:"+r);
   if (origTransform != null) {
     AffineTransform r2 = (AffineTransform) origTransform.clone();
     // System.out.println("r2:"+r2);
     r2.concatenate(r);
     r = r2;
   }
   return r;
 }
Example #3
0
  // ---------------------------------------------------------
  private synchronized AffineTransform bufferTransform() {
    AffineTransform r = new AffineTransform();
    for (int i = 0; i < a1.size(); i++) {
      int s1 = a1.get(i);
      Object s2 = a2.get(i);
      Object s3[] = null;
      if (s2 instanceof Object[]) s3 = (Object[]) s2;

      if (s1 == setTransform) {
        r = makeTransform(s2);
      }
      if (s1 == shear) r.shear((Double) s3[0], (Double) s3[1]);
      if (s1 == rotate1) r.rotate((Double) s2);
      if (s1 == rotate2) r.rotate((Double) s3[0], (Double) s3[1], (Double) s3[2]);
      if (s1 == scale1) r.scale((Double) s3[0], (Double) s3[1]);
      if (s1 == translate1) r.translate((Double) s3[0], (Double) s3[1]);
      if (s1 == translate2) r.translate((Integer) s3[0], (Integer) s3[1]);
    }
    return r;
  }
Example #4
0
 public void drawScaledImage(BufferedImage im, int x, int y, float scale) {
   AffineTransform tx = new AffineTransform();
   tx.scale(scale, scale);
   BufferedImageOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
   drawImage(im, op, x, y);
 }