Package java.awt.image

Examples of java.awt.image.FilteredImageSource


     * @return the image with the filter applied
     */
    public BufferedImage applyFilter(BufferedImage image, ImageFilter filter) {

        // apply filter using default AWT toolkit
        Image img = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(image.getSource(), filter));

        // use a pixel grabber to retrieve the image's color model;
        // grabbing a single pixel is usually sufficient
        PixelGrabber pg = new PixelGrabber(img, 0, 0, 1, 1, false);
        try {
View Full Code Here


    ImageProducer producer = icon.getSource();

    // If direction is RTL, flip the source image
    if (_isRightToLeft(context))
      producer = new FilteredImageSource(producer, new MirrorImageFilter());

    Image flippedIcon =
      toolkit.createImage(producer);

    // Be sure that the image is fully loaded
View Full Code Here

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    ImageProducer producer = icon.getSource();

    // If direction is RTL, flip the source image
    if (_isRightToLeft(context))
      producer = new FilteredImageSource(producer, new MirrorImageFilter());

    Image colorizedIcon =
      toolkit.createImage(new FilteredImageSource(producer, filter));

    // Be sure that the image is fully loaded
    ImageUtils.loadImage(colorizedIcon);

    // Get the width/height.  We use an ImageLoader object the ImageObserver
View Full Code Here

    Image       baseImage,
    ImageFilter imageFilter
    )
  {
    // get the filtered image producer
    ImageProducer producer = new FilteredImageSource(baseImage.getSource(),
                                                     imageFilter);

    // return the filtered image
    return Toolkit.getDefaultToolkit().createImage(producer);
  }
View Full Code Here

   * Implementation of ImageEncoder.encodeImage()
   */
  public void encodeImage(Image image, OutputStream out)
    throws IOException
  {
    Image alphaFilteredImage = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(image.getSource(),
                                                                                               new AlphaMultiplyFilter(_WHITE)));
    Image filteredImage = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(alphaFilteredImage.getSource(),
                                                                                          new OctreeFilter(alphaFilteredImage)));
    _wrappedEncoder.encodeImage(filteredImage, out);
   
  }
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

     * @return the image with the filter applied
     */
    public BufferedImage applyFilter(BufferedImage image, ImageFilter filter) {

        // apply filter using default AWT toolkit
        Image img = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(image.getSource(), filter));

        // use a pixel grabber to retrieve the image's color model;
        // grabbing a single pixel is usually sufficient
        PixelGrabber pg = new PixelGrabber(img, 0, 0, 1, 1, false);
        try {
View Full Code Here

     *
     * @return a brighter image
     */
    public static Image createBrighterImage(Image i) {
        ColorFilter filter = ColorFilter.getInstance(true, _percent);
        ImageProducer prod = new FilteredImageSource(i.getSource(), filter);
        return Toolkit.getDefaultToolkit().createImage(prod);
    }
View Full Code Here

     *
     * @return a darker image.
     */
    public static Image createDarkerImage(Image i) {
        ColorFilter filter = ColorFilter.getInstance(false, _percent);
        ImageProducer prod = new FilteredImageSource(i.getSource(), filter);
        return Toolkit.getDefaultToolkit().createImage(prod);
    }
View Full Code Here

    /**
     * Creates an image from an existing one by replacing the old color with the new color.
     */
    public static Image createImage(Image i, Color oldColor, Color newColor) {
        MaskFilter filter = MaskFilter.getInstance(oldColor, newColor);
        ImageProducer prod = new FilteredImageSource(i.getSource(), filter);
        Image image = Toolkit.getDefaultToolkit().createImage(prod);
        return image;
    }
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.