Java Image Clear clearImage(final BufferedImage image)

Here you can find the source of clearImage(final BufferedImage image)

Description

clear Image

License

Open Source License

Declaration

public static void clearImage(final BufferedImage image) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.AlphaComposite;

import java.awt.Composite;

import java.awt.Graphics2D;

import java.awt.image.BufferedImage;

public class Main {
    public static void clearImage(final BufferedImage image) {
        final Graphics2D g2d = image.createGraphics();
        final Composite composite = g2d.getComposite();
        g2d.setComposite(AlphaComposite.Clear);
        g2d.fillRect(0, 0, image.getWidth(), image.getHeight());
        g2d.setComposite(composite);/*  w w w  .  j  a v a  2  s .  c  om*/
        g2d.dispose();
    }
}

Related

  1. clear(Image img)
  2. clearImage(BufferedImage bi)
  3. clearImage(BufferedImage image)
  4. clearImage(BufferedImage img)
  5. clearImage(BufferedImage img)
  6. clearMergedImagesCache()