Rendering in actionscript

From Gnash Project Wiki

Jump to: navigation, search

SWF8 introduced a range of functions that integrate the rendering process into actionscript. This page describes the various ways this is done and the state of Gnash's implementation.



The BitmapData class offers a simple array of pixels that may be attached to a MovieClip and rendered. The BitmapData object has many functions for manipulating these pixels, including editing individual pixels, adding fills, noise, and similar processes. Gnash can currently draw the BitmapData and perform various functions on the data.

The current implementation stores pixels as 32-bit values and converts to an RGBA-packed byte array (ImageRGBA) when a change is made. This is probably more efficient for AS manipulations, but the conversion represents a possible bottleneck. Profiling is necessary before a final decision is made on the implementation. Also, the renderer interface for BitmapData.draw() (see following) should be taken into account.

The most widely-used function, BitmapData.draw(), draws a whole MovieClip to a BitmapData, allowing it to be displayed and manipulated as a Bitmap. This is not implemented in Gnash.

Blend modes

Displaying a DisplayObject with a blend mode is possible in Flash. Gnash already has the structures in libcore for setting and querying the current blend mode, but there is no renderer support.


Adding custom, AS-defined and SWF-defined filters is possible. This is not implemented in Gnash, although the Filter classes have a basic implementation, sometimes correct, sometimes not.


It should be possible to cache MovieClips (and possibly other DisplayObjects) as a bitmap. Gnash does not currently implement this.

Scroll area

The ability to set part of a DisplayObject as a scroll area is missing in Gnash.

9-area scaling

The ability to scale using a scaling rectangle is absent in Gnash.