03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

� introducing bitmap handling<br />

� more on font management<br />

� more on printing<br />

� color and display modes<br />

� web browsing.<br />

15.2.1 Blitting and Bitmaps<br />

These days, displays are fundamentally bitmap-oriented. Graphics primitives such as<br />

DrawLine() have to rasterize or render the line – that is, they must determine which<br />

pixels should be drawn in order to create a bitmap image that looks like the desired line.<br />

Rasterizing in the Symbian OS is the responsibility of the BITGDI, which implements all<br />

drawing functions specified by CGraphicsContext for drawing to onand offscreen<br />

bitmaps.<br />

Another approach to updating a bitmapped display is simply to blit to it: to copy a bitmap<br />

whose format is compatible with the format on the display. Blitting is extremely efficient if the<br />

source and destination bitmaps are of identical format.<br />

Any GUI worth its salt takes advantage of the efficiency of blitting to optimize certain<br />

operations:<br />

� On-screen icons are not rendered using drawing primitives, but pre- constructed in a<br />

paint program and blitted to screen when required.<br />

� Flicker-free screen redraws are performed by rendering to an offscreen bitmap<br />

(potentially slow), and then blitting to the screen when needed (usually quick). The<br />

offscreen bitmap is maintained by RBackedUp-Window, a class of the window server.<br />

This provides an aid to getting flicker-free fast redraws as whenever a redraw is<br />

required and the window contents haven't changed. The image can simply be blitted<br />

from the screen and not redrawn from scratch. Redrawing is done entirely from the<br />

backup bitmap.<br />

� Animation is a special case of flicker-free update that can be implemented using a<br />

sequence of blits, one for each image frame.<br />

� Screen fonts are blitted from the font bitmaps onto the screen (or offscreen bitmap).<br />

Blitting is great, but it isn't always the best thing to use.<br />

� Bitmaps use a lot of memory, so if you can construct a picture from a short sequence<br />

of drawing primitives, it's often more compact than storing the picture as a bitmap.<br />

� Bitmaps can't be scaled effectively: you lose information if you scale them down and<br />

they look chunky if you scale them up. Also, scaling is generally slow, which eliminates<br />

one of the major advantages of using bitmaps.<br />

� Bitmaps are fixed. You can only use them to store predrawn or precalculated pictures,<br />

or to cache calculated images for reuse over a short period of time.<br />

� Bitmaps are highly efficient for screens, but highly inefficient for printers, because they<br />

involve large data transfers over relatively slow links. They also involve scaling, but<br />

usually that's acceptable on printers because the scaling is to a size similar to that<br />

which would have been used for the bitmap on screen anyway.<br />

Here's a UML diagram of bitmap support classes in Symbian OS:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!