com.siemens.mp.game
Class ExtendedImage

java.lang.Object
  extended bycom.siemens.mp.misc.NativeMem
      extended bycom.siemens.mp.game.ExtendedImage

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

The ExtendedImage extends Image properties with device-specific functionality.

ExtendedImage provides functionality for working with black/white and black/white/transparent images as bitmaps (access to individual pixel and to pixel arrays) and for drawing images directly on the handset display (without a paint() call).

See Also:
Image

Example


Constructor Summary
ExtendedImage(Image image)
          Creates ExtendedImage object from an already existing standard Image.
 
Method Summary
 void blitToScreen(int x, int y)
          Draws an image directly into the display buffer (without a paint call).
 void clear(byte color)
          Fills an entire image with a given color.
 Image getImage()
          Returns the standard Image of ExtendedImage object.
 int getPixel(int x, int y)
          Returns an individual pixel's color.
 void getPixelBytes(byte[] pixels, int x, int y, int width, int height)
          Stores pixels' colors into the given bytearray.
 void setPixel(int x, int y, byte color)
          Sets individual pixel's color.
 void setPixels(byte[] pixels, int x, int y, int width, int height)
          Sets pixels' colors from a bytearray.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendedImage

public ExtendedImage(Image image)
              throws IllegalArgumentException
Creates ExtendedImage object from an already existing standard Image. The Image width must be a multiple of 8. After ExtendedImage creation, the user may work with both the ExtendedImage and the original Image methods.

Parameters:
image - standart Image, the width must be a multiple of 8
Throws:
IllegalArgumentException - if the width of the image is not a multiple of 8
See Also:
getImage

Example

Method Detail

setPixel

public void setPixel(int x,
                     int y,
                     byte color)
Sets individual pixel's color.

Parameters:
x - the x coordinate of the pixel
y - the y coordinate of the pixel
color - the color of the pixel
(if 2 bit per pixel used: 0:transp.; 1:white; 2,3:black)
(if 1 bit per pixel used: 0:white; 1:black)
See Also:
getPixel, setPixels

Example


setPixels

public void setPixels(byte[] pixels,
                      int x,
                      int y,
                      int width,
                      int height)
Sets pixels' colors from a bytearray. This method sets colors for pixels in a given rectangle from the bytearray. This array contains information in ether 1bpp or 2bpp format, depending on the image type (without transparency or with transparency).

Parameters:
pixels - the pixel array (1 or 2 bit per pixel, depending on the image type used)
x - the x coordinate of the left-top rectangle corner, must be a multiple of 8
y - the y coordinate of the left-top rectangle corner
width - the width of the rectangle, must be a multiple of 8
height - the height of the rectangle
See Also:
getPixelBytes, setPixel

Example


getPixel

public int getPixel(int x,
                    int y)
Returns an individual pixel's color.

Parameters:
x - the x coordinate of the pixel
y - the y coordinate of the pixel
Returns:
the color of the pixel
(if 2 bit per pixel used: 0:transp.; 1:white; 2,3:black)
(if 1 bit per pixel used: 0:white; 1:black)
See Also:
setPixel, getPixelBytes

Example


getPixelBytes

public void getPixelBytes(byte[] pixels,
                          int x,
                          int y,
                          int width,
                          int height)
Stores pixels' colors into the given bytearray. This method gets colors of pixels in a given rectangle and stores them into the bytearray. The array contains information in ether 1bpp or 2bpp format, depending on the image type (without transparency or with transparency).

Parameters:
pixels - the target pixel array (1 or 2 bit per pixel, depending on the image type)
x - the x coordinate of the left-top rectangle corner, must be a multiple of 8
y - the y coordinate of the left-top rectangle corner
width - the width of the rectangle, must be a multiple of 8
height - the height of the rectangle
See Also:
setPixels, getPixel

Example


clear

public void clear(byte color)
Fills an entire image with a given color.

Parameters:
color - the color to fill
(if 2 bit per pixel used: 0:transp.; 1:white; 2,3:black)
(if 1 bit per pixel used: 0:white; 1:black)

Example


blitToScreen

public void blitToScreen(int x,
                         int y)
Draws an image directly into the display buffer (without a paint call).

Parameters:
x - the x coordinate of the drawing area starting point, in screen coordinates
y - the y coordinate of the drawing area starting point, in screen coordinates

getImage

public Image getImage()
Returns the standard Image of ExtendedImage object.

Returns:
the standard Image
See Also:
ExtendedImage constructor

Example



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