|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmwt.Skin
mwt.midp2.ImageUtil
public final class ImageUtil
An image utility class for MIDP2 devices.
Warning: this documentation was not reviewed.
This class extends Skin implementing a new createBuffer(int, int) method
that allows transparency. (Check Skin.createBuffer(int, int)).
To create an instance use createSkin(Image[], int).
If the given images are resized, they do not lose the alpha channel.
To resize or paint an image, use the static methods imageResize(Image, int) and
imageColor(Image, int).
This class offers a workaround to draw into immutable/buffered images.
There is no way to create a mutable image as a buffer and draw into it preserving the alpha channels.
(only immutable images have alpha channels). The bright-pink color is used to simulate the alpha channel.
Example:
Image buffer = Image.createImage(width, height); ImageUtil.alphaPrepare(buffer); Graphics g = buffer.getGraphics(); [ g.draws ] Image alphaImage = ImageUtil.alphaProcess(buffer);
| Method Summary | |
|---|---|
static void |
alphaPrepare(javax.microedition.lcdui.Image mutable)
Fills the given mutable image with the mask color (bright pink). |
static javax.microedition.lcdui.Image |
alphaProcess(javax.microedition.lcdui.Image buffer)
Creates a new immutable image processing the given image pixels with alphaProcess(int[]). |
static void |
alphaProcess(int[] pixels)
Proccesses the bright pink color intensities as alpha channel values. |
protected javax.microedition.lcdui.Image |
createBuffer(int width,
int height)
Creates an image that will be used as a buffer. |
static Skin |
createSkin(javax.microedition.lcdui.Image[] images,
int newSize)
Creates an image skin. |
static javax.microedition.lcdui.Image |
imageColor(javax.microedition.lcdui.Image img,
int color)
Creates a new immutable image processing the given image pixels with imageColor(int[], int). |
static void |
imageColor(int[] pixels,
int color)
Processes the given pixels applying the given color. |
static javax.microedition.lcdui.Image |
imageResize(javax.microedition.lcdui.Image img,
int newHeight)
Like imageResize(int[], int, int) but using an image instead. |
static int[] |
imageResize(int[] img,
int height,
int newHeight)
Resize an image rgba raw. |
| Methods inherited from class mwt.Skin |
|---|
clone, copy, paint, paint |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final Skin createSkin(javax.microedition.lcdui.Image[] images,
int newSize)
images - The array with 9 images in the correspoding ordernewSize - The new size, or 0 to skip resizing
Skin
protected javax.microedition.lcdui.Image createBuffer(int width,
int height)
Skin
Image buf = Image.createImage(c.getWidth(),c.getHeight());
this.paint(buf.getGraphics(),c.getWidth(),c.getHeight());
return buf;
MWT handles memory management automatically.
createBuffer in class Skin
public static final int[] imageResize(int[] img,
int height,
int newHeight)
img - the imageheight - the image's heightnewHeight - the new height
public static final javax.microedition.lcdui.Image imageResize(javax.microedition.lcdui.Image img,
int newHeight)
imageResize(int[], int, int) but using an image instead.
img - newHeight -
public static final void imageColor(int[] pixels,
int color)
pixels - color -
public static final javax.microedition.lcdui.Image imageColor(javax.microedition.lcdui.Image img,
int color)
imageColor(int[], int).
img - color -
public static final void alphaPrepare(javax.microedition.lcdui.Image mutable)
mutable - alphaProcess(Image)public static final javax.microedition.lcdui.Image alphaProcess(javax.microedition.lcdui.Image buffer)
alphaProcess(int[]).
buffer -
public static final void alphaProcess(int[] pixels)
pixels -
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||