03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

world colors mapped down onto black and white or low-fidelity color. The best approach for<br />

real-world colors is simply to allow the TDisplayMode mappings to do their thing.<br />

Note<br />

This nearest-color transformation is done before any other operation uses<br />

the color, including logical operations such as XOR. This can produce<br />

unexpected effects, but logical operations are in any case of dubious value<br />

on windowing systems – with the exception of XORing with KRgbWhite,<br />

which has its uses and will always work as expected.<br />

You'll see mentions of 'palettes' in some of the GDI definitions; these were<br />

added to the design before support for any form of color display was<br />

implemented (in Symbian OS v5). When color display mode support was<br />

added, not to use palettes to optimize (say) the shades available in a 256color<br />

display mode. Instead, we use the fixed Netscape color cube set, and<br />

that's it. This reduces the complexity of the API, loses no worthwhile features<br />

for devices in this class, and avoids the funnies you occasionally see (or<br />

remember seeing!) on Windows PCs when the palette was optimized for a<br />

foreground window while other visible windows' palettes went wild.<br />

Finally, you want the user to select a color, for example, in a drawing program. Some GUI's<br />

supply controls for this – in UIQ its CQikColorS-elector.<br />

15.2.5 Web Browsing<br />

Web browsing technology is often confused on the subjects of target and size<br />

independence. It has evolved without clear distinctions between print and on-screen<br />

graphics and without a consistent way of resizing. Text is specified in html – which is deviceindependent<br />

– while pictures (gifs, jpgs, or bmps) are specified in pixels. The physical size of<br />

the graphics will then vary depending on the resolution of the monitor/screen – they will be<br />

smaller for higher resolution monitor/screen displays. There is no clear relation between text<br />

sizes and graphics, which means they don't scale together on most browsers. However,<br />

there are ways around these problems and text and pictures scale together on Symbian OS<br />

browsers.<br />

15.3 The Developer's Quest for Device-independent Code<br />

It is not always worthwhile making your code target-independent. So, when should you make<br />

your drawing code device-independent and when don't you need to? There are two extreme<br />

cases in which the answer is quite clear:<br />

� If your code is designed exclusively for a screen-based UI, then it should not be targetindependent<br />

(though you may wish to build in size independence).<br />

� If your code is designed primarily for printing, with a screen-based UI for editing, then it<br />

should be device-independent.<br />

An application toolbar can be highly device-dependent, as can the menu and the dialogs<br />

(though some size independence in the latter case may be useful). On the other hand, a text<br />

view intended for a word processor should be highly device-independent; so too should a<br />

mapping program that might well be printer-oriented.<br />

15.3.1 Real Devices Intrude<br />

This answer is only a starting point, however, and there are many awkward, intermediate<br />

cases. You have to take the realities of the device into account, even when writing the most<br />

device-independent code.

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

Saved successfully!

Ooh no, something went wrong!