Package java.awt.image

Examples of java.awt.image.CropImageFilter


     * Returns final banner as cropped image.
     */
    public Image getBanner(int x, int y, int sx, int sy)
    {
        Image cropBanner = null;
        CropImageFilter cif = new CropImageFilter(x, y, sx, sy);
        cropBanner = createImage(new FilteredImageSource(theBanner.getSource(), cif));
        return cropBanner;
    }
View Full Code Here


        if (img.getWidth(observer) == widthImage && img.getHeight(observer) == heightImage) {
            imageArea = img;
        } else {
            // Extract the image with a CropImageFilter
            imageArea = new ToolkitImage(new FilteredImageSource(img.getSource(),
                new CropImageFilter(xImage, yImage, widthImage, heightImage)));
        }

        if (widthImage == widthDest && heightImage == heightDest) {
            if (bgcolor == null) {
                return drawImage(imageArea, xDest, yDest, observer);
View Full Code Here

            yDest = dy2;
        }

        // Extract the image with a CropImageFilter
        final Image imageArea = new ToolkitImage(new FilteredImageSource(image.getSource(),
            new CropImageFilter(xImage, yImage, widthImage, heightImage)));
        if (bgColor == null) {
            return drawImage(imageArea, xDest, yDest, widthDest, heightDest, observer);
        } else {
            return drawImage(imageArea, xDest, yDest, widthDest, heightDest, bgColor, observer);
        }
View Full Code Here

  @Override
  public BufferedImage getSicknessImage() {
    if (imageSickness == null) {
      Image image = getImageFromResourceTransparent("/sickness.png", Color.WHITE, new Rectangle(296, 265));
      Toolkit tk = Toolkit.getDefaultToolkit();
      image = tk.createImage(new FilteredImageSource(image.getSource(), new CropImageFilter(0, 0, 200, 285)));
      BufferedImageBuilder builder = new BufferedImageBuilder();
      imageSickness = builder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
    }
    return imageSickness;
  }
View Full Code Here

               
                int id = tileset.addImage(img);
               
                for(int x = 0; x < framesx; x++) {
                  for(int y = 0; y < framesy; y++) {
                    frames[framesx*y+x] = createImage(new FilteredImageSource(img.getSource(), new CropImageFilter(x*map.getTileWidth(), y*map.getTileHeight(), map.getTileWidth(), map.getTileHeight())));
                  }
                }
               
                //TODO add delay input through dialog
                newTile.setSprite(new Sprite(frames, 10)); //chopped up animation
View Full Code Here

                logger.error("Unable to read image data!");
                return Sequence.EMPTY_SEQUENCE;
            }
     
            //crop the image
            Image cropImage = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(image.getSource(), new CropImageFilter(x1, y1, x2, y2)));
            if(cropImage instanceof BufferedImage) {
                // just in case cropImage is allready an BufferedImage
                bImage = (BufferedImage)cropImage;
            } else {
                bImage = new BufferedImage(cropImage.getHeight(null),
View Full Code Here

          MapImage mapImage = map.render(renderParam);
          BufferedImage image = mapImage.getImage();

          for (int i = rowMin; i < rowMin + createSpread; i++) {
            for (int j = colMin; j < colMin + createSpread; j++) {
              ImageFilter cropFilter = new CropImageFilter(
                  (j - colMin) * width,
                  (i - rowMin) * height, width, height);
              Image destImage = Toolkit.getDefaultToolkit()
                  .createImage(
                      new FilteredImageSource(image
View Full Code Here

  }

  int width  = Math.min(dimComp.width, dimSrc.width);
  int height = Math.min(dimComp.height, dimSrc.height);

  CropImageFilter cif = new CropImageFilter(
      0, 0,
      width, height
  );

View Full Code Here

    @Override
    public BufferedImage getSicknessImage() {
        if (imageSickness == null) {
            Image image = getImageFromResourceTransparent("/sickness.png", Color.WHITE, new Rectangle(296, 265));
            Toolkit tk = Toolkit.getDefaultToolkit();
            image = tk.createImage(new FilteredImageSource(image.getSource(), new CropImageFilter(0, 0, 200, 285)));
            imageSickness = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
        }
        return imageSickness;
    }
View Full Code Here

                BufferedImage tag;
                Image image = bi.getScaledInstance(srcWidth, srcHeight,Image.SCALE_DEFAULT);
                // 四个参数分别为图像起点坐标和宽高
                // 即: CropImageFilter(int x,int y,int width,int height)
               
                cropFilter = new CropImageFilter(x, y, width, height);
                img = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(image.getSource(), cropFilter));
                int type = BufferedImage.TYPE_INT_ARGB;
                tag = new BufferedImage(width, height,type);
                Graphics2D g = (Graphics2D)tag.getGraphics();
                   
View Full Code Here

TOP

Related Classes of java.awt.image.CropImageFilter

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.