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.
S60 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)
For more information on Graphics
, see Graphics
implementation notes.