Package java.awt.image

Examples of java.awt.image.FilteredImageSource


            }
        }

        public void applyFilter(RGBImageFilter filter) {
            ImageProducer prod =
                new FilteredImageSource(image.getSource(), filter);
            this.image = Toolkit.getDefaultToolkit().createImage(prod);
        }
View Full Code Here


                    return rgb;
                }
            }
        };

        ImageProducer ip = new FilteredImageSource(im.getSource(), filter);
        return this.imageToBufferedImage(Toolkit.getDefaultToolkit().createImage(ip));
    }
View Full Code Here

            }
        };
        final ReplicateScaleFilter rsc = new ReplicateScaleFilter(width * scale, height * scale);
        Image tmpImg;
        tmpImg = Toolkit.getDefaultToolkit().createImage(
                new FilteredImageSource(new FilteredImageSource(bi.getSource(), filter), rsc));
        imageOut.getGraphics().drawImage(tmpImg, 0, 0, null);

        return imageOut;
    }
View Full Code Here

                && icon.getIconHeight() > 0) {
            BufferedImage img = new BufferedImage(icon.getIconWidth(),
                    icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
            icon.paintIcon(component, img.getGraphics(), 0, 0);
            ImageFilter filter = new RGBGrayFilter();
            ImageProducer producer = new FilteredImageSource(img.getSource(), filter);
            Image resultImage = component.createImage(producer);
            return new ImageIconUIResource(resultImage);
        }
        return super.getDisabledIcon(component, icon);
    }
View Full Code Here

            filter = new AreaAveragingScaleFilter(width, height);
        } else {
            filter = new ReplicateScaleFilter(width, height);
        }
        ImageProducer prod;
        prod = new FilteredImageSource(getSource(), filter);
        return Toolkit.getDefaultToolkit().createImage(prod);
    }
View Full Code Here

                && icon.getIconHeight() > 0) {
            BufferedImage img = new BufferedImage(icon.getIconWidth(),
                    icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
            icon.paintIcon(component, img.getGraphics(), 0, 0);
            ImageFilter filter = new RGBGrayFilter();
            ImageProducer producer = new FilteredImageSource(img.getSource(), filter);
            Image resultImage = component.createImage(producer);
            return new ImageIconUIResource(resultImage);
        }
        return super.getDisabledIcon(component, icon);
    }
View Full Code Here

    /**
     * Get a rectangular region of the baseImage modified by an image filter.
     */
    Image getHighlight(int x, int y, int w, int h, ImageFilter filter) {
  ImageFilter cropfilter = new CropImageFilter(x, y, w, h);
  ImageProducer prod = new FilteredImageSource(baseImage.getSource(),
                 cropfilter);
  return makeImage(prod, filter, 0);
    }
View Full Code Here

    /**
     * Make a filtered image based on another ImageProducer.
     * Add it to the media tracker using the indicated ID.
     */
    Image makeImage(ImageProducer prod, ImageFilter filter, int ID) {
  Image filtered = createImage(new FilteredImageSource(prod, filter));
  tracker.addImage(filtered, ID);
  return filtered;
    }
View Full Code Here

    y += 3;
    x += 3;

    if(mIsGrayFilter && !mIsExpired && mProgram.isExpired()) {
      ImageFilter filter = new GrayFilter(true, 60);
      mScaledIcon.setImage(c.createImage(new FilteredImageSource(mScaledIcon.getImage().getSource(),filter)));
      mIsExpired = true;
    }

    if(c.getForeground().getAlpha() != 255) {
      ImageFilter filter = new RGBImageFilter() {
        public int filterRGB(int x, int y, int rgb) {
          if ((rgb & 0xff000000) != 0) {
            return (rgb & 0xffffff) | (c.getForeground().getAlpha() << 24);
          }
          return rgb;
        }
      };

      mScaledIcon.setImage(c.createImage(new FilteredImageSource(mScaledIcon.getImage().getSource(),filter)));
    }

    mScaledIcon.paintIcon(c,g,x,y);

    /*
 
View Full Code Here

            //write image into file
            try {

                if (imageType.equalsIgnoreCase("gif")) {
                    FileOutputStream out = new FileOutputStream(imageFile);
                    FilteredImageSource fis =
                            new FilteredImageSource(image.getSource(),
                                    new TransFilter(TRANSPARENT_BG_COLOR));
                    GifEncoder ge = new GifEncoder(fis, out);
                    ge.encode();
                    out.flush();
                    out.close();
View Full Code Here

TOP

Related Classes of java.awt.image.FilteredImageSource

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.