Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
GDI Classes for Size and Target Independent Drawing
Graphical applications may need to support zooming and drawing to different targets. Possible targets are the screen or a printer. Different targets may also mean different types of smartphones, with different screen sizes. The classes that support size independence are the same for each target :
3) Mgraphics- Device
These have to be implemented differently for the different targets. They are a part of the Graphics Device Interface (GDI). Application drawing code uses the functions and settings of the GDI classes.
The abstract base class created by a graphics device, CGraphicsDevice. Contains the main drawing functions. Provides the 'context' in which you are drawing to the associated device in the sense that it holds the pen and brush settings (e.g. color, line styles) and font settings (e.g. bold, underline, italic) for drawing, and also the clipping region(the visible drawing area). These can all be updated while drawing.
Deals with pixels of device-dependent size and uses fonts with device-dependent size and representation. The sizes and fonts to be passed to CGraphicsContext functions therefore need to be converted from size-independent units to size dependent units beforehand. This is done by an MGraphicsDeviceMap derived class. This may be a TZoomFactor or the CGraphicsDevice.
The abstract base class for both graphic devices and zoom factors. Defines the size-dependent functions in a graphics device. These functions convert between pixels and twips and perform font allocation and release. Font allocation involves finding the font supported by the device that is the closest to a deviceindependent font specification.
The abstract base class for all graphics devices that represents the medium being drawn to. Manufactures a graphics context suitable for drawing to itself (using CreateContext()), which takes into account the attributes of the device, such as the size and display mode. Allocates (and releases) fonts suitable for drawing to itself and converts between twips and pixels.
Important graphic devices are CScreenDevice,CBitmapDevice and CPrinterDevice.
Defines azoom factor and implements the MGraphicsDeviceMap interface. Allocates and releases device-dependent fonts and converts between twips and pixels.
Facilitates zooming, because it allows the size of the graphic to become independent of the target size.This class is recursive, because a TZoomFactor object can use an MGraphicsDeviceMap, which could be a TZoomFactor itself, as illustrated below. This allows a zoom factor object to contain another zoom factor object, multiplying the effect of the child zoom factor. The top-level zoom factor, however, uses a CGraphicsDevice (not another TZoomFactor).