Java Draw Image draw(final Image img, final int type)

Here you can find the source of draw(final Image img, final int type)

Description

draw

License

GNU General Public License

Declaration

final static public BufferedImage draw(final Image img, final int type) 

Method Source Code

//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;
    }
}

Related

  1. draw(BufferedImage image, Consumer action)
  2. draw(BufferedImage image, Rectangle rectangle, BufferedImage backgroundImg)
  3. draw4on1(BufferedImage[] src, BufferedImage dst)
  4. draw9Patch(BufferedImage image, Integer[] patches, float ratio)
  5. drawBorder(BufferedImage buffImage)
  6. drawBorder(BufferedImage originalImage, Color borderColor, int borderWidth)