overlay Image - Java 2D Graphics

Java examples for 2D Graphics:BufferedImage Resize

Description

overlay Image

Demo Code


//package com.java2s;

import java.awt.Graphics2D;

import java.awt.image.BufferedImage;

public class Main {
    public static BufferedImage overlayImage(BufferedImage under,
            BufferedImage over) {
        BufferedImage dest = under;
        Graphics2D g2 = dest.createGraphics();
        g2.drawImage(over.getScaledInstance(under.getWidth(),
                under.getHeight(), 4), 0, 0, null);
        g2.dispose();/*from   ww w  . j  ava 2 s  .c o  m*/
        return dest;
    }
}

Related Tutorials