1. Creating Images
1.1 Creating A Mutable Image With An Alpha Channel
A mutable Image with an alpha channel by calling the Image method
public static Image createImage(
int width,
int height,
boolean withAlpha,
int fillColor)
It is an error if either the x or y arguments is less than one and an IllegalArgumentException will be thrown.
The fillColor argument specifies the initial value of each pixel of the created Image.
If the withAlpha argument is true then the fillColor argument is interpreted as a value of the form 0xAARRGGBB, otherwise as a value of the form 0x00RRGGBB
1.2 Creating An Image By Scaling And Transforming An Existing Image
An Image can be created by scaling and transforming all or part of an existing Image by calling the Image method
public static Image createImage(
Image image,
int x,
int y,
int width,
int height,
int transform,
int img_width,
int img_height)
The x, y, width, and height specify the region of the existing Image to use.
It is an error if the specified region is not entirely within the bounds of the source Image, or if the region’s width or height is less than one and an IllegalArgumentException will be thrown.
The transform argument specifies the transform to apply as defined in the Sprite class. It is an error if the specified transform is invalid and an IllegalArgumentException will be thrown.
The img_width and img_height arguments specify the size of the new Image. It is an error if the specified width or height is less than one and an IllegalArgumentException will be thrown.
2. Getting Image Data In 16-bit Formats
A MIDlet can get Image data in 16-bit RGB format by calling the Image’s
public void getRGB16(
short[] rgbData,
int offset,
int scanlength,
int x,
int y,
int width,
int height)
method, and in 16-bit ARGB format by calling the Image’s
public void getARGB16(
short[] rgbData,
int offset,
int scanlength,
int x,
int y,
int width,
int height)
method.
3. Predicate Methods
3.1 Does An Image Have An Alpha Channel ?
A MIDlet can determine whether an Image has an alpha channel by calling it’s
public boolean hasAlpha()
method.
3.2 Is An Image Animated ?
A MIDlet can determine whether an Image is an instance of the sub-class AnimatedImage by calling the Image’s
public boolean isAnimated()
method.
3.3 Is An Image Scalable ?
A MIDlet can determine whether an Image is an instance of the sub-class ScalableImage by calling the Image’s
public boolean isScalable()
method.
Copyright (c) 2009 By Simon Lewis. All Rights Reserved.
[...] the resulting Image is in fact an ScalableImage can be determined by calling the Image’s isScalable() [...]
Pingback by What’s New In MIDP 3.0 ? Part 30: LCDUI – ScalableImage « Just An Application — July 22, 2009 @ 1:15 pm