Dublin, Ireland
+353 87 41 86 742

Developer Diary 4: A good blt’er of inspiration

I've never owned an Atari ST, nor was I lucky enough to own an Amiga. - Instead I had an Amstrad 5086 it was an Intel 8086 8Mhz beast! I did however have some friends who owned Amigas and Atari STs and of course we would argue until the cows came home about who had the best machine. - Just in case your wondering, my PC never won. However in hindsight... I think I've done all right... where are all the Atari & Amiga machines now ? :-p

Why am I talking about old computers ? - Simple, graphics drawing. I need to draw graphics quickly on the screen to produce some of the effects I need.

For inspiration lets look at other systems or operating systems that provide great graphical effects. The three which come to mind are Linux with Compiz Fusion, Mac OS X, and Vista. As far as I understand these all use a very similar technique. They map on screen elements such as buttons, windows, and menus to graphical layers. These layers are stored within the 3D graphics accelerators memory. It's this chips which composites each of the elements together to display them on the screen. Because the layers are stored within the 3D chip the operating system can easily preform operations on them. Things like making a “layer” for instance a menu 50% transparent. Or rotating the layers in 3D space to give Vista like task switching, or Compiz like 3D cube rotations.

Back in the mobile phone world space things are similar, most of the high end mobile phones shipping now contain a graphics accelerator. The iPhone is one example, the Nokia N95 is another. Both of these devices have powerful graphics accelerators which are used for games and in the case of the iPhone also it's standard user interface.

Open GL is an API for 3D graphics programming, the API hides the graphics hardware which does all the hard work. Open GL was created by SGI many years ago. Open GLS is a cut down version of Open GL designed for less powerful devices. On the S60 side of the mobile world some devices such as the N95 expose access to the graphical accelerator via Open GLS, however Nokia's 'E' series of devices often do not ship with 3D chips. However all S60 mobile phones ship with some sort of graphical accelerator. If it's not 3D, then they provide 2D accelerators which allow quick drawing to the screen. My solution must work not just on the high end devices, but on all devices. So I can not make use of the 3D manipulation, but I can make use of fast 2D drawing.

Bit Blt
The 2D fast drawing is usually handled on the graphics chip via a function called “bit blt” or Bit Block Transfer. It's a fast way of copying graphics from memory and drawing them on the screen. This was invented back in the days of Xerox Parc, however one of the first home computers to make extensive use of BitBlt functionality was the Commodore Amiga.

On S60 access to hardware accelerated bitblt functionality is available on all phones. This lead me to think, “What if I could combine the 2D hardware acceleration with the idea of layers from the 3D graphics chips ?”. I could manage layers in software within the Venus graphics library, but have them drawn to the screen using the 2D acceleration. This would allow me to produce a range of graphic effects, on a wide range of S60 devices.

Taking the layer further
Each layer represents a graphical element, and would have set of common values, such as; Width, Height,  X, Y, Z, and an Alpha value. By manipulating these values and redrawing the screen I can produce animation effects, quickly and easily.

Now all I have to do is combine these graphical layers with my timeline based animation and I've got myself a graphics library. Bish, Bash, Bosh... job done. - If only life was that easy! -  At least I learnt something during the arguments with friends about who had the best computer.

No Comments Yet.

Leave a Reply