com.siemens.mp.ui
Class Image

java.lang.Object
  extended bycom.siemens.mp.misc.NativeMem
      extended bycom.siemens.mp.ui.Image
Direct Known Subclasses:
Image

public class Image
extends com.siemens.mp.misc.NativeMem


Field Summary
static int COLOR_BMP_8BIT
           
 
Constructor Summary
protected Image()
          blank constructor
  Image(byte[] imageData)
          Creates a new image from PNG/JPG/GIF/BMP byte stream
  Image(byte[] bytes, int imageWidth, int imageHeight)
          Create a new b/w image from a b/w Siemens bitmap
  Image(byte[] bytes, int imageWidth, int imageHeight, boolean transparent)
           Creates a new b/w image with bpp = 2.
  Image(byte[] bytes, int imageWidth, int imageHeight, int BitmapType)
          Creates a new image from uncompressed color data.
  Image(Image image)
          Create a new copy image
  Image(int imageWidth, int imageHeight)
          Create a new blank image
  Image(String name, boolean doScale)
          Creates a new image from PNG/JPG/GIF/BMP resource
 
Method Summary
static Image createImageFromBitmap(byte[] imageData, int imageWidth, int imageHeight)
          Create a new immutable image from a b/w Siemens bitmap stored in imageData This method is Siemens specific.
static Image createImageWithoutScaling(String name)
          Creates an immutable image from decoded image data obtained from the named resource.
static Image createImageWithScaling(String name)
          Creates an immutable image from decoded image data obtained from the named resource.
static Image createRGBImage(byte[] imageData, int imageWidth, int imageHeight, int BitmapType)
          Creates a new image from uncompressed color data.
static Image createTransparentImageFromBitmap(byte[] bytes, int width, int height)
           Creates a new immutable b/w image with bpp=2.
 int getHeight()
          Get the height of the image
static Image getNativeImage(Image img)
           
 int getWidth()
          Get the width of the image
static void mirrorImageHorizontally(Image image)
          Mirrors an Image at its horizontal axis.
static void mirrorImageVertically(Image image)
          Mirrors an Image at its vertical axis.
protected static void setNativeImage(Image img, Image simg)
          Registers the siemens image inside the lcdui image
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLOR_BMP_8BIT

public static final int COLOR_BMP_8BIT
See Also:
Constant Field Values
Constructor Detail

Image

protected Image()
blank constructor


Image

public Image(int imageWidth,
             int imageHeight)
Create a new blank image


Image

public Image(Image image)
Create a new copy image


Image

public Image(byte[] bytes,
             int imageWidth,
             int imageHeight)
Create a new b/w image from a b/w Siemens bitmap


Image

public Image(byte[] bytes,
             int imageWidth,
             int imageHeight,
             boolean transparent)

Creates a new b/w image with bpp = 2. Every pixel within the newly created image could be

00 - transparent
01 - white
10 or 11 - black
The width and height of the image must both be greater than zero.

Parameters:
bytes - black/white Siemens bitmap with bpp = 2
imageWidth - The width of the new image, in pixels
imageHeight - The height of the new image, in pixels
transparent - If the image contains transparent pixels or not

Image

public Image(String name,
             boolean doScale)
      throws IOException
Creates a new image from PNG/JPG/GIF/BMP resource

Parameters:
name - The PNG ressource
doScale - Denotes if image should be scaled to fit onto the screen in case it is larger

Image

public Image(byte[] imageData)
Creates a new image from PNG/JPG/GIF/BMP byte stream


Image

public Image(byte[] bytes,
             int imageWidth,
             int imageHeight,
             int BitmapType)
      throws IOException
Creates a new image from uncompressed color data.

Image byte data encoding for type COLOR_BMP_8BIT:

Each pixel is represented by one byte. The upper 3 bits specify the amount of red, next 3 ones are the amount of green and the lowest 2 bits are for blue.
An exception is byte code 0xC0 which is the transparent color.

Parameters:
bytes - the image data
imageWidth - the width of the image
imageHeight - the height of the image
BitmapType - the type of the image data
Throws:
IOException - if the image type is not supported
Method Detail

getHeight

public int getHeight()
Get the height of the image


getWidth

public int getWidth()
Get the width of the image


createImageWithScaling

public static Image createImageWithScaling(String name)
                                    throws IOException
Creates an immutable image from decoded image data obtained from the named resource.

If the size of the image extends the screen size the image is scaled to fit into the screen. If this behaviour is unwanted, see javax.microedition.lcdui.Image.createImage.

This method is Siemens specific.

Parameters:
name - the name of the resource containing the image data in one of the supported image formats
Returns:
the created image
Throws:
IOException - if the resource does not exist, the data cannot be loaded, or the image data cannot be decoded

createImageWithoutScaling

public static Image createImageWithoutScaling(String name)
                                       throws IOException
Creates an immutable image from decoded image data obtained from the named resource.

If the size of the image extends the screen size overlapping regions are clipped. If this behaviour is unwanted, see createImageWithScaling.

This method is Siemens specific.

This method is deprecated, don't use it! Use javax.microedition.lcdui.Image.createImage instead!

Parameters:
name - the name of the resource containing the image data in one of the supported image formats
Returns:
the created image
Throws:
IOException - if the resource does not exist, the data cannot be loaded, or the image data cannot be decoded

createImageFromBitmap

public static Image createImageFromBitmap(byte[] imageData,
                                          int imageWidth,
                                          int imageHeight)
Create a new immutable image from a b/w Siemens bitmap stored in imageData

This method is Siemens specific.


createRGBImage

public static Image createRGBImage(byte[] imageData,
                                   int imageWidth,
                                   int imageHeight,
                                   int BitmapType)
                            throws ArrayIndexOutOfBoundsException,
                                   IOException
Creates a new image from uncompressed color data.

Image byte data encoding for type COLOR_BMP_8BIT:

Each pixel is represented by one byte. The upper 3 bits specify the amount of red, next 3 ones are the amount of green and the lowest 2 bits are for blue.
An exception is byte code 0xC0 which is the transparent color.

Parameters:
imageData - the image data
imageWidth - the width of the image
imageHeight - the height of the image
BitmapType - the type of the image data
Returns:
a Java image
Throws:
IOException - if the image type is not supported
ArrayIndexOutOfBoundsException - if width or height is equal or less than zero

createTransparentImageFromBitmap

public static Image createTransparentImageFromBitmap(byte[] bytes,
                                                     int width,
                                                     int height)

Creates a new immutable b/w image with bpp=2. Every pixel within the newly created b/w image could be 00=transparent 01=white 10 or 11 = black The width and height of the image must both be greater than zero.

This method is Siemens specific.

Parameters:
width - the width of the new image, in pixels
height - the height of the new image, in pixels
Returns:
the created image

mirrorImageHorizontally

public static void mirrorImageHorizontally(Image image)

Mirrors an Image at its horizontal axis.

This method is Siemens specific.

Parameters:
image - the image to be mirrored

mirrorImageVertically

public static void mirrorImageVertically(Image image)

Mirrors an Image at its vertical axis.

This method is Siemens specific.

Parameters:
image - the image to be mirrored

setNativeImage

protected static void setNativeImage(Image img,
                                     Image simg)
Registers the siemens image inside the lcdui image


getNativeImage

public static Image getNativeImage(Image img)


Generated on 2003-10-17For further information and updates, please visit Siemens mobile Developer Portal