Package java.awt.image

Examples of java.awt.image.AffineTransformOp


                AffineTransform xform = new AffineTransform();
                // Specify scaling
                xform.setToScale(widthAdj, heightAdj);

                // Create the transform op.
                AffineTransformOp xformOp = new AffineTransformOp(xform, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
                // Scale clip area -> newImage
                // extract sub-image
                BufferedImage newImage = xformOp.filter(sourceImage.getSubimage(clipRect.x,
                        clipRect.y,
                        clipRect.width,
                        clipRect.height),
                        null);
View Full Code Here


        AffineTransform at = new AffineTransform();
       
        at.rotate(Math.toRadians(degrees), src.getWidth() / 2.0, src.getHeight() / 2.0);
        AffineTransform translationTransform = findTranslation (at, src);
        at.preConcatenate(translationTransform);
        BufferedImage destinationBI = new AffineTransformOp(at, AffineTransformOp.TYPE_BICUBIC).filter(src, null);

        picture = new DcImageIcon(Utilities.getBytes(new DcImageIcon(destinationBI)));
        initialize();
        changed = true;
        repaint();
View Full Code Here

      if (properties.getMaxRotationAngle() != 0) {
          af.rotate(r.nextDouble() / 360);
      }

      AffineTransformOp op = new AffineTransformOp(af, AffineTransformOp.TYPE_BILINEAR);
      BufferedImage dest = new BufferedImage((int) (i.getWidth() / af.getScaleX()), (int) (i.getHeight() / af.getScaleY()), BufferedImage.TYPE_3BYTE_BGR);
      op.filter(i, dest);
      augmentedImages.add(index, dest);
        } else {
      augmentedImages.add(index, i);
        }
    });
View Full Code Here

                    double sx = (double)getWidth() / (double)artwork.getWidth();
                    double sy = (double)getHeight() / (double)artwork.getHeight();
                    sx = Math.min(sx, sy);
                    sy = Math.min(sx, sy);
                    AffineTransform tx = AffineTransform.getScaleInstance(sx, sy);
                    g2.drawImage(artwork, new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR), 0, 0);
                }

                @Override
                public Dimension getPreferredSize() {
                    return new Dimension(artwork.getWidth(), artwork.getHeight());
View Full Code Here

        }
        g2d.fill(path);

        AffineTransform transform = AffineTransform.getScaleInstance(dimension.getHeight() / BUFFER_IMAGE_SIZE,
            dimension.getHeight() / BUFFER_IMAGE_SIZE);
        AffineTransformOp transformOp = new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR);

        graphics2d.drawImage(bufferedImage, transformOp, 0, 0);
        g2d.dispose();
    }
View Full Code Here

        int w = image.getWidth();
        int h = image.getHeight();
        BufferedImage th = new BufferedImage((int)(w*power), (int)(h*power), image.getType());
        double powerW = ((double) thumbWidth) / w;
        double powerH = ((double) thumbHeight) / h;
        AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(powerW, powerH),
                AffineTransformOp.TYPE_BILINEAR);
        op.filter(image, th);

        // Added for distributed file system support
        // Store image based on local of distributed files systems
        FileSystem fs = ServiceLocator.getInstance().getFileSystem();
        OutputStream oStream = fs.create(to);
View Full Code Here

                JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(inputStream);
                Raster original = decoder.decodeAsRaster();
                JPEGDecodeParam decodeParam = decoder.getJPEGDecodeParam();
                double ow = (double) decodeParam.getWidth();
                double oh = (double) decodeParam.getHeight();
                AffineTransformOp filter = new AffineTransformOp(getTransform(ow, oh, width, height), AffineTransformOp.TYPE_BILINEAR);
                WritableRaster scaled = filter.createCompatibleDestRaster(original);
                filter.filter(original, scaled);

                // JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);

                ByteArrayOutputStream bstream = new ByteArrayOutputStream();
                JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bstream);
View Full Code Here

   
    AffineTransform at =
      AffineTransform.getScaleInstance(scaleX,scaleY);

      //       AffineTransform.getScaleInstance((fullSize.getX()-src.getWidth())/2,(fullSize.getY()-src.getHeight())/2);
    AffineTransformOp op = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
    BufferedImage dest = op.filter(src, null);
    return dest;
  }
View Full Code Here

      XYData topLeft = new XYData(quadrant.getX()*size.getX(), quadrant.getY()*size.getY());
      if(newSize.getX() > image.getWidth(null) || newSize.getY() > image.getHeight(null)) {
        throw new Exception("Requested zoom level ("+level+") is too high.");
      }
      AffineTransform tx = new AffineTransform();
      AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
      tx.scale(scale, scale);
      image = op.filter(image, null);
      BufferedImage zoomed = image.getSubimage(topLeft.getX(), topLeft.getY(), newSize.getX(), newSize.getY());
      if(level>maxLevel) {
        maxLevel = level;
      }
      return zoomed;
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

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.