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.

the region affected by the shadow. To maintain a shadow even when the window redraws,<br />

the window server executes the application's redraw command buffer twice:<br />

� Firstly, it uses a clipping region that excludes the shadowed part of the window and<br />

uses the BITGDI to draw using normal color mapping.<br />

� Secondly, it uses a clipping region for only the shadowed parts, and puts the GC it<br />

uses for BITGDI drawing into shadow mode.<br />

This causes the BITGDI to 'darken' all colors used for drawing in the affected region. The net<br />

result is that the drawing appears with shadows very nicely – without affecting the<br />

application's drawing code at all.<br />

Shadows are implemented in dialogs and the like by calling the AddWindowShadow()<br />

function in CEikonEnv:<br />

void CEikonEnv::AddWindowShadow(CCoeControl* aWinArea)<br />

{<br />

aWinArea->DrawableWindow()-<br />

>SetShadowHeight(LafEnv::ShadowHeight());<br />

}<br />

Shadow height is therefore dependent on the GUI customization.<br />

11.7.2 Backing Up Behind<br />

Backed-up-behind windows maintain a copy of the window behind them, so that when the<br />

backed-up-behind window is dismissed, the window behind can be redrawn by the window<br />

server without invoking application redraw code.<br />

This effect is used for menu panes: it speeds up the process of flicking from one menu pane<br />

to another immensely. It's also used for dialogs, where it speeds up dialog dismissal.<br />

When a backed-up-behind window is created, a big enough bitmap is allocated to backup<br />

the entire screen area that the window and its shadow are about to cover. The screen region<br />

is copied into this backup bitmap and then the window is displayed. When the window is<br />

dismissed, the backup bitmap is copied back onto the screen. The net effect is that the<br />

application doesn't have to redraw at all so that window dismissal is very quick.<br />

The backup-behind code is clever enough to update the backup bitmap when, for instance, a<br />

dialog is moved around the screen.<br />

The backup-behind code, however, is not an essential property of the window, but an<br />

optimization. So it gives up when it runs out of memory, when the window behind tries to<br />

redraw, or when another window with backup-behind property is placed in front of the<br />

existing one. Then an application redraw is needed, after all. This doesn't have any effect on<br />

application code – just on performance.<br />

11.7.3 Animation<br />

Sometimes, you want to do some drawing where timing is an essential feature of the visual<br />

effect. This isn't really something that fits well into the MVC paradigm, so we need special<br />

support for it.<br />

One kind of animation is used to give reassuring cues in the GUI.

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

Saved successfully!

Ooh no, something went wrong!