FileDocCategorySizeDatePackage
GenerateImage.javaAPI DocJMF 2.1.1e1406Mon May 12 12:20:50 BST 2003com.sun.media.ui

GenerateImage

public class GenerateImage extends Object

Fields Summary
private IndexColorModel
icm
private DirectColorModel
dcm
private Image
image
private byte[]
data
private int
width
private int
height
byte[]
reds
byte[]
greens
byte[]
blues
Constructors Summary
public GenerateImage()


           
        
    
      
	int ncolors = getColors(reds, 0);
	getColors(greens, 1);
	getColors(blues, 2);
	icm = new IndexColorModel(8, 256, reds, greens, blues, 0);
    
Methods Summary
protected synchronized voidcreateBuffer(int w, int h)

	width = w;
	height = h;
	data = new byte[w * h];
    
protected synchronized voidcreateImage()

	MemoryImageSource mis = new MemoryImageSource(width, height,
						      icm, data, 0, width);
	Toolkit tk = Toolkit.getDefaultToolkit();
	image = tk.createImage(mis);
	tk.prepareImage(image, width, height, null);
	
    
private native booleangenerateImage(java.lang.String imageName)

private native intgetColors(byte[] colors, int component)

public java.awt.ImagegetImage(java.lang.String imageName)

	image = null;
	data = null;
	if (generateImage(imageName)) {
	    createImage();
	    return image;
	} else
	    return  null;