O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Applying Filters and Effects

To produce graphical effects, we can choose from the following wide range of tools provided by the BitmapData class:

colorTransform( )

Adjusts colors using a ColorTransform object, which provides a basic interface for simple color transformations. (For more complex control over color transformations, use the ColorMatrixFilter class.)

applyFilter( )

Modifies a bitmap using a preset filter effect such as drop shadow or blur. See the section "Applying Filters."

noise( )

Fills a bitmap with random color values in configurable ranges. Figure 26-9 shows an image generated by the noise( ) method.

A noise-filled bitmap

Figure 26-9. A noise-filled bitmap

perlinNoise( )

Fills a bitmap with a random organic-style pattern of color values. Figure 26-10 shows an image generated by the perlinNoise( ) method. The result of perlinNoise( ) is not normally used directly; it is typically combined with other filters to produce simulated waves, flames, clouds, water, wood grain, and landscapes. For a general discussion of Perlin noise, see Ken Perlin's introductory lecture at http://www.noisemachine.com/talk1. For an ActionScript example showing how to use perlinNoise( ) to create a wood texture, see http://www.connectedpixel.com/blog/texture/wood. For a marble texture, see http://www.connectedpixel.com/blog/texture/marble.

Figure 26-10. A Perlin-noise-filled bitmap

paletteMap( )

Replaces colors in an image ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required