Packages This Package Prev Next Index
public class java.awt.image.MemoryImageSource extends java.lang.Object (I-§1.12) implements java.awt.image.ImageProducer (II-§2.12) { // Constructors public MemoryImageSource(int w, int h, ColorModel cm, §2.7.1 byte pix[], int off, int scan); public MemoryImageSource(int w, int h, ColorModel cm, §2.7.2 byte pix[], int off, int scan, ; Hashtable props); public MemoryImageSource(int w, int h, ColorModel cm, §2.7.3 int pix[], int off, int scan); public MemoryImageSource(int w, int h, ColorModel cm, §2.7.4 int pix[], int off, int scan, Hashtable props); public MemoryImageSource(int w, int h, int pix[], §2.7.5 int off, int scan); public MemoryImageSource(int w, int h, int pix[], §2.7.6 int off, int scan, Hashtable props); // Methods public void addConsumer(ImageConsumer ic); §2.7.7 public boolean isConsumer(ImageConsumer ic); §2.7.8 public void removeConsumer(ImageConsumer ic); §2.7.9 public void §2.7.10 requestTopDownLeftRightResend(ImageConsumer ic); public void startProduction(ImageConsumer ic); §2.7.11 }A memory image source is an implementation of the image producer interface (II-§2.12). It uses an array to produce pixel values for the image.
An application can use the method createImage in class Component (II-§1.10.6) to create an Image from a MemoryImageSource.
int w = 100; int h = 100; int pix[] = new int[w * h]; int index = 0; for (int y = 0; y < h; y++) { int red = (y * 255) / (h - 1); for (int x = 0; x < w; x++) { int blue = (x * 255) / (w - 1); pix[index++] = (255 << 24) | (red << 16) | blue; } } Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));
public
MemoryImageSource(int w, int h, ColorModel cm,
byte pix[], int off, int scan)
w
-
the width of the image
h
-
the height of the image
cm
-
the color model used the pixels
pix
-
the array of pixel values
off
-
the offset of the first pixel in the array
scan
-
the number of pixels in the array per line
public MemoryImageSource(int w, int h, ColorModel cm,
byte pix[], int off, int scan,
Hashtable props)
w
-
the width of the image
h
-
the height of the image
cm
-
the color model used the pixels
pix
-
the array of pixel values
off
-
the offset of the first pixel in the array
scan
-
the number of pixels in the array per line
props
-
a hash table of properties
public MemoryImageSource(int w, int h, ColorModel cm,
int pix[], int off, int scan)
w
-
the width of the image
h
-
the height of the image
cm
-
the color model used the pixels
pix
-
the array of pixel values
off
-
the offset of the first pixel in the array
scan
-
the number of pixels in the array per line
public MemoryImageSource(int w, int h, ColorModel cm,
int pix[], int off, int scan,
Hashtable props)
w
-
the width of the image
h
-
the height of the image
cm
-
the color model used the pixels
pix
-
the array of pixel values
off
-
the offset of the first pixel in the array
scan
-
the number of pixels in the array per line
props
-
a hash table of properties
public MemoryImageSource(int w, int h, int pix[],
int off, int scan)
w
-
the width of the image
h
-
the height of the image
pix
-
the array of pixel values
off
-
the offset of the first pixel in the array
scan
-
the number of pixels in the array per line
public MemoryImageSource(int w, int h, int pix[], int off,
int scan, Hashtable props)
w
-
the width of the image
h
-
the height of the image
cm
-
the color model used the pixels
pix
-
the array of pixel values
off
-
the offset of the first pixel in the array
scan
-
the number of pixels in the array per line
props
-
a hash table of properties
public void addConsumer(ImageConsumer ic)
ic
-
an image consumer
public boolean isConsumer(ImageConsumer ic)
ic
-
an image consumer
public void removeConsumer(ImageConsumer ic)
ic
-
an image consumer
public void requestTopDownLeftRightResend(ImageConsumer ic)
ic
-
an image consumer
public void startProduction(ImageConsumer ic)
ic
-
an image consumer
Packages This Package Prev Next IndexJava API Document (HTML generated by dkramer on April 22, 1996)