Here you can find the source of getBufferedImage(Image image)
Parameter | Description |
---|---|
image | the image to create a buffered image for |
public static BufferedImage getBufferedImage(Image image)
//package com.java2s; /**/* w ww . ja va 2 s . c om*/ * Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://robocode.sourceforge.net/license/epl-v10.html */ import java.awt.*; import java.awt.image.BufferedImage; public class Main { /** * Creates and returns a buffered version of the specified image. * * @param image the image to create a buffered image for * @return a buffered image based on the specified image */ public static BufferedImage getBufferedImage(Image image) { BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics g = bufferedImage.getGraphics(); g.drawImage(image, 0, 0, null); return bufferedImage; } }