The Symbian OS (779886), страница 44
Текст из файла (страница 44)
Printerdrivers are not device drivers in the standard sense of controlling physicalMULTIMEDIA AND GRAPHICS SERVICES BLOCK185hardware; rather they are printer-driver information files that providetranslations from device-independent bitmap-based graphics descriptionsto printer page descriptions. More precisely, a printer driver implementsthe GDI-defined bitmapped device abstraction and is a DLL plug-in tothe framework. Printer ports are virtualized over the available devicehardware, typically serial or short link. As well as loading driver plug-ins,Printer Driver Support creates printer driver lists.
WYSIWYG printingsupport is considered legacy functionality for a modern phone. (See theearlier discussion of application-level support for printing, for example,based on Bluetooth profiles.)The close coupling of drawing and printing and the inclusion of supportfor line breaking and margin calculation alongside polygon and ellipserasterization among the Bit GDI primitives shows the legacy of the earlyimplementation of Symbian OS. For example, on a modern phone, fastrendering of games and smooth rendering of streamed video on a devicewhere many other things may be going on (calls being received, musicbeing played, and so on) is more relevant than margin calculation foroffice-style documents.Graphics Contexts and Color PalettesThe lowest layer of the graphics system provides the abstract interface tothe device hardware (the physical interface is managed by the logical andphysical device drivers in the Kernel Services and Hardware Interfacelayer).The GDI abstracts the physical graphics device (a bitmap displayor raster device) as a Device Context containing settable drawing andfont properties (pen and brush settings for line styles, character andfont information and metrics), all drawing methods (for lines, polygons,circles, rectangles, as well as text and bitmaps), and the clipping regiondefining the drawable rectangle.Since GDI pixels and font metrics are device dependent, methods areprovided to map from twips values (Symbian OS device-independentunits)3 to pixels and to zoom fonts by a specified zoom factor.Text rendering supports bi-directional text, that is, both right-to-left andleft-to-right as well as mixed text, and line-breaking algorithms.
GDI alsomanages color value, handling mapping RGB values into display-modecolor spaces.The Color Palette supports color-array handling and conversionbetween RGB values and palette indices, and supports dynamic palettes,that is, color palettes may be supplied by external classes, allowingclients to control the palette capabilities depending on the availabledevice hardware.3A twip is a decimal variant of a typographical point. A point is 1/72 of an inch; a twipis 1/20 of an inch.186THE OS SERVICES LAYERFont metrics and selection (matching a device-specific font to thefont request) were significantly improved in Symbian OS v9 to supporthigher-resolution screens and to better support screens with non-squarepixels. Calculation algorithms for font metrics (ascender and descendersizes, capital heights, etc.) were added and there are methods that offerchoices based on maximum height to guarantee that the supplied font fitsthe given screen space.Graphics ArchitectureAt the heart of the graphics architecture are the Window Server, theBit GDI and the GDI components.
Together they provide the servicesrequired to write to bitmapped physical displays from within a systemor application graphics context and support the windowing abstractionsthat allow multiple clients to independently manipulate the display.The Window Server abstracts the key ideas of event-driven programming for graphical applications and applies object-oriented designprinciples (and native idioms of the operating system, for example, activeobjects) to provide a straightforward programming model for nativeapplications.From an application perspective, a window is a secondary object that iscreated from the application view (the top-level application control; everyapplication needs at least one control that owns or controls a window,that is a view).
Once associated with a view by a Set() operation,a window is abstracted to the top-level graphics context in which allsubsequent drawing, clipping and similar operations are performed.While the graphical architecture of Symbian OS is central to the userinteraction and application model, so that, in effect, nothing can happenon a device (from a user perspective at least) without the involvement ofthe Window Server, from a system perspective graphics is well isolatedfrom the kernel and the basic system services. Thus to implement abase port, a text-only version of the Window Server and a Text Shellreplace the complete graphics infrastructure with a simple event handlerand a console shell.
The resulting bare-bones system has no applicationsupport, communications or other ‘higher’ services but, from a kernelperspective, it is fully functioning.The graphics system therefore is (from the kernel perspective) justanother user-side process; it runs user-side (i.e., in non-privileged mode)and uses the standard machinery of client–server inter-process communications to communicate both with the kernel (which is a server and towhich it is a user-side client) and with its own clients.The newer additions in the graphics area, for example, vector fontsand the OpenGL ES interface, as well as the Multimedia Framework itself,build on top of the basic window and graphics system.MULTIMEDIA AND GRAPHICS SERVICES BLOCK187Component CollectionsMultimedia CollectionThis framework defines application-level APIs for multimedia supportof all kinds and provides a number of standard implementations asframework plug-ins.Table 8.3 Multimedia ComponentsComponent NameDevelopment NameMultimedia FrameworkMMF, COMMONMultimedia Framework Plug-insMMFAUDIOCONTROLLER,MMFRAWFORMAT, MMFAUFORMATImage Conversion LibraryICL, ICL IMAGEDISPLAY,IMAGETRANSFORMImage Conversion LibraryPlug-insICL GIFSCALERCameraECAMBroadcast TunerTUNER• The Multimedia Framework component provides a high-level extensible framework for multimedia support of all kinds, providing clientutilities for common tasks, for example audio, tone, video, and MIDIplayback and recording, as well as speech recognition.
The framework is designed to accept controller plug-ins, which in turn providethe interface to lower level plug-ins (supplied by the Media DeviceFramework, see Chapter 10) that interface to hardware and provideacceleration APIs.• The Multimedia Framework Plug-ins component provides controllerplug-ins to the framework; reference controllers are supplied forstandard audio formats.MultimediaMultimediaFrmwk.MultimediaFrmwk.PluginsImageConv.LibraryImageConv.LibraryPluginsCameraFigure 8.10 Multimedia componentsBroadcastTuner188THE OS SERVICES LAYER• The Image Conversion Library component provides an extensibleframework for integrating still-image conversion codecs into the Multimedia Framework.
It recognizes picture file formats by providing aMIME-type recognizer plug-in to the MIME Recognizer Framework.• The Image Conversion Library Plug-ins component provides defaultreference codecs for common still-image formats including GIF, JPEG,PNG, BMP and MBM.• The Camera component provides an implementation for an onboardcamera, allowing a camera object to be created and controlled andimagery data to be requested and received from it.• The Broadcast Tuner component provides an implementation for anintegrated broadcast tuner.OpenGL ES CollectionThese components comprise a framework supporting the OpenGL ES2D- and 3D-graphics standard.
OpenGL ES provides multi-client accessto screen, keyboard, and pointer or digitizer for GUI applications andincludes a keyclick reference plug-in that produces key or pointer clicks.Table 8.4 OpenGL ES ComponentsComponent NameDevelopment NameOpenGL ES HeadersOPENGLSHEADERSOpenGL ES Display PropertiesOPENGLESDISPLAYPROPERTYOpenGL ESOPENGLES9.X• The OpenGL ES Headers component provides standard OpenGL ESheaders and binary definition files to encourage compatibility betweenOpenGL ES implementations for Symbian OS.
The headers bind theOpenGL ES API to the underlying graphics model and support aplug-in renderer implementation.OpenGL ESOpenGLESHeadersOpenGLESDisplayPropts.OpenGLESFigure 8.11 OpenGL ES componentsMULTIMEDIA AND GRAPHICS SERVICES BLOCK189• The OpenGL ES Display Properties component encapsulates displaydrawing properties (e.g. display rectangles and clipping regions),enabling window surface access, that is, drawing, to clients fromthreads that do not own a window.• The OpenGL ES component provides a reference implementation ofan OpenGL ES renderer implemented as a plug-in, which is replacedby licensees.Windowing Framework CollectionThe Window Server owns and manages access to the screen as a drawableresource, which is made available to applications through the abstractionof windowed screen areas.
It also provides access to the keyboard andpointer or digitizer for GUI applications, including the keyclick referenceplug-in that produces key or pointer clicks.Table 8.5 Windowing Framework ComponentsComponent NameDevelopment NameWindow ServerWSERV8.1Windows are at the top of the abstraction hierarchy for screen elements;all applications must own (or control) a window in order to display orto receive events. The Window Server receives and interprets events onbehalf of applications, as well as generating events based on receivedapplication events (focus events, for example).Graphics and Printing Services CollectionThese components support all bitmapped graphics operations on displayand printer devices, including all font and drawing operations. Theprincipal components are the Font and Bitmap Server, through which alloperations are made within a client-side server session to a bitmappedWindowingFrameworkWindowServerFigure 8.12Windowing Framework components190THE OS SERVICES LAYERGraphics & Printing ServicesBitGDITextShaperPluginFont &Bitmp.ServerFontStoreFreeTypeFontRster.ReferenceFontsPrinterDriverSupportPrinterDriversFigure 8.13 Graphics and Printing Services componentsTable 8.6 Graphics and Printing Services ComponentsComponent NameDevelopment NameFont and Bitmap ServerFBSERVText Shaper Plug-inICULAYOUTENGINEBit GDIBIT GDIFont StoreFNTSTOREFreeType Font RasterizerFREETYPEReference FontsFONTSPrinter Driver SupportPDRSTOREPrinter DriversPRINTDRVgraphics context, and the Bit GDI, which implements the bitmappedgraphics context abstraction.• The Font and Bitmap Server owns all bitmapped graphics devicesand provides the framework for other graphics components.