Introduction: Image Display

When you display an image, the following things come into play:

  • Sizing and positioning the display.
  • Adapting the image to the color resolution of the display device.
  • Making other refinements that affect the display but not the bitmap in memory.

The LEADTOOLS display functions let you specify which part of an image to display, how big to make the display, and where to position the origin (for scrolling and zooming).

LEADTOOLS makes it easy to show the application user exactly what he wants to see. You can control the size and position of the display without resizing or trimming the bitmap. In fact, it usually is best to think of the bitmap size as a measure of resolution, rather than a measure of size. The larger the bitmap, the more you can zoom in without losing detail.

As for adapting to the color resolution of the display device, if the color resolution of your device is greater than 256 colors, no adaptation is necessary. If the color resolution is higher than 256 colors, images are displayed using their own color values. Of course, if a 24-bit image is displayed on a 16-bit device, there is some loss, but there are still no programming issues, since the only remedy is to change the display mode.

If the color resolution of your display device is 256 colors or less, you have to make some programming decisions regarding dithering and palette selection. When displaying 16-, 24-, or 32-bit images, you can determine whether LEADTOOLS uses ordered dithering or error diffusion to handle the color reduction. (LEADTOOLS uses a fixed palette for these images.) When displaying 8, 4, or 1-bit images, you must decide whether to use a fixed palette or the individual image's palette. Using the fixed palette avoids palette shifting when more than one image is displayed at the same time. Using the image's original palette produces the best possible display of the image's colors.

Other LEADTOOLS functions let you determine how the new display interacts with whatever is already on the display device. For example, you can use Windows ROP codes to combine the displayed images. Also, when displaying 1-bit images, you can set scale-to-gray or favor-black options that can improve the readability of scaled images (images that are zoomed in or out to fit the available space).

For displaying 12 to 16-bit grayscale images, LEADTOOLS provides functions for window leveling. Window leveling allows you to map grayscale intensities by specifying the bit range and/or a user defined color map. Window leveling is only available in the Document/Medical editions.