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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Working with bitmaps<br />

Color channel Commonly, colors are repres<strong>en</strong>ted as a mixture of a few basic colors—usually (for computer graphics)<br />

red, gre<strong>en</strong>, and blue. Each basic color is considered a color channel; the amount of color in each color channel, mixed<br />

together, determines the final color.<br />

Color depth Also known as bit depth, this refers to the amount of computer memory that is devoted to each pixel,<br />

which in turn determines the number of possible colors that can be repres<strong>en</strong>ted in the image.<br />

Pixel The smallest unit of information in a bitmap image—ess<strong>en</strong>tially a dot of color.<br />

Resolution The pixel dim<strong>en</strong>sions of an image, which determines the level of fine-grained detail contained in the<br />

image. Resolution is oft<strong>en</strong> expressed in terms of width and height in number of pixels.<br />

RGB color A color scheme where each pixel’s color is repres<strong>en</strong>ted as a mixture of red, gre<strong>en</strong>, and blue color values.<br />

The Bitmap and BitmapData classes<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

The main ActionScript 3.0 classes for working with bitmap images are the Bitmap class, which is used to display<br />

bitmap images on the scre<strong>en</strong>, and the BitmapData class, which is used to access and manipulate the raw image data of<br />

a bitmap.<br />

More Help topics<br />

flash.display.Bitmap<br />

flash.display.BitmapData<br />

Understanding the Bitmap class<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

As a subclass of the DisplayObject class, the Bitmap class is the main ActionScript 3.0 class used for displaying bitmap<br />

images. These images may have be<strong>en</strong> loaded via the flash.display.Loader class or created dynamically using the<br />

Bitmap() constructor. Wh<strong>en</strong> loading an image from an external source, a Bitmap object can only use GIF, JPEG, or<br />

PNG format images. Once instantiated, the Bitmap instance can be considered a wrapper for a BitmapData object that<br />

needs to be r<strong>en</strong>dered to the Stage. Because a Bitmap instance is a display object, all the characteristics and functionality<br />

of display objects can be used to manipulate a Bitmap instance as well. For more information about working with<br />

display objects, see “Display programming” on page 151.<br />

Pixel snapping and smoothing<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

In addition to the functionality common to all display objects, the Bitmap class provides some additional features that<br />

are specific to bitmap images.<br />

The pixelSnapping property of the Bitmap class determines whether or not a Bitmap object snaps to its nearest pixel.<br />

This property accepts one of three constants defined in the PixelSnapping class: ALWAYS, AUTO, and NEVER.<br />

The syntax for applying pixel snapping is as follows:<br />

myBitmap.pixelSnapping = PixelSnapping.ALWAYS;<br />

Last updated 6/6/2012<br />

244

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

Saved successfully!

Ooh no, something went wrong!