oi10:presentation_server:image_transparency_color_keying_and_alpha_blending

Image transparency - Color-keying and Alpha-blending

Earlier versions of OpenInsight have supported basic image transparency via a method called "color-keying", where a specific color in the image is nominated as the transparent color (by default the color of the top-left pixel). When the image is drawn to screen the pixels that match the transparent color are not rendered so the background pixels show through instead. While this can be effective in simple cases it is sub-optimal for images that have smooth curves and shadows as these tend to appear very pixelated.

A much better alternative is to use an image format that supports an "alpha channel" such as a PNG file*. Basically this means that each pixel in the image has an extra byte that describes its transparency - a value of 0 means that the pixel is totally transparent, while a value of 255 means that the pixel is totally opaque. Values in between are used to calculate how the image pixel is combined with the background pixel when drawn, so that it gives the appearance of being translucent, allowing the background pixel to show through to some degree. This is a technique known as Alpha-blending.

With version 10 we have taken the opportunity to re-visit OpenInsight's image handling so it respects the alpha channel properly. We have also taken this one step further and provided the ability to specify a transparency setting for the entire image when it is rendered, so you can create an effect like a watermark.

This effect also applies to color-keyed and non-transparent bitmaps also, which of course are still fully supported so you will not need to change your existing applications unless you want to.

*(PNG image files have always been supported in OpenInsight but the alpha-channel has never been respected, thereby limiting them to basic color-keying for transparency effects).

  • oi10/presentation_server/image_transparency_color_keying_and_alpha_blending.txt
  • Last modified: 2023/10/25 10:49
  • by 127.0.0.1