<< Chapter < Page | Chapter >> Page > |
I recommend that you also study the other lessons in my extensive collection of online programmingtutorials. You will find a consolidated index at www.DickBaldwin.com .
In an earlier lesson titled Bitmap Basics , I explained the differences between Flex projects and ActionScript projects. I also introduced you to the classes named Bitmap and BitmapData . Now it's time to put that knowledge to work. In this lesson, I will show you how to:
Before getting into that, however, it will be useful to explain how image information is stored in files and in the computer's memory.
Vector graphics versus bitmap graphics
Graphics programming typically involves two main types of data: bitmaps and vector graphics. This lesson deals with bitmap data only. I will deal withvector graphics in a future lesson.
A rectangular array of pixels
When you take a picture with your digital camera, the scene is converted into a rectangular array containing millions of uniformly spaced colored dots. Thosedots or picture elements (pixels) are stored on the memory card in your camera until you download them into your computer.
Width, height, and color depth
An image that is stored in this way is defined by the width and height of the array of pixels along with the number of bits that are used to define the color.
Up to a point, the more pixels that the camera produces to represent a given field of view, the better will be the image. Similarly, the more bits that areused to store the color, the better will be the overall quality of the image, particularly in terms of subtle shades of color.
The resolution
The number of pixels per unit area is commonly referred to as resolution. For example, the display monitor that I am currently using displays an array of 1280x1024 pixels in a rectangular area with a diagonal measurement of 19 inches. (This is not a particularly high resolution monitor.)
The color depth
The number of bits used to represent the color of a pixel is commonly referred to as the color depth. Most modern computers routinely use a colordepth of 32 bits. Note, however, that some file formats used for the storage and transmission of bitmap graphics data use fewer than 32 bits for therepresentation of each pixel in an image.
The RGB or ARGB color model
ActionScript supports a computer color model commonly known as the RGB model or the ARGB model. With this model, the color of each pixel is represented bythree numeric color values and an optional transparency value (alpha) .
Each of the three color values represents the contribution or strength of a primary color: red, green, and blue. The final color of the pixel is a mixture of the primary colors. This is similar to a kindergarten student mixing red,green, and blue clay to produce a color that is different from red, green or blue. (I don't have a clay analogy for transparency, however.)
Notification Switch
Would you like to follow the 'Object-oriented programming (oop) with actionscript' conversation and receive update notifications?