Working with Images
This chapter shows you how to load and render images using the Neutrino image library libimg.
The Neutrino image library is a static library that provides a common interface for image codecs. The BlackBerry Tablet OS includes:
- the configuration file at /etc/system/config/img.conf (see its description in the documentation for img_lib_attach() )
- the image codecs (img_codec_*.so)
The codecs used by the Neutrino image library are:
- Windows Bitmap format codec. Provides full Microsoft BMP support for all known variants as well as the older OS/2 variant. Does not support v1.x DDB format.
- Graphics Interchange Format codec. Supports GIF 87a and GIF 89a variants. This codec supports the graphics control extension which provides most of the significant features for this format (transparency, interlacing, multiframe etc). It ignores other extensions which allow embedded text, comments, application data etc.
The img_codec_gif.so supports decoding, but not encoding due to patent restrictions.
- Joint Photographic Experts Group file format codec. Supports 24-bit RGB, YUV and grayscale.
- Portable Networks Graphics codec. Provides full PNG support with alpha, transparency, and interlacing support. This codec ignores the following chunks:
- background color
- physical pixel dimension
- significant bits
- text data
- image last-modified time
- SGI format codec. It supports black-and-white, grayscale, and color images (*sgi, *.rgb, *.rgba, *.bw).
This codec supports only decoding.
- Truevision Graphics Adapter format codec.
For decoding, this codec handles run length encoding (RLE) compression and supports these formats:
- true color 16-, 24-, and 32-bit
- cmap 15-, 16-, 24-, and 32-bit
- black and white 8-bit
For encoding, this codec supports true color (8888) 32-bit RLE.
To to display an image, your application needs to:
- attach to the image library
- load the image file
- clean up allocated resources and detach from the image library
Let's look at each of these steps in a little more detail.