Memory Image Source

In addition to supporting grabbing pixels from an existing image, the AWT image package provides a mechanism for converting an array of pixels into an image. java.awt.image.MemoryImageSource implements the ImageProducer interface and can produce the bits of an image from an array of pixels.

Like PixelGrabber, the MemoryImageSource class is provided as a convenience that allows construction of an image without the need for having to implement custom image filters.

MemoryImageSource provides no less than six constructors that take the following arguments:

 (int w, int w, ColorModel cm, byte[] pixels, int offset, int scansize) (int w, int w, ColorModel cm, byte[] pixels, int offset, int scansize, Hashtable properties) (int w, ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.