FileDocCategorySizeDatePackage
MIDPImageAccessor.javaAPI DocphoneME MR2 API (J2ME)3774Wed May 02 16:47:10 BST 2007com.sun.mmedia

MIDPImageAccessor

public class MIDPImageAccessor extends Object implements ImageAccess
The image access class for MIDP.
created
December 16, 2005

Fields Summary
Constructors Summary
Methods Summary
public intalphaLevelsNumber()

        /** 
         * TBD: get display for current MIDlet
         * javax.microedition.lcdui.Display d = ...; 
         * return d.numAlphaLevels();
         */
        return 2;
    
public intgetImageHeight(java.lang.Object image)

        if (!(image instanceof Image))
            return -1;
        
        Image img = (Image)image;
        return img.getHeight();
    
public intgetImageWidth(java.lang.Object image)

        if (!(image instanceof Image))
            return -1;
        
        Image img = (Image)image;
        return img.getWidth();
    
public byte[]getRGBByteImageData(java.lang.Object image)

        return FormatConversionUtils.
                intArrayToByteArray(getRGBIntImageData(image));
    
public int[]getRGBIntImageData(java.lang.Object image)

        if (!(image instanceof Image))
            return null;
        
        Image img = (Image)image;
        
        int w = img.getWidth();
        int h = img.getHeight();
        int[] data = new int[w * h]; 
        
        img.getRGB(data, 0, w, 0, 0, w, h);
        return data;
    
public java.lang.ObjectimageCreateFromByteArray(byte[] data, int offset, int length)

	return Image.createImage(data, offset, length);
    
public java.lang.ObjectimageCreateFromImage(java.lang.Object image)

        if (!(image instanceof Image))
            return null;
        
        Image img = (Image)image;
        
        return Image.createImage(img);
    
public java.lang.ObjectimageCreateFromStream(java.io.InputStream stream)

        if (stream == null)
            return null;
        
	Image image = null;
        try {
            image = Image.createImage(stream);
        } catch (java.io.IOException ioe) {
            return null;
        }
        return image;
    
public booleanisImage(java.lang.Object image)

        return (image instanceof Image);
    
public booleanisMutableImage(java.lang.Object image)

        Image img = (Image)image;
        return img.isMutable();