com.sun.lwuit
Class IndexedImage

java.lang.Object
  extended by com.sun.lwuit.Image
      extended by com.sun.lwuit.IndexedImage
Direct Known Subclasses:
StaticAnimation

Deprecated. This class should no longer be referenced directly. Use Image.createIndexed instead

public class IndexedImage
extends Image

An indexed image is an image "compressed" in memory to occupy as little memory as possible in this sense it is slower to draw and only a single indexed image can be drawn at any given time. However, this allows images with low color counts to use as little as one byte per pixel which can save up to 4 times of the memory overhead.


Constructor Summary
IndexedImage(int width, int height, int[] palette, byte[] data)
          Deprecated. use Image.createIndexed instead
 
Method Summary
protected  void drawImage(Graphics g, java.lang.Object nativeGraphics, int x, int y)
          Deprecated. Callback invoked internally by LWUIT to draw the image/frame onto the display.
 Graphics getGraphics()
          Deprecated. This method is unsupported in this image type
 int getHeight()
          Deprecated. Returns the height of the image
 byte[] getImageDataByte()
          Deprecated. Retrieves the image data as offsets into the palette array
 int[] getPalette()
          Deprecated. Retrieves the palette for the indexed image drawing
 int getWidth()
          Deprecated. Returns the width of the image
static IndexedImage load(byte[] data)
          Deprecated. Loads a packaged image that was stored in a stream using the toByteArray method
 Image modifyAlpha(byte alpha)
          Deprecated. Creates a new image instance with the alpha channel of opaque/translucent pixels within the image using the new alpha value.
static Image pack(Image sourceImage)
          Deprecated. Tries to pack the given image and would return the packed image or source image if packing failed
static IndexedImage pack(int[] rgb, int width, int height)
          Deprecated. Packs the source rgba image and returns null if it fails
static Image pack(java.lang.String imageName)
          Deprecated. Packs the image loaded by MIDP
 Image rotate(int degrees)
          Deprecated. Unsupported in the current version, this method will be implemented in a future release
 void scale(int width, int height)
          Deprecated. Scale the image to the given width and height, this is a fast algorithm that preserves translucent information
 Image scaled(int width, int height)
          Deprecated. Returns a scaled version of this image image using the given width and height, this is a fast algorithm that preserves translucent information.
 Image subImage(int x, int y, int width, int height, boolean processAlpha)
          Deprecated. Extracts a subimage from the given image allowing us to breakdown a single large image into multiple smaller images in RAM, this actually creates a standalone version of the image for use.
 byte[] toByteArray()
          Deprecated. This method allows us to store a package image into a persistent stream easily thus allowing us to store the image in RMS.
 
Methods inherited from class com.sun.lwuit.Image
animate, applyMask, applyMask, createImage, createImage, createImage, createImage, createImage, createImage, createImage, createIndexed, createMask, createSVG, drawImage, getImage, getRGB, getRGBCached, getSVGDocument, isAlphaMutableImageSupported, isAnimation, isOpaque, isSVG, isSVGSupported, lock, modifyAlpha, modifyAlphaWithTranslucency, scaledHeight, scaledSmallerRatio, scaledWidth, toRGB, unlock
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedImage

public IndexedImage(int width,
                    int height,
                    int[] palette,
                    byte[] data)
Deprecated. use Image.createIndexed instead

Creates an indexed image with byte data

Parameters:
width - image width
height - image height
palette - the color palette to use with the byte data
data - byte data containing palette offsets to map to ARGB colors
Method Detail

pack

public static Image pack(java.lang.String imageName)
                  throws java.io.IOException
Deprecated. 
Packs the image loaded by MIDP

Parameters:
imageName - a name to load using Image.createImage()
Returns:
a packed image
Throws:
java.io.IOException - when create fails

subImage

public Image subImage(int x,
                      int y,
                      int width,
                      int height,
                      boolean processAlpha)
Deprecated. 
Description copied from class: Image
Extracts a subimage from the given image allowing us to breakdown a single large image into multiple smaller images in RAM, this actually creates a standalone version of the image for use.

Overrides:
subImage in class Image
Parameters:
x - the x offset from the image
y - the y offset from the image
width - the width of internal images
height - the height of internal images
processAlpha - whether alpha should be processed as well as part of the cutting
Returns:
An array of all the possible images that can be created from the source

rotate

public Image rotate(int degrees)
Deprecated. 
Unsupported in the current version, this method will be implemented in a future release

Overrides:
rotate in class Image
Parameters:
degrees - A degree in right angle must be larger than 0 and up to 359 degrees
Returns:
new image instance with the closest possible rotation

modifyAlpha

public Image modifyAlpha(byte alpha)
Deprecated. 
Description copied from class: Image
Creates a new image instance with the alpha channel of opaque/translucent pixels within the image using the new alpha value. Transparent (alpha == 0) pixels remain transparent. All other pixels will have the new alpha value.

Overrides:
modifyAlpha in class Image
Parameters:
alpha - New value for the entire alpha channel
Returns:
Translucent/Opaque image based on the alpha value and the pixels of this image

getGraphics

public Graphics getGraphics()
Deprecated. 
This method is unsupported in this image type

Overrides:
getGraphics in class Image
Returns:
Graphics object allowing us to manipulate the content of a mutable image

pack

public static IndexedImage pack(int[] rgb,
                                int width,
                                int height)
Deprecated. 
Packs the source rgba image and returns null if it fails

Parameters:
rgb - array containing ARGB data
width - width of the image in the rgb array
height - height of the image
Returns:
a packed image or null

pack

public static Image pack(Image sourceImage)
Deprecated. 
Tries to pack the given image and would return the packed image or source image if packing failed

Parameters:
sourceImage - the image which would be converted to a packed image if possible
Returns:
the source image if packing failed or a newly packed image if it succeeded

drawImage

protected void drawImage(Graphics g,
                         java.lang.Object nativeGraphics,
                         int x,
                         int y)
Deprecated. 
Description copied from class: Image
Callback invoked internally by LWUIT to draw the image/frame onto the display. Image subclasses can override this method to perform drawing of custom image types.

Overrides:
drawImage in class Image
Parameters:
g - the graphics object
nativeGraphics - the underlying native graphics which might be essential for some image types
x - the x coordinate
y - the y coordinate

getWidth

public int getWidth()
Deprecated. 
Description copied from class: Image
Returns the width of the image

Overrides:
getWidth in class Image
Returns:
the width of the image

getHeight

public int getHeight()
Deprecated. 
Description copied from class: Image
Returns the height of the image

Overrides:
getHeight in class Image
Returns:
the height of the image

scale

public void scale(int width,
                  int height)
Deprecated. 
Description copied from class: Image
Scale the image to the given width and height, this is a fast algorithm that preserves translucent information

Overrides:
scale in class Image
Parameters:
width - width for the scaling
height - height of the scaled image

scaled

public Image scaled(int width,
                    int height)
Deprecated. 
Description copied from class: Image
Returns a scaled version of this image image using the given width and height, this is a fast algorithm that preserves translucent information. The method accepts -1 to preserve aspect ratio in the given axis.

Overrides:
scaled in class Image
Parameters:
width - width for the scaling
height - height of the scaled image
Returns:
new image instance scaled to the given height and width

getPalette

public final int[] getPalette()
Deprecated. 
Retrieves the palette for the indexed image drawing

Returns:
the palette data

getImageDataByte

public final byte[] getImageDataByte()
Deprecated. 
Retrieves the image data as offsets into the palette array

Returns:
the image data

toByteArray

public byte[] toByteArray()
Deprecated. 
This method allows us to store a package image into a persistent stream easily thus allowing us to store the image in RMS.

Returns:
a byte array that can be loaded using the load method

load

public static IndexedImage load(byte[] data)
Deprecated. 
Loads a packaged image that was stored in a stream using the toByteArray method

Parameters:
data - previously stored image data
Returns:
newly created packed image