fill BufferedImage - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage

Description

fill BufferedImage

Demo Code


//package com.java2s;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

public class Main {
    public static void fillImage(BufferedImage bufferedImage, Color color) {
        Graphics2D g = bufferedImage.createGraphics();
        g.setColor(color);//from ww w. j  av  a  2 s  .  com
        g.fillRect(0, 0, bufferedImage.getWidth(),
                bufferedImage.getHeight());
        g.dispose();
    }
}

Related Tutorials