Images

A form can contain one or more image items, each of which can contain a reference to an image. Screenshot shows an image item.

Screenshot An Image Item on a Form

Java graphics 08fig03.gif


app Developer Responsibilities

MIDP Implementor Responsibilities

  • An immutable image
  • Any alternate text
  • Any label text
  • Any layout hints
  • Any item-specific abstract commands
  • Any appearance mode
  • Any item-specific abstract commands
  • Any size or color constraints
  • Support for images in PNG format
  • Image-handling policy (clipping or skipping oversized images)
  • Alternate text support
  • Transparency support

app Developers

Recommend: Java graphics bulb2_icon.gif Provide high-contrast images because devices might not have high-quality color screens, and they are used in high-glare environments.

Consider: You can change, add, or remove an image from a form as needed. Try to do it only when the form is not visible, or in response to a user action. Arbitrary changes to visible screens are confusing.

Consider: You can make an image item interactive by adding an item-specific abstract command to it. In addition, you can change the appearance of the interactive image item so that it looks like a button or a hyperlink. See "Buttons and Hyperlinks" on page 97 for more information.

Image Format

MIDP implementations must support PNG (portable network graphics) 1.0 images, as specified in the W3C recommendation [24]. More information is available from RFC 2083 [25].

MIDP Implementors

Consider: You can support other image formats in addition to supporting PNG. If you do support other image formats, publish this information for app developers.

app Developers

Strongly Recommend: Java graphics bulb1_icon.gif For your MIDlet to run on as many devices as possible, provide PNG images. All MIDP devices support PNG graphics.

Transparency

Although all images are rectangular, transparency can enable them to appear to be different shapes. For example, an image of a ball can appear to be round. There are two types of transparency: full and partial. When an image uses full transparency, its pixels are either transparent or opaque. The device uses the background color for the transparent pixels. For partial transparency, a pixel can be fully transparent, opaque, or some value in between.

MIDP Implementors

Consider: You must support full transparency, but you are not required to support partial transparency. If you want to support partial transparency, your implementation will have to blend the partially transparent pixel with another pixel. If the pixel you blend against is the background pixel, it is called full alpha blending. Full alpha blending can be very resource intensive. It is not required by the MIDP 2.0 Specification [19], even for MIDP implementations that support partial transparency.

Consider: If full alpha blending slows your implementation, try blending against a single color instead. The MIDP 2.0 Specification [19] does not require you to check the background color as part of your support for partial transparency.

Image Color and File Size Considerations

Small devices have limited resources, and image files can be large. This section offers some advice that will help reduce the file size of your images. Image files that use less storage space conserve device resources and enable MIDlets to start faster. In addition, they could save the user money: smaller MIDlet suites take less time to download.

app Developers

Consider: When you create images for an app, consider saving them with only the colors they need. The fewer colors an image contains, the smaller its file size.

Consider: Provide a color image that looks good in grayscale instead of providing both a color and a grayscale version of the same image. Providing a single image that can serve both purposes saves space. (You may also need to provide a black-and-white version of the image if your MIDlet might be run on a monochrome device.)

Consider: If you provide more than one version of an image (for example, one that is color and another that is black and white), check the device characteristics at runtime to determine which version to use. The Display class has methods that return information such as the number of colors the device supports. (See Programming Wireless Devices with the Java 2 Platform, Micro version [17] for more information.)

Alternate Text

Alternate text is text that the MIDP implementation displays if it cannot show an image. For example, some devices would display alternate text if the image is too large.

app Developers

Recommend: Java graphics bulb2_icon.gif Provide alternate text either when you create the image-item instance, or afterwards, using the setAltText method of the ImageItem class.



   
Comments