<< Chapter < Page Chapter >> Page >

The JPEG format does not support alpha transparency. Therefore, it is not suitable as a file format for transmitting images with alpha data betweencomputers.

The PNG format

Apparently there are some patent issues with the GIF format. The Portable Network Graphics (PNG) format was produced as an open-source alternative to the GIF file format.

The PNG format supports at least sixteen million colors and uses lossless compression. The PNG format also supports alpha transparency allowing for up to256 levels of transparency in a compressed format.

The BitmapData class

The BitmapData class in ActionScript 3 supports a 32-bit ARGB color model with more than sixteen million colors and 256 levels of alphatransparency per pixel.

Preview

I will explain two different programs in this lesson. One is named Bitmap05 and the other is named Bitmap06 . Both programs produce the same output, which is shown in Figure 1.

Screen output for both programs.

Missing image
Screen output for both programs.

Program file structure

Figure 2 shows the program file structure taken from the Flex Builder 3 Navigator panel for the program named Bitmap05 .

Program file structure for the program named bitmap05.

Missing image
Program file structure for the program named Bitmap05.

The program file structure for Bitmap06 is the same except for the name of MXML file.

I will use the programs named Bitmap05 and Bitmap06 to explain a variety of topics.

Skeleton code

First, I will provide skeleton code for creating a Bitmap object from an image file. You will learn how to use the skeleton code to create and display a bitmap from an image file as shown by the top image in Figure 1.

Extract the BitmapData object

I will show you how to extract the BitmapData object from the Bitmap object so that you can modify the pixels in the image. Once you are able to extract the BitmapData object, you will have the bitmap data exposed to the point that you can implement a varietyof image processing algorithms such as the following:

  • Smoothing
  • Sharpening
  • Edge detection
  • Color filtering
  • Color inversion
  • Redeye correction

(For more information on how to implement image processing algorithms in general, see the tutorial lessons beginning with Lesson 340 in the sectiontitled Multimedia Programming with Java on my web site .)

Using the getPixels, setPixels, and setPixel32 methods

I will explain how to use the getPixels , setPixels , and setPixel32 methods for modifying the pixels in a bitmap as shown by the middle image in Figure 1. Ifyou compare the middle image with the top image, you will see that two colored bars were added near the upper-left corner. In addition, colored borders wereadded to the middle image.

Color inversion

Finally, I will explain how to implement a color inversion algorithm as shown by the bottom image in Figure 1. If you compare the bottom image with the middleimage, you will see that the colors of all of the pixels in the top half of the bottom image have been changed. The colors of the pixels were changed using aparticular algorithm known widely as a color inversion algorithm.

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

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