<< Chapter < Page Chapter >> Page >

The effect of the transparency value

In some cases, the pixel also contains another value referred to as the alpha value (ARGB) that represents the transparency of the pixel.

Transparency comes into play when you draw a new image over an existing image. If the alpha value for a pixel is zero, there is no change in the colorof the existing pixel because the new pixel is totally transparent. (Although the effect is commonly referred to as transparency, the numeric value isactually proportional to opacity, which is the inverse of transparency.)

Total opacity

If the alpha value indicates total opacity (often represented as either 1.0 or 255) , the color of the existing pixel is completely replaced by the color of the new pixel. (I will explain the difference between 1.0 and 255 later.)

Partial opacity

If the alpha value falls between 0 and 1.0 (0 and 255) , the colors of the existing pixel and the new pixel are combined to produce a new blendedcolor. The result is as if you are viewing the original scene through colored glass.

An unsigned 32-bit chunk of memory

Typically, a pixel is represented in the computer by an unsigned 32-bit chunk of memory. Each of the three primary colors and the alpha value are representedby an eight-bit unsigned byte. The bytes are concatenated to form the 32-bit chunk of memory.

256 levels

This results in 256 levels of intensity for each of the primary colors along with 256 levels of transparency for the alpha byte. For example, if the red,green, and alpha bytes are equal to 255 and the blue byte is zero, the pixel will be displayed as bright yellow on a typical computer screen.

Bitmap image file formats

Different file formats are commonly used to store and transmit image data. It is usually desirable to reduce the size of the file required to store a givenimage while maintaining the quality of the image. This often results in a tradeoff between file size and image quality.

Different formats use different compression algorithms to reduce the size of the file. The bitmap image formats supported by Adobe Flash Player and Adobe Airare GIF, JPG, and PNG.

The GIF format

The Graphics Interchange Format (GIF) is a format that is often used to store low quality images in very small files. The format can store a maximum of 256different colors and can designate one of those colors to represent a fully transparent pixel. By comparison, the typical ARGB format can represent morethan sixteen million colors with 256 levels of transparency for each pixel.

The GIF format would not be very satisfactory for images produced by your digital camera, but it is fine for many purposes such as screen icons where highcolor quality is not an important consideration.

The JPEG format

This format, which is often written as JPG, was developed by the Joint Photographic Experts Group (JPEG) . This image format uses a lossy compression algorithm to allow 24-bit color depth with a small file size.

Lossy compression means that what comes out of the compressed file is not identical to what went in. The loss in picture quality is often acceptable,however, given that the format allows for different degrees of lossiness which is inversely related to the size of the compressed file. All of the digitalcameras that I have owned produce JPEG files as the standard output and some of them allow the user to select the degree of compression and hence the degree oflossiness.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Object-oriented programming (oop) with actionscript. OpenStax CNX. Jun 04, 2010 Download for free at http://cnx.org/content/col11202/1.19
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?

Ask