13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with bitmaps<br />

BMP<br />

The BMP (bit mapped) format is a default image format used by the Microsoft Windows operating system. It does not<br />

use any form of compression algorithm and as such usually results in large file sizes.<br />

GIF<br />

The Graphics Interchange Format (GIF) was originally developed by CompuServe in 1987 as a means to transmit<br />

images with 256 colors (8-bit color). The format provides small file sizes and is ideal for web-based images. Because of<br />

this format’s limited color palette, GIF images are g<strong>en</strong>erally not suitable for photographs, which typically require high<br />

degrees of shading and color gradi<strong>en</strong>ts. GIF images permit single-bit transpar<strong>en</strong>cy, which allows colors to be mapped<br />

as clear (or transpar<strong>en</strong>t). This results in the background color of a web page showing through the image where the<br />

transpar<strong>en</strong>cy has be<strong>en</strong> mapped.<br />

JPEG<br />

Developed by the Joint Photographic Experts Group (JPEG), the JPEG (oft<strong>en</strong> writt<strong>en</strong> JPG) image format uses a lossy<br />

compression algorithm to allow 24-bit color depth with a small file size. Lossy compression means that each time the<br />

image is saved, the image loses quality and data but results in a smaller file size. The JPEG format is ideal for<br />

photographs because it is capable of displaying millions of colors. The ability to control the degree of compression<br />

applied to an image allows you to manipulate image quality and file size.<br />

PNG<br />

The Portable Network Graphics (PNG) format was produced as an op<strong>en</strong>-source alternative to the pat<strong>en</strong>ted GIF file<br />

format. PNGs support up to 64-bit color depth, allowing for up to 16 million colors. Because PNG is a relatively new<br />

format, some older browsers don’t support PNG files. Unlike JPGs, PNGs use lossless compression, which means that<br />

none of the image data is lost wh<strong>en</strong> the image is saved. PNG files also support alpha transpar<strong>en</strong>cy, which allows for up<br />

to 256 levels of transpar<strong>en</strong>cy.<br />

TIFF<br />

The Tagged Image File Format (TIFF) was the cross-platform format of choice before the PNG was introduced. The<br />

drawback with the TIFF format is that because of the many differ<strong>en</strong>t varieties of TIFF, there is no single reader that<br />

can handle every version. In addition, no web browsers curr<strong>en</strong>tly support the format. TIFF can use either lossy or<br />

lossless compression, and is able to handle device-specific color spaces (such as CMYK).<br />

Transpar<strong>en</strong>t bitmaps and opaque bitmaps<br />

Bitmap images that use either the GIF or PNG formats can have an extra byte (alpha channel) added to each pixel. This<br />

extra pixel byte repres<strong>en</strong>ts the transpar<strong>en</strong>cy value of the pixel.<br />

GIF images allow single-bit transpar<strong>en</strong>cy, which means that you can specify a single color, from a 256-color palette, to<br />

be transpar<strong>en</strong>t. PNG images, on the other hand, can have up to 256 levels of transpar<strong>en</strong>cy. This function is especially<br />

b<strong>en</strong>eficial wh<strong>en</strong> images or text are required to bl<strong>en</strong>d into backgrounds.<br />

ActionScript 3.0 replicates this extra transpar<strong>en</strong>cy pixel byte within the BitmapData class. Similar to the PNG<br />

transpar<strong>en</strong>cy model, ActionScript offers up to 256 levels of transpar<strong>en</strong>cy.<br />

Important concepts and terms<br />

The following list contains important terms that you will <strong>en</strong>counter wh<strong>en</strong> learning about bitmap graphics:<br />

Alpha The level of transpar<strong>en</strong>cy (or more accurately, opacity) in a color or an image. The amount of alpha is oft<strong>en</strong><br />

described as the alpha channel value.<br />

ARGB color A color scheme where each pixel’s color is a mixture of red, gre<strong>en</strong>, and blue color values, and its<br />

transpar<strong>en</strong>cy is specified as an alpha value.<br />

Last updated 6/6/2012<br />

243

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!