Package java.awt.image

Examples of java.awt.image.AffineTransformOp


   
    ArrayList<BufferedImage> flippedImgArray = new ArrayList<BufferedImage>(imgArray.size());
    for (int i=0; i < imgArray.size(); i++) {
      AffineTransform tx = AffineTransform.getScaleInstance(-1d, 1d);
      tx.translate(-imgArray.get(i).getWidth(), 0);
      AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
      flippedImgArray.add(op.filter(imgArray.get(i), null));
    }
    return flippedImgArray;
  }
View Full Code Here


              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;
        } else {
            return image;
        }
    }
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;
        // If the output buffer is not premultiplied in certain cases
        // it fails to properly divide out the Alpha (it always does
        // the affine on premultiplied data). We help it out by
        // premultiplying for it.
        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

        // 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;
        // If the output buffer is not premultiplied in certain cases
        // it fails to properly divide out the Alpha (it always does
        // the affine on premultiplied data). We help it out by
        // premultiplying for it.
        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.flex.forks.batik.ImageDisplay.showImage("Src: " , srcBI);
        //     org.apache.flex.forks.batik.ImageDisplay.showImage("Dst: " , myBI);
        // }
View Full Code Here

                                -at.getTranslateX(),
                                -at.getTranslateY()
                        );
                untranslated.concatenate(at);

                AffineTransformOp atop =
                        new AffineTransformOp(untranslated, xDstSurf.g2d.getRenderingHints());

                Rectangle r = atop.getBounds2D(compRaster).getBounds();
                int tWidth = r.width;
                int tHeight = r.height;

                BufferedImage transformed;
                if (compIm.getColorModel().getTransparency() == Transparency.OPAQUE) {
                    transformed = xDstSurf.g2d.xConfig.createCompatibleImage(tWidth, tHeight);
                } else {
                    ColorModel cm = compIm.getColorModel();
                    transformed =
                            new BufferedImage(
                                    cm,
                                    compIm.getRaster().createCompatibleWritableRaster(
                                            tWidth,
                                            tHeight
                                    ),
                                    cm.isAlphaPremultiplied(),
                                    null
                            );
                }

                atop.filter(compIm, transformed);

                if (dstX < 0){
                    tWidth += dstX;
                    dstX = 0;
                }
View Full Code Here

    public WritableRaster apply( WritableRaster image ) {
        if( ! enabled ) {
            return image;
        }
        AffineTransform translate = AffineTransform.getTranslateInstance( left, up );
        AffineTransformOp op = new AffineTransformOp( translate, AffineTransformOp.TYPE_BILINEAR );
        WritableRaster scaledRaster = op.filter( image, null );
        return scaledRaster;
    }
View Full Code Here

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

        } else {
            xScale = 1;
            yScale = -1;
        }
        AffineTransform transform = new AffineTransform( xScale, 0.0d, 0.0d, yScale, 0.0d, 0.0d );
        AffineTransformOp op = new AffineTransformOp( transform, AffineTransformOp.TYPE_BILINEAR );
        WritableRaster scaledRaster = op.filter( image, null );
        return scaledRaster;
    }
View Full Code Here

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

        int y = height / 2;

        WritableRaster newRaster1 = image.createCompatibleWritableRaster(-x, -y, width, height );

        AffineTransform translate = AffineTransform.getTranslateInstance( -x, -y );
        AffineTransformOp op = new AffineTransformOp( translate, AffineTransformOp.TYPE_BILINEAR );
        op.filter( image, newRaster1 );

        AffineTransform rotate = AffineTransform.getRotateInstance( angle );
        op = new AffineTransformOp( rotate, AffineTransformOp.TYPE_BILINEAR );

        WritableRaster newRaster2 = image.createCompatibleWritableRaster(-x, -y, width, height );
        op.filter( newRaster1, newRaster2 );

        return newRaster2;
    }
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.