There are a number of ObjectWindows classes used to encapsulate GDI functionality.
Most are derived from the TGdiObject class. TGdiObject provides the common functionality for all ObjectWindows GDI classes.
TGdiObject is the abstract base class for ObjectWindows GDI objects. It provides a base destructor, an HGDIOBJ conversion operator, and the base GetObject function. It also provides orphan control for true GDI objects (that is, objects derived from TGdiObject; other GDI objects, such as TRegion, TIcon, and TDib, which are derived from TGdiBase, are known as pseudo-GDI objects).
The other classes in the ObjectWindows GDI encapsulation are:
- TDC is the root class for encapsulating ObjectWindows GDI device contexts. You can create a TDC object directly or–for more specialized behavior–you can use derived classes.
- TPen contains the functionality of Windows pen objects. You can construct a pen object from scratch or from an existing pen handle, pen object, or logical pen (LOGPEN) structure.
- TBrush contains the functionality of Windows brush objects. You can construct a custom brush, creating a solid, styled, or patterned brush, or you can use an existing brush handle, brush object, or logical brush (LOGBRUSH) structure.
- TFont lets you easily use Windows fonts. You can construct a font with custom specifications, or from an existing font handle, font object, or logical font (LOGFONT) structure.
- TPalette encapsulates a GDI palette. You can construct a new palette or use existing palettes from various color table types that are used by DIBs.
- TBitmap contains Windows bitmaps. You can construct a bitmap from many sources, including files, bitmap handles, application resources, and more.
- TRegion defines a region in a window. You can construct a region in numerous shapes, including rectangles, ellipses, and polygons. TRegion is a pseudo-GDI object; it is not derived from TGdiObject.
- TIcon encapsulates Windows icons. You can construct an icon from a resource or explicit information. TIcon is a pseudo-GDI object.
- TCursor encapsulates the Windows cursor. You can construct a cursor from a resource or explicit information.
- TDib encapsulates the device-independent bitmap (DIB) class. DIBs have no Windows handle; instead they are just a structure containing format and palette information and a collection of bits (pixels). This class provides a convenient way to work with DIBs like any other GDI object. A DIB is what is really inside a .BMP file, in bitmap resources, and what is put on the Clipboard as a DIB. TDib is a pseudo-GDI object.
See Also