Package java.awt.image

Examples of java.awt.image.AffineTransformOp


    public WritableRaster apply( WritableRaster image ) {
        if( ! enabled ) {
            return image;
        }
        AffineTransform shear = AffineTransform.getShearInstance( shearX, shearY );
        AffineTransformOp op = new AffineTransformOp( shear, AffineTransformOp.TYPE_BILINEAR );
        WritableRaster scaledRaster = op.filter( image, null );
        return scaledRaster;
    }
View Full Code Here


                xScale = yScale;
            else
                yScale = xScale;
        }
        AffineTransform scale = AffineTransform.getScaleInstance( xScale, yScale );
        AffineTransformOp op = new AffineTransformOp( scale, AffineTransformOp.TYPE_BILINEAR );
        WritableRaster scaledRaster = op.filter( image, null );
        return scaledRaster;
    }
View Full Code Here

            }
        }

        // create the image scaling transformation
        AffineTransform at = AffineTransform.getScaleInstance(widthScale, heightScale);
        AffineTransformOp ato = new AffineTransformOp(at, renderHints);

        // must create the result image manually, otherwise the size of the result image may be 1 pixel off
        BufferedImage result = createImage(image.getColorModel(), targetWidth, targetHeight);
        result = ato.filter(image, result);

        threadSetNormal();
        return result;
    }
View Full Code Here

    (
      x_resize_coef, 0.0, 0.0,
      y_resize_coef, 0.0, 0.0
    );
   
    AffineTransformOp op = new AffineTransformOp
    (
      resizer,
      //AffineTransformOp.TYPE_BICUBIC
      AffineTransformOp.TYPE_NEAREST_NEIGHBOR
    );
View Full Code Here

                                //
                                BufferedImage img = ImageIO.read(in);
                                log.debug("Read image " + uri + " (" + img.getWidth() + "," + img.getHeight() + ")");
                                AffineTransform tx = AffineTransform.getScaleInstance(-1, 1);
                                tx.translate(-img.getWidth(null), 0);
                                AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
                                img = op.filter(img, null);
                                log.debug("Mirrored image " + uri + " (" + img.getWidth() + "," + img.getHeight() + ")");
                                ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
                                ImageIO.write(img, imageType.getFormat(), baos);
                                baos.close();
                                return new Image(imageType, baos.toByteArray());
View Full Code Here

        Graphics gs = rotatedImage.getGraphics();
        gs.fillRect(0, 0, w, h);// 以给定颜色绘制旋转后图片的背景
        AffineTransform at = new AffineTransform();
        at.rotate(ang, w / 2, h / 2);// 旋转图象
        at.translate(x, y);
        AffineTransformOp op = new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
        op.filter(image, rotatedImage);
        image = rotatedImage;
        return image;
    }
View Full Code Here

      float yScale = 1;
      AffineTransform at = new AffineTransform();
      at.scale(xScale, yScale);
     
      // instantiate and apply affine transformation filter
      BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
      return bio.filter(img, null);
   }
View Full Code Here

      float yScale = (float) destHeight / img.getHeight();
      AffineTransform at = new AffineTransform();
      at.scale(xScale, yScale);
     
      // instantiate and apply affine transformation filter
      BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
      return bio.filter(img, null);
   }
View Full Code Here

//System.out.println("Rotate by "+angle+": "+angle * Math.PI / 180.0);      
      at.rotate(angle * Math.PI / 180.0, srcImg.getWidth() / 2.0, srcImg.getHeight() / 2.0);

      // instantiate and apply affine transformation filter
      BufferedImageOp bio;
      bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);

     
      BufferedImage dest = cropImage(bio.filter(srcImg, null), (int)Math.rint(srcImg.getWidth()*scale)/cropwidth, (int)Math.rint(srcImg.getHeight()*scale)/cropHight);
     
//      File f = new File("SteeringWheel"+angle+".png");
View Full Code Here

      float yScale = (float) destHight / img.getHeight();
      AffineTransform at = new AffineTransform();
      at.scale(xScale, yScale);
     
      // instantiate and apply affine transformation filter
      BufferedImageOp bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
      return bio.filter(img, null);
  }
View Full Code Here

TOP

Related Classes of java.awt.image.AffineTransformOp

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.