Name
Image
Synopsis
A class that represents a memory-resident image that can be drawn onto the screen.
Image
s are used in both the high- and low-level user interface
APIs. In the high-level API, Image
s can be used with
Alert
s, ChoiceGroup
s,
ImageItem
s and List
s. In the low-level API,
an Image
can be drawn onto any part of a Canvas
object from within its paint()
method.
An Image
may be either
mutable or immutable. Image
s
used in the high-level API must be immutable; either type may be used with the
low-level API. Given an arbitrary Image
, the isMutable()
method can be used to determine whether it is mutable or not. The dimensions of an
Image
can be obtained by calling its getWidth()
and getHeight()
methods.
There are are four static createImage()
methods can be used to create an
Image
. The createImage(byte[] data, int offset, int length)
method creates an immutable image from data held in a portion of a given byte array.
The data must
be encoded in a format that is supported by the implementation. The only format
that the MIDP specification requires a device to support is Portable Network Graphics (PNG).
The image data can be obtained from any source, such as over a network or from a
record in a RecordStore
on the device.
The createImage(String fileName)
method uses the content of a file addressable
using the resource name fileName
as the image data and creates an immutable
image from it. fileName
is usually the absolute path name of a file within the MIDlet suite’s JAR file, such ...
Get J2ME in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.