适于fasm的DirectDraw头文件定义

本文详细介绍了如何为fasm编写适用于DirectDraw的头文件定义,内容包括ddraw.inc的创建过程和关键代码段,帮助读者理解如何在fasm中使用DirectDraw进行图形编程。
摘要由CSDN通过智能技术生成

接上两节,可以将ddraw.h定义为ddraw.inc,如下:

;==========================================================================
; *
; *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
; *
; *  File:       ddraw.h
; *  Content:    DirectDraw include file [typedef macro by G-Spider @2013]  
; *
; **************************************************************************
macro DEFINE_GUID def 
{ 
    match comid=,d1=,d2=,d3=,d4, def 
    \{ 
        comid:
        .Data1 dd d1 
        .Data2 dw d2 
        .Data3 dw d3 
        .Data4 db d4 
    \} 
} 
; --for example--:
; DEFINE_GUID < CLSID_DirectDraw,            0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 >
; DEFINE_GUID < CLSID_DirectDraw7,           0x3c305196,0x50db,0x11d3,0x9c,0xfe,0x00,0xc0,0x4f,0xd9,0x30,0xc5 >
; DEFINE_GUID < CLSID_DirectDrawClipper,     0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 >
; DEFINE_GUID < IID_IDirectDraw,             0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 >
; DEFINE_GUID < IID_IDirectDraw2,            0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 >
; DEFINE_GUID < IID_IDirectDraw4,            0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 >
; DEFINE_GUID < IID_IDirectDraw7,            0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b >
; DEFINE_GUID < IID_IDirectDrawSurface,      0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 >
; DEFINE_GUID < IID_IDirectDrawSurface2,     0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 >
; DEFINE_GUID < IID_IDirectDrawSurface3,     0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB >
; DEFINE_GUID < IID_IDirectDrawSurface4,     0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B >
; DEFINE_GUID < IID_IDirectDrawSurface7,     0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b >
; DEFINE_GUID < IID_IDirectDrawPalette,      0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 >
; DEFINE_GUID < IID_IDirectDrawClipper,      0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 >
; DEFINE_GUID < IID_IDirectDrawColorControl, 0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 >
; DEFINE_GUID < IID_IDirectDrawGammaControl, 0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E >

; DirectDraw interface

interface DirectDraw,\
	    QueryInterface,\
	    AddRef,\
	    Release,\
	    Compact,\
	    CreateClipper,\
	    CreatePalette,\
	    CreateSurface,\
	    DuplicateSurface,\
	    EnumDisplayModes,\
	    EnumSurfaces,\
	    FlipToGDISurface,\
	    GetCaps,\
	    GetDisplayMode,\
	    GetFourCCCodes,\
	    GetGDISurface,\
	    GetMonitorFrequency,\
	    GetScanLine,\
	    GetVerticalBlankStatus,\
	    Initialize,\
	    RestoreDisplayMode,\
	    SetCooperativeLevel,\
	    SetDisplayMode,\
	    WaitForVerticalBlank,\
	    GetAvailableVidMem,\
	    GetSurfaceFromDC,\
	    RestoreAllSurfaces,\
	    TestCooperativeLevel,\
	    GetDeviceIdentifier,\
	    StartModeTest,\
	    EvaluateMode

interface DirectDrawSurface,\
	    QueryInterface,\
	    AddRef,\
	    Release,\
	    AddAttachedSurface,\
	    AddOverlayDirtyRect,\
	    Blt,\
	    BltBatch,\
	    BltFast,\
	    DeleteAttachedSurface,\
	    EnumAttachedSurfaces,\
	    EnumOverlayZOrders,\
	    Flip,\
	    GetAttachedSurface,\
	    GetBltStatus,\
	    GetCaps,\
	    GetClipper,\
	    GetColorKey,\
	    GetDC,\
	    GetFlipStatus,\
	    GetOverlayPosition,\
	    GetPalette,\
	    GetPixelFormat,\
	    GetSurfaceDesc,\
	    Initialize,\
	    IsLost,\
	    Lock,\
	    ReleaseDC,\
	    Restore,\
	    SetClipper,\
	    SetColorKey,\
	    SetOverlayPosition,\
	    SetPalette,\
	    Unlock,\
	    UpdateOverlay,\
	    UpdateOverlayDisplay,\
	    UpdateOverlayZOrder,\
	    GetDDInterface,\
	    PageLock,\
	    PageUnlock,\
	    SetSurfaceDesc,\
	    SetPrivateData,\
	    GetPrivateData,\
	    FreePrivateData,\
	    GetUniquenessValue,\
	    ChangeUniquenessValue,\
	    SetPriority,\
	    GetPriority,\
	    SetLOD,\
	    GetLOD

interface DirectDrawPalette,\
	    QueryInterface,\
	    AddRef,\
	    Release,\
	    GetCaps,\
	    GetEntries,\
	    Initialize,\
	    SetEntries

interface DirectDrawClipper,\
	    QueryInterface,\
	    AddRef,\
	    Release,\
	    GetClipList,\
	    GetHWnd,\
	    Initialize,\
	    IsClipListChanged,\
	    SetClipList,\
	    SetHWnd

interface DirectDrawColorControl,\
	    QueryInterface,\
	    AddRef,\
	    Release,\
	    GetColorControls,\
	    SetColorControls

interface DirectDrawGammaControl,\
	    QueryInterface,\
	    AddRef,\
	    Release,\
	    GetGammaRamp,\
	    SetGammaRamp


struct GUID
    Data1     DWORD
    Data2     WORD
    Data3     WORD
    Data4     BYTE 8 dup(?)
ends

struct DDARGB
    blue  BYTE
    green BYTE
    red   BYTE
    alpha BYTE
ends

struct DDRGBA
    red   BYTE
    green BYTE
    blue  BYTE
    alpha BYTE
ends

struct DDCOLORKEY
    dwColorSpaceLowValue  DWORD
    dwColorSpaceHighValue DWORD
ends

struct DDBLTFX
    dwSize                  DWORD
    dwDDFX                  DWORD
    dwROP                   DWORD
    dwDDROP                 DWORD
    dwRotationAngle         DWORD
    dwZBufferOpCode         DWORD
    dwZBufferLow            DWORD
    dwZBufferHigh           DWORD
    dwZBufferBaseDest       DWORD
    dwZDestConstBitDepth    DWORD
    union
    
        dwZDestConst        DWORD
        lpDDSZBufferDest    PVOID
    ends
    dwZSrcConstBitDepth     DWORD
    union
    
        dwZSrcConst         DWORD
        lpDDSZBufferSrc     PVOID
    ends
    dwAlphaEdgeBlendBitDepth    DWORD
    dwAlphaEdgeBlend            DWORD
    dwReserved                  DWORD
    dwAlphaDestConstBitDepth    DWORD
    union
    
        dwAlphaDestConst    DWORD
        lpDDSAlphaDest      PVOID
    ends
    dwAlphaSrcConstBitDepth DWORD
    union
    
        dwAlphaSrcConst     DWORD
        lpDDSAlphaSrc       PVOID
    ends
    union
        dwFillColor         DWORD
        dwFillDepth         DWORD
        dwFillPixel         DWORD
        lpDDSPattern        PVOID
    ends
    ddckDestColorkey        DDCOLORKEY
    ddckSrcColorkey         DDCOLORKEY
ends

struct DDSCAPS
  dwCaps    DWORD
ends

struct DDOSCAPS
    dwCaps  DWORD
ends

struct DDSCAPSEX
    dwCaps2 DWORD
    dwCaps3 DWORD
    union
    
        dwCaps4         DWORD
        dwVolumeDepth   DWORD
    ends
ends

struct DDSCAPS2 
  dwCaps    DWORD
  dwCaps2   DWORD
  dwCaps3   DWORD
  union 
    dwCaps4         DWORD
    dwVolumeDepth   DWORD
  ends
ends

DD_ROP_SPACE = 8

struct DDCAPS
        dwSize                      DWORD
        dwCaps                      DWORD
        dwCaps2                     DWORD
        dwCKeyCaps                  DWORD
        dwFXCaps                    DWORD
        dwFXAlphaCaps               DWORD
        dwPalCaps                   DWORD
        dwSVCaps                    DWORD
        dwAlphaBltConstBitDepths    DWORD
        dwAlphaBltPixelBitDepths    DWORD
        dwAlphaBltSurfaceBitDepths  DWORD
        dwAlphaOverlayConstBitDepths    DWORD
        dwAlphaOverlayPixelBitDepths    DWORD
        dwAlphaOverlaySurfaceBitDepths  DWORD
        dwZBufferBitDepths          DWORD
        dwVidMemTotal               DWORD
        dwVidMemFree                DWORD
        dwMaxVisibleOverlays        DWORD
        dwCurrVisibleOverlays       DWORD
        dwNumFourCCCodes            DWORD
        dwAlignBoundarySrc          DWORD
        dwAlignSizeSrc              DWORD
        dwAlignBoundaryDest         DWORD
        dwAlignSizeDest             DWORD
        dwAlignStrideAlign          DWORD
        dwRops                      DWORD DD_ROP_SPACE dup(?)
        ddsOldCaps                  DDSCAPS
        dwMinOverlayStretch         DWORD
        dwMaxOverlayStretch         DWORD
        dwMinLiveVideoStretch       DWORD
        dwMaxLiveVideoStretch       DWORD
        dwMinHwCodecStretch         DWORD
        dwMaxHwCodecStretch         DWORD
        dwReserved1                 DWORD
        dwReserved2                 DWORD
        dwReserved3                 DWORD
        dwSVBCaps                   DWORD
        dwSVBCKeyCaps               DWORD
        dwSVBFXCaps                 DWORD
        dwSVBRops                   DWORD DD_ROP_SPACE dup(?)
        dwVSBCaps                   DWORD
        dwVSBCKeyCaps               DWORD
        dwVSBFXCaps                 DWORD
        dwVSBRops                   DWORD DD_ROP_SPACE dup(?)
        dwSSBCaps                   DWORD
        dwSSBCKeyCaps               DWORD
        dwSSBFXCaps                 DWORD
        dwSSBRops                   DWORD DD_ROP_SPACE dup(?)
        dwMaxVideoPorts             DWORD
        dwCurrVideoPorts            DWORD
        dwSVBCaps2                  DWORD
        dwNLVBCaps                  DWORD
        dwNLVBCaps2                 DWORD
        dwNLVBCKeyCaps              DWORD
        dwNLVBFXCaps                DWORD
        dwNLVBRops                  DWORD DD_ROP_SPACE dup(?)
;  Members added for DX6 release
        ddsCaps                     DDSCAPS2
ends

struct DDPIXELFORMAT
    dwSize          DWORD
    dwFlags         DWORD
    dwFourCC        DWORD
    union
    
        dwRGBBitCount           DWORD
        dwYUVBitCount           DWORD
        dwZBufferBitDepth       DWORD
        dwAlphaBitDepth         DWORD
        dwLuminanceBitCount     DWORD
        dwBumpBitCount          DWORD
        dwPrivateFormatBitCount DWORD
    ends
    union
    
        dwRBitMask          DWORD
        dwYBitMask          DWORD
        dwStencilBitDepth   DWORD
        dwLuminanceBitMask  DWORD
        dwBumpDuBitMask     DWORD
        dwOperations        DWORD
    ends
    union
    
        dwGBitMask      DWORD
        dwUBitMask      DWORD
        dwZBitMask      DWORD
        dwBumpDvBitMask DWORD
    ends
    union
    
        dwBBitMask              DWORD
        dwVBitMask              DWORD
        dwStencilBitMask        DWORD
        dwBumpLuminanceBitMask  DWORD
    ends
    union
    
        dwRGBAlphaBitMask       DWORD
        dwYUVAlphaBitMask       DWORD
        dwLuminanceAlphaBitMask DWORD
        dwRGBZBitMask           DWORD
        dwYUVZBitMask           DWORD
    ends
ends

struct DDOVERLAYFX
    dwSize                      DWORD
    dwAlphaEdgeBlendBitDepth    DWORD
    dwAlphaEdgeBlend            DWORD
    dwReserved                  DWORD
    dwAlphaDestConstBitDepth    DWORD
    union
    
        dwAlphaDestConst        DWORD
        lpDDSAlphaDest          PVOID
    ends
    dwAlphaSrcConstBitDepth     DWORD
    union
    
        dwAlphaSrcConst         DWORD
        lpDDSAlphaSrc           PVOID
    ends
    dckDestColorkey             DDCOLORKEY
    dckSrcColorkey              DDCOLORKEY
    dwDDFX                      DWORD
    dwFlags                     DWORD
ends

struct DDBLTBATCH
    lprDest     PVOID
    lpDDSSrc    PVOID
    lprSrc      PVOID
    dwFlags     DWORD
    lpDDBltFx   PVOID
ends
struct DDGAMMARAMP
    red         WORD 256 dup(?)
    green       WORD 256 dup(?)
    blue        WORD 256 dup(?)
ends

struct LARGE_INTEGER
    union 
        struct 
            LowPart     DWORD
            HighPart    LONG
        ends
        QuadPart        LONGLONG
    ends
ends

MAX_DDDEVICEID_STRING = 512

struct DDDEVICEIDENTIFIER
    szDriver            BYTE MAX_DDDEVICEID_STRING dup(?)
    szDescription       BYTE MAX_DDDEVICEID_STRING dup(?)
    liDriverVersion     LARGE_INTEGER
    dwVendorId          DWORD
    dwDeviceId          DWORD
    dwSubSysId          DWORD
    dwRevision          DWORD
    guidDeviceIdentifier GUID
ends

struct DDDEVICEIDENTIFIER2
    szDriver            BYTE MAX_DDDEVICEID_STRING dup(?)
    szDescription       BYTE MAX_DDDEVICEID_STRING dup(?)
    liDriverVersion     LARGE_INTEGER
    dwVendorId          DWORD
    dwDeviceId          DWORD
    dwSubSysId          DWORD
    dwRevision          DWORD
    guidDeviceIdentifier GUID
    dwWHQLLevel         DWORD
ends

struct DDSURFACEDESC
    dwSize              DWORD
    dwFlags             DWORD
    dwHeight            DWORD
    dwWidth             DWORD
    union
    
        lPitch          LONG
        dwLinearSize    DWORD
    ends
    union
    
        dwBackBufferCount DWORD
        dwDepth         DWORD
    ends
    union
        dwZBufferBitDepth DWORD
        dwMipMapCount   DWORD
        dwRefreshRate   DWORD
        dwSrcVBHandle   DWORD
    ends
    dwAlphaBitDepth     DWORD
    dwReserved          DWORD
    lpSurface           PVOID
    union
    
        ddckCKDestOverlay   DDCOLORKEY
        dwEmptyFaceColor    DWORD
    ends
    ddckCKDestBlt       DDCOLORKEY
    ddckCKSrcOverlay    DDCOLORKEY
    ddckCKSrcBlt        DDCOLORKEY
    union
    
        ddpfPixelFormat DDPIXELFORMAT
        dwFVF           DWORD
    ends
    ddsCaps             DDSCAPS
ends

struct DDSURFACEDESC2
    dwSize              DWORD
    dwFlags             DWORD
    dwHeight            DWORD
    dwWidth             DWORD
    union
    
        lPitch          LONG
        dwLinearSize    DWORD
    ends
    union
    
        dwBackBufferCount DWORD
        dwDepth         DWORD
    ends
    union
        dwZBufferBitDepth DWORD
        dwMipMapCount   DWORD
        dwRefreshRate   DWORD
        dwSrcVBHandle   DWORD
    ends
    dwAlphaBitDepth     DWORD
    dwReserved          DWORD
    lpSurface           PVOID
    union
    
        ddckCKDestOverlay   DDCOLORKEY
        dwEmptyFaceColor    DWORD
    ends
    ddckCKDestBlt       DDCOLORKEY
    ddckCKSrcOverlay    DDCOLORKEY
    ddckCKSrcBlt        DDCOLORKEY
    union
    
        ddpfPixelFormat DDPIXELFORMAT
        dwFVF           DWORD
    ends
    ddsCaps             DDSCAPS2
    dwTextureStage      DWORD
ends

; ddsCaps field is valid.
DDSD_CAPS               =0x00000001
; dwHeight field is valid.
DDSD_HEIGHT             =0x00000002
; dwWidth field is valid.
DDSD_WIDTH              =0x00000004
; lPitch is valid.
DDSD_PITCH              =0x00000008
; dwBackBufferCount is valid.
DDSD_BACKBUFFERCOUNT    =0x00000020
; dwZBufferBitDepth is valid.  (shouldnt be used in DDSURFACEDESC2)
DDSD_ZBUFFERBITDEPTH    =0x00000040
; dwAlphaBitDepth is valid.
DDSD_ALPHABITDEPTH      =0x00000080
; lpSurface is valid.
DDSD_LPSURFACE          =0x00000800
; ddpfPixelFormat is valid.
DDSD_PIXELFORMAT        =0x00001000
; ddckCKDestOverlay is valid.
DDSD_CKDESTOVERLAY      =0x00002000
; ddckCKDestBlt is valid.
DDSD_CKDESTBLT          =0x00004000
; ddckCKSrcOverlay is valid.
DDSD_CKSRCOVERLAY       =0x00008000
; ddckCKSrcBlt is valid.
DDSD_CKSRCBLT           =0x00010000
; dwMipMapCount is valid.
DDSD_MIPMAPCOUNT        =0x00020000
 
 ; dwRefreshRate is valid
 
DDSD_REFRESHRATE        =0x00040000
; dwLinearSize is valid
DDSD_LINEARSIZE         =0x00080000
; dwTextureStage is valid
DDSD_TEXTURESTAGE       =0x00100000
; dwFVF is valid
DDSD_FVF                =0x00200000
; dwSrcVBHandle is valid
DDSD_SRCVBHANDLE        =0x00400000
; dwDepth is valid
DDSD_DEPTH              =0x00800000
; All input fields are valid.
DDSD_ALL                =0x00fff9ee

struct DDOPTSURFACEDESC
    dwSize              DWORD
    dwFlags             DWORD
    ddSCaps             DDSCAPS2
    ddOSCaps            DDOSCAPS
    guid                GUID
    dwCompressionRatio  DWORD
ends

; guid field is valid.
DDOSD_GUID                 =0x00000001
; dwCompressionRatio field is valid.
DDOSD_COMPRESSION_RATIO    =0x00000002
; ddSCaps field is valid.
DDOSD_SCAPS                =0x00000004
; ddOSCaps field is valid.
DDOSD_OSCAPS               =0x00000008
; All input fields are valid.
DDOSD_ALL                  =0x0000000f
; The surface's optimized pixelformat is compressed
DDOSDCAPS_OPTCOMPRESSED    =0x00000001
; The surface's optimized pixelformat is reordered
DDOSDCAPS_OPTREORDERED     =0x00000002
; The opt surface is a monolithic mipmap
DDOSDCAPS_MONOLITHICMIPMAP =0x00000004
DDOSDCAPS_VALIDSCAPS       =0x30004800
; The valid OptSurf caps
DDOSDCAPS_VALIDOSCAPS      =0x00000007

struct DDCOLORCONTROL
    dwSize               DWORD
    dwFlags              DWORD
    lBrightness          LONG
    lContrast            LONG
    lHue                 LONG
    lSaturation          LONG
    lSharpness           LONG
    lGamma               LONG
    lColorEnable         LONG
    dwReserved1          DWORD
ends

; lBrightness field is valid.
DDCOLOR_BRIGHTNESS              =0x00000001
; lContrast field is valid.
DDCOLOR_CONTRAST                =0x00000002
; lHue field is valid.
DDCOLOR_HUE                     =0x00000004
; lSaturation field is valid.
DDCOLOR_SATURATION              =0x00000008
; lSharpness field is valid.
DDCOLOR_SHARPNESS               =0x00000010
; lGamma field is valid.
DDCOLOR_GAMMA                   =0x00000020
; lColorEnable field is valid.
DDCOLOR_COLORENABLE             =0x00000040
;==========================================================================
;
; Direct Draw Capability Flags
;
; These flags are used to describe the capabilities of a given Surface.
; All flags are bit flags.
;
;==========================================================================
;
; DIRECTDRAWSURFACE CAPABILITY FLAGS
;
; This bit is reserved. It should not be specified.
DDSCAPS_RESERVED1                      =0x00000001

; Indicates that this surface contains alpha-only information.
; (To determi
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值