Package java.awt.image

Examples of java.awt.image.AffineTransformOp


//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

      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

        // Translate what will be at minX,minY to zero, zero
        // which where java2d will think the real minX,minY is.
        aff.preConcatenate(AffineTransform.getTranslateInstance
                           (-destPt.getX(), -destPt.getY()));

        AffineTransformOp op = new AffineTransformOp(aff, hints);

        BufferedImage srcBI, myBI;
        ColorModel srcCM = src.getColorModel();
        ColorModel myCM = getColorModel();

        WritableRaster srcWR = (WritableRaster)srcRas;
        srcCM = GraphicsUtil.coerceData(srcWR, srcCM, true);
        srcBI = new BufferedImage(srcCM,
                                  srcWR.createWritableTranslatedChild(0,0),
                                  srcCM.isAlphaPremultiplied(), null);

        myBI = new BufferedImage(myCM,wr.createWritableTranslatedChild(0,0),
                                 myCM.isAlphaPremultiplied(), null);

        op.filter(srcBI, myBI);

        // if ((count % 40) == 0) {
        //     org.apache.batik.ImageDisplay.showImage("Src: " , srcBI);
        //     org.apache.batik.ImageDisplay.showImage("Dst: " , myBI);
        // }
View Full Code Here

                        if (height > 0) {
                            height = Math.round((int)(oh * height) / 100);
                        }
                    }

                    AffineTransformOp filter = new AffineTransformOp(getTransform(ow, oh, width, height), AffineTransformOp.TYPE_BILINEAR);
                    WritableRaster scaledRaster = filter.createCompatibleDestRaster(currentImage.getRaster());

                    filter.filter(currentImage.getRaster(), scaledRaster);

                    currentImage = new BufferedImage(original.getColorModel(), scaledRaster, true, null);
                }

                if (null != grayscaleFilter) {
View Full Code Here

     
        
    if (h==0)
            scale = ((double)w / (double)image.getWidth());
        else scale = ((double)h / (double)image.getHeight());
        AffineTransformOp op = new
               AffineTransformOp(AffineTransform.getScaleInstance(scale, scale),
               AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
        image = op.filter(image,null);
        try {
     
            ImageIO.write(image, getExtension(infilePath), new File(outfilePath));
        }   catch (Exception ex) {}
    }
View Full Code Here

            BufferedImage scaledImg = new BufferedImage(npotWidth, npotHeight, imageType);

            AffineTransform at = AffineTransform.getScaleInstance(xScale,
                    yScale);

            powerOfTwoATOp = new AffineTransformOp(at,
                    AffineTransformOp.TYPE_BILINEAR);

            powerOfTwoATOp.filter(bi, scaledImg);

            // System.err.println("bi " + bi.getColorModel());
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

//            img = (BufferedImage) getGraphicsConfiguration().createCompatibleImage(width, height);
//        }
       
        AffineTransform tx = AffineTransform.getScaleInstance(1, -1);
        tx.translate(0, -img.getHeight());
        transformOp = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
       
        for (ViewPort vp : viewPorts){
            if (!attachAsMain){
                vp.setOutputFrameBuffer(fb);
            }
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.