Online Book Reader

Home Category

Developing Android Applications with Adobe AIR [81]

By Root 2534 0
applications.

Some Definitions


Let’s go over some terms that are often used but rarely explained.

The CPU (central processing unit) carries out instructions on a computer program. The clock rate on mobile devices varies from 550 MHz to 1.5 GHz.

The GPU (graphics processing unit) is a high-performance microprocessor dedicated to manipulating computer graphics. It performs geometric calculations faster than drawing directly to the screen when using the CPU. Its efficiency is measured by how many millions of triangles are processed per second (mt/s). On mobile devices, GPU efficiency ranges from 7 mt/s to more than 28 mt/s. Another important factor is the fill rate, measured in megapixels.

OpenGL ES 2, a subset of the OpenGL standard, is an open source low-level interface between software and graphics acceleration. It was designed for mobile devices, and is supported on the Android platform for Froyo and later versions, the iPhone 3GS and later versions, the iPod, and various Samsung and Nokia devices.

The buffer is a region in memory that holds temporary data before it is moved to another location.

Rasterization is the process of taking a vector graphic (primitives or mathematical values such as points, lines, and curves) and converting it to a raster image (a data structure made of pixels). In our context, it just refers to drawing pixels, even if it is just copying them from one place to another.

Scene compositing is the process of creating a scene out of multiple pixel buffers, or textures. The scene is reorganized as elements move around. It is sometimes called surface compositing.

A pixel is the smallest screen element in a raster image. Vector graphics render with subpixel precision to prevent aliasing.

A transformation matrix is a rectangular array of numbers. It is used to store the display object’s presentation properties. We will cover this topic in detail in this chapter.

A display tree is a data structure that organizes elements in a hierarchical fashion. A display list is a tree structure made of display objects. The stage is the top element. Its children, also called nodes, are different types of display objects, some of which are containers that can also have one or more children. Being aware of the objects’ relationship is essential to your success in using hardware acceleration. We will discuss this further in this chapter.

Rendering, or How Things Are Drawn to the Screen

As a developer, you trust that an object is represented as your code intended. From your ActionScript commands to the matching pixels appearing on the screen, a lot is done behind the screens.

To better understand Flash Player and AIR for Android rendering, I recommend watching the MAX 2010 presentations “Deep Dive Into Flash Player Rendering” by Lee Thomason and “Developing Well-Behaved Mobile Applications For Adobe AIR” by David Knight and Renaun Erickson. You can find them at http://tv.adobe.com.

Flash is a frame-based system. The code execution happens first, followed by the rendering phase. The concept of the elastic racetrack describes this ongoing process whereby one phase must end before the other one begins, and so on.

The current rendering process for Flash Player and the AIR runtime comprises four steps, outlined in the subsections that follow. Annotations regarding Enhanced Caching/GPU Model indicate the process, if different, for AIR for Android using cacheAsBitmapMatrix and GPU rendering.

Computation


Traditional and Enhanced Caching/GPU Model

The renderer, qualified as retained, traverses the display list and keeps a state of all objects. It looks at each object matrix and determines its presentation properties. When a change occurs, it records it and defines the dirty region, areas that have changed, and the objects that need to be redrawn, to narrow down changes to a smaller area. It then concatenates matrices, computes all the transformations, and defines the new state.

Edge and Color Creation


Traditional Model

This step is the most challenging mathematically. It applies to vector

Return Main Page Previous Page Next Page

®Online Book Reader