DirectX SDK |
Multimedia software requires high-performance graphics. Through DirectDraw, Microsoft enables a much higher level of efficiency and speed in graphics-intensive applications for Windows than is possible with GDI, while maintaining device independence. DirectDraw provides tools to perform such key tasks as:
Additionally, DirectDraw enables you to query the display hardware's capabilities at run time, then provide the best performance possible given the host computer's hardware capabilities.
As with other DirectX components, DirectDraw uses the hardware to its greatest possible advantage, and provides software emulation for most features when hardware support is unavailable. Device independence is possible through use of the hardware abstraction layer, or HAL. For more information about the HAL, see the hardware abstraction layer.
The DirectDraw component provides services through COM-based interfaces. In the most recent iteration, these interfaces are IDirectDraw7, IDirectDrawSurface7, IDirectDrawPalette, IDirectDrawClipper, and IDirectDrawVideoPort. Note that, in addition to these interfaces, DirectDraw continues to support all previous versions. The DirectDraw component doesn't expose an IDirectDraw3, IDirectDraw5, or IDirectDraw6 interface, the interface versions skipped from IDirectDraw2 to IDirectDraw4 and then from IDirectDraw4 to IDirectDraw7.
For more information about COM concepts that you should understand to create applications with the DirectX APIs in the Platform SDK, see The Component Object Model.
The DirectDraw object represents the display adapter and exposes its methods through the IDirectDraw, IDirectDraw2, IDirectDraw4,and IDirectDraw7 interfaces. In most cases you will use the DirectDrawCreateEx function to create the newest iteration of a DirectDraw object, but you can also create one with the CoCreateInstance COM function. For more information, see Creating DirectDraw Objects by Using CoCreateInstance.
After creating a DirectDraw object, you can create surfaces for it by calling the IDirectDraw7::CreateSurface method. Surfaces represent the memory on the display hardware, but can exist on either video memory or system memory. DirectDraw extends support for palettes, clipping (useful for windowed applications), and video ports through its other interfaces.
The DirectDraw component provides services through classes in the DirectX for Visual Basic type library. In the most recent iteration, these classes are DirectDraw7, DirectDrawSurface7, DirectDrawPalette, DirectDrawClipper.
In addition, the type library provides objects used to enumerate drivers, modes and surfaces. These are DirectDrawEnum, DirectDrawEnumModes, and DirectDrawEnumSurfaces.
The DirectDraw object created from the DirectDraw7 class represents the display adapter. To create this object you will use the DirectDrawCreate method of the global DirectX7 object.
After creating a DirectDraw object, you can create surfaces for it by calling the DirectDraw7.CreateSurface method. Surfaces represent the memory on the display hardware, but can exist on either video memory or system memory. DirectDraw extends support for palettes, and clipping (useful for windowed applications) through its other interfaces.