Using the advanced multimedia facilities of Series 60 to enable sound and graphics in your application
The multimedia architecture of Series 60 has been designed and optimized for mobile devices. While system resources may at times be constrained, the multimedia features available to developers are far from so, having a rich feature set more akin to a desktop computing environment. With relative ease the different components can be used for numerous tasks , ranging from drawing simple shape primitives to playing ring tones.
The media architecture has been updated for Series 60 2.x, and many related APIs have been deprecated. Although backward compatibility has been maintained where possible, the specific APIs for Series 60 2.x should generally be used when developing applications for Series 60 2.x devices. In this chapter, where APIs are platform specific, this will be clearly marked and both implementations will be discussed.
This chapter covers the following main topics:
Series 60 Graphics Architecture ” The three key components of the graphics architecture are the Window Server, Font and Bitmap Server and Multi Media Server. The role of each Server and the interaction between them is covered.
Basic Drawing ” All the essential APIs for any type of drawing application are included here, such as changing the brush type, the pen color and drawing lines. The screen coordinates and geometry are explained and the graphics context introduced.
Fonts and Text ” A number of fonts are available, and effects such as underlining can be applied.
Shapes ” Regular shapes including rectangles, ellipses and polygons can all be drawn easily with the Series 60 APIs. Arcs and pies can also be drawn.
Bitmaps ” APIs are provided for the loading and manipulation of bitmaps for display in your application. The technique of bitmap masking, which is important for good bitmap presentation, is also explained here.
Animation ” This section describes the animation architecture, and techniques that help to produce smooth animations, such as using off-screen bitmaps, and double buffering. The Direct Screen Access Framework, which is particularly useful for fast animation games programming, is also introduced.
Image Manipulation ” Images can be easily rotated and scaled, and APIs are available to convert between image types.
Audio ” This section concentrates on adding sound to your application. Both recording sound and playing sound are covered.
The following example applications accompany this chapter in order to illustrate the functionality discussed:
BasicDrawing ” A simple application that draws different types of colored line across the screen.
FontsAndText ” An application that renders text and manages fonts.
Shapes ” Draws bar charts, pie charts, and line charts to represent a particular data set, illustrating how to draw many common shapes such as rectangles and circles.
Bitmap ” An application to show you how to use bitmaps.
Animation ” Demonstrates a basic animation sequence.
ClientAnimation ” Shows you how to perform double-buffered animation.
Skiing ” A simple skiing game that demonstrates the use of the Direct Screen Access Framework.
ImageManip ” An application that allows an image to be rotated, scaled, and converted into a different image format.
MultiMediaF ” A Series 60 2. x-specific version of ImageManip that uses the Multi Media Framework.
AnsPhone ” An application to record and play back telephone messages.
AudioPlayer ” An application that can play simple tones or streamed audio data.
It is desirable that you have a basic comprehension of computer graphics before reading this chapter. From a Series 60 standpoint, a basic appreciation of the Series 60 Application Framework, as covered in Chapter 4, is also desirable ”not necessarily for understanding the concepts presented here, but more for being aware of the presence of certain classes within the example applications.
The implementations of some APIs are asynchronous in nature, and so it is recommended that you read the Using Asynchronous Services with Active Objects section of Chapter 3 before trying to use such APIs. This will also help you understand why certain functions work the way they do.