Java examples for 2D Graphics:BufferedImage
internal use - get buffer from image BufferedImage
//package com.java2s; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; public class Main { /**/*w w w .jav a 2 s .c o m*/ * internal use - get buffer from image * @param scaledImage * @param deviceXSize * @param deviceYSize * @return */ private static int[] getPixelsFromImage(BufferedImage scaledImage, int deviceXSize, int deviceYSize) { //painfull slow! //return scaledImage.getRGB(0, 0, deviceXSize, deviceYSize, null, 0, deviceXSize); DataBufferInt buf = (DataBufferInt) scaledImage.getRaster() .getDataBuffer(); return buf.getData(); } }