The Graphics
object represents a graphics context through which drawing can take
place. A graphics context has a destination, which is either the actual device
screen or an off-screen image. Off-screen images are often used to implement
double buffering. Graphics
objects can be obtained by
calling the getGraphics()
method. The object of an off-screen
image can be held indefinitely by the MIDlet. Graphics
objects
are positioned on Canvas
and are a part of the low-level APIs.
A Graphics
object provides a set of methods for rendering
drawing primitives: text, images, lines, rectangles, and arcs. It also supports
clipping and origin translation methods. A Graphics
context
has a color associated with it, which it uses when rendering primitives. MIDP
supports a 24-bit color model (red, green, and blue have 8 bits each). A device's
color characteristics are obtained using the Display
object's numColors()
method.
The Image
class provides several static methods for
the creation of images: from a file, from another image, and from a raw byte
array. Images are either mutable (editable) or immutable (fixed). An image
created from a file is immutable.
Symbian implementation supports all image formats that are supported in the underlying platform (for example, image-handling module). These include:
PNG (as mandated by the MIDP 2.1 specifications
GIF (including animated GIFs)
JPEG (as mandated by the JTWI API specification)
Based on image format capabilities, both simple palette transparency (e.g. TRNs chunk of PNG) and alpha channel based transparency are supported in Symbian.
No hard coded limitations exist on supported image sizes. Many applications tend to use images that may be significantly larger than the size of a screen.
When the MIDlet tries to display an image that does not match the reserved space the following methodology is used to enforce the layout:
If the image is smaller than the reserved space, the image is centered in the space.
If the image is bigger than the reserved space, the part that fits the area from the top left corner of the image is shown, rest is clipped.
Images are not scaled.
MIDP
LCDUI Font
class provides three different sizes for font: SMALL
, MEDIUM
,
and LARGE
. Corresponding pixel sizes vary between different
resolutions. In addition to resolution variety, different language variants
may have their own restrictions. For example, some variants do not support
bold and/or italic fonts. In some cases, small font size can appear equal
to medium size.
Note: The pixel size values in 'Font
sizes'
column refer to the text row height. This value equals to the value returned
by Font.getHeight
method.
For additional examples, see the following articles at Forum Nokia wiki: