Here you can find the source of layer(BufferedImage source, BufferedImage destination, int x, int y)
public static final BufferedImage layer(BufferedImage source, BufferedImage destination, int x, int y)
//package com.java2s; //License from project: Open Source License import java.awt.AlphaComposite; import java.awt.Graphics2D; import java.awt.image.BufferedImage; public class Main { public static final BufferedImage layer(BufferedImage source, BufferedImage destination, int x, int y) { Graphics2D graphics = destination.createGraphics(); graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); graphics.drawImage(source, null, null); graphics.dispose();/*from www. ja va2 s. c o m*/ return destination; } }