|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.lwuit.Image com.sun.lwuit.IndexedImage
public class IndexedImage
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 |
---|
public IndexedImage(int width, int height, int[] palette, byte[] data)
width
- image widthheight
- image heightpalette
- the color palette to use with the byte datadata
- byte data containing palette offsets to map to ARGB colorsMethod Detail |
---|
public static Image pack(java.lang.String imageName) throws java.io.IOException
imageName
- a name to load using Image.createImage()
java.io.IOException
- when create failspublic Image subImage(int x, int y, int width, int height, boolean processAlpha)
Image
subImage
in class Image
x
- the x offset from the imagey
- the y offset from the imagewidth
- the width of internal imagesheight
- the height of internal imagesprocessAlpha
- whether alpha should be processed as well as part of the cutting
public Image rotate(int degrees)
rotate
in class Image
degrees
- A degree in right angle must be larger than 0 and up to 359 degrees
public Image modifyAlpha(byte alpha)
Image
modifyAlpha
in class Image
alpha
- New value for the entire alpha channel
public Graphics getGraphics()
getGraphics
in class Image
public static IndexedImage pack(int[] rgb, int width, int height)
rgb
- array containing ARGB datawidth
- width of the image in the rgb arrayheight
- height of the image
public static Image pack(Image sourceImage)
sourceImage
- the image which would be converted to a packed image if possible
protected void drawImage(Graphics g, java.lang.Object nativeGraphics, int x, int y)
Image
drawImage
in class Image
g
- the graphics objectnativeGraphics
- the underlying native graphics which might be essential for some image typesx
- the x coordinatey
- the y coordinatepublic int getWidth()
Image
getWidth
in class Image
public int getHeight()
Image
getHeight
in class Image
public void scale(int width, int height)
Image
scale
in class Image
width
- width for the scalingheight
- height of the scaled imagepublic Image scaled(int width, int height)
Image
scaled
in class Image
width
- width for the scalingheight
- height of the scaled image
public final int[] getPalette()
public final byte[] getImageDataByte()
public byte[] toByteArray()
public static IndexedImage load(byte[] data)
data
- previously stored image data
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |