IDirectDraw7 接口是在 Win32 API 的 DirectDraw 中定义的接口,用于进行 2D 图形渲染。这个接口提供了访问 DirectDraw 对象的方法,允许应用程序创建和管理图形表面以及执行与图形渲染相关的操作。

下面是 IDirectDraw7 接口的定义:
#undef INTERFACE
#define INTERFACE IDirectDraw7
DECLARE_INTERFACE_(IDirectDraw7, IUnknown) {
    // IUnknown methods
    STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE;
    STDMETHOD_(ULONG,AddRef) (THIS) PURE;
    STDMETHOD_(ULONG,Release) (THIS) PURE;

    // IDirectDraw methods
    STDMETHOD(Compact)(THIS) PURE;
    STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER*, IUnknown*) PURE;
    STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE*, IUnknown*) PURE;
    STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE7*, IUnknown*) PURE;
    STDMETHOD(DuplicateSurface)(THIS_ LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7*) PURE;
    STDMETHOD(EnumDisplayModes)(THIS_ DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2) PURE;
    STDMETHOD(EnumSurfaces)(THIS_ DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMSURFACESCALLBACK7) PURE;
    STDMETHOD(FlipToGDISurface)(THIS) PURE;
    STDMETHOD(GetCaps)(THIS_ LPDDCAPS, LPDDCAPS) PURE;
    STDMETHOD(GetDisplayMode)(THIS_ LPDDSURFACEDESC2) PURE;
    STDMETHOD(GetFourCCCodes)(THIS_ LPDWORD, LPDWORD) PURE;
    STDMETHOD(GetGDISurface)(THIS_ LPDIRECTDRAWSURFACE7*) PURE;
    STDMETHOD(GetMonitorFrequency)(THIS_ LPDWORD) PURE;
    STDMETHOD(GetScanLine)(THIS_ LPDWORD) PURE;
    STDMETHOD(GetVerticalBlankStatus)(THIS_ LPBOOL) PURE;
    STDMETHOD(Initialize)(THIS_ GUID*) PURE;
    STDMETHOD(RestoreDisplayMode)(THIS) PURE;
    STDMETHOD(SetCooperativeLevel)(THIS_ HWND, DWORD) PURE;
    STDMETHOD(SetDisplayMode)(THIS_ DWORD, DWORD, DWORD, DWORD, DWORD) PURE;
    STDMETHOD(WaitForVerticalBlank)(THIS_ DWORD, HANDLE) PURE;

    // IDirectDraw2 methods
    STDMETHOD(GetAvailableVidMem)(THIS_ LPDDSCAPS2, LPDWORD, LPDWORD) PURE;

    // IDirectDraw3 methods
    STDMETHOD(GetSurfaceFromDC)(THIS_ HDC, LPDIRECTDRAWSURFACE7*) PURE;
    STDMETHOD(RestoreAllSurfaces)(THIS) PURE;
    STDMETHOD(TestCooperativeLevel)(THIS) PURE;
    STDMETHOD(GetDeviceIdentifier)(THIS_ LPDDDEVICEIDENTIFIER2, DWORD) PURE;

    // IDirectDraw4 methods
    STDMETHOD(StartModeTest)(THIS_ LPSIZE, DWORD, DWORD) PURE;
    STDMETHOD(EvaluateMode)(THIS_ DWORD, DWORD*) PURE;

    // IDirectDraw7 methods
    STDMETHOD(EnumVidMem)(THIS_ LPDDENUMSURFACESCALLBACK7, LPVOID) PURE;
    STDMETHOD(EnumZBufferFormats)(THIS_ DWORD, LPDDPIXELFORMAT, LPDDENUMPIXELFORMATSCALLBACK) PURE;
    STDMETHOD(EvaluateDevice)(THIS_ DWORD*, LPEVALUATEDIDEVICEDATA) PURE;
};

这个接口包含了一系列方法,用于管理 DirectDraw 对象的状态、创建和管理表面、设置显示模式等。应用程序可以通过创建 IDirectDraw7 接口的实例来使用 DirectDraw 功能。常见的使用包括创建表面、加载纹理、进行渲染等。


转载请注明出处:http://www.zyzy.cn/article/detail/26534/Win32 API/Ddraw.h/IDirectDraw7