Here you can find the source of draw(final Image img, final int type)
final static public BufferedImage draw(final Image img, final int type)
//package com.java2s; /**/*from ww w . java 2s. c om*/ * License: GPL * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License 2 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import java.awt.Image; import java.awt.image.BufferedImage; public class Main { final static public BufferedImage draw(final Image img, final int type) { final BufferedImage imgCopy = new BufferedImage(img.getWidth(null), img.getHeight(null), type); imgCopy.createGraphics().drawImage(img, 0, 0, null); return imgCopy; } }