Home COM GDI+ WebBrowser Data Access 

Filters Reference

 

 

This section contains reference information for Microsoft DirectX Transform filters.

 

Note  These interfaces are included in DXTRANS.DLL (Microsoft Direct Transforms Type Library).

 

 

Interfaces

 

IDXARGBReadPtr

IDXARGBReadWritePtr

IDXARGBSurfaceInit

IDXBaseObject

IDXDCLock

IDXEffect

IDXGradient

IDXLookupTable

IDXLUTBuilder

IDXRawSurface

IDXSurface

 

 

IDXSurfaceFactory

IDXSurfaceInit

IDXSurfaceModifier

IDXSurfacePick

IDXTaskManager

IDXTBindHost

IDXTConvolution

IDXTransform

IDXTransformFactory

IDXTScale

IDXTScaleOutput

 

 

 

Functions

 

DXAPCPROC

DXApplyColorChannelLookupArray

DXApplyLookupTable

DXApplyLookupTableArray

DXBASESAMPLE_Alloca

DXBitBlt

DXClipToOutputWithPlacement

DXColorFromBSTR

DXCompositeOver

DXCompositeUnder

DXConstOverArray

DXConstUnderArray

DXConvertToGray

DXDitherArray

DXFillSurface

DXFillSurfaceRect

DXInvertAlpha

DXIsBAdInterfacePtr

DXIsBadReadPtr

DXIsBadWriterPtr

DXLinearInterpolateArray

DXOverArray

DXOverArrayMMX

DXPMSAMPLE_Alloca

DXPreMultArray

DXPreMultSample

DXSAMPLE_Alloca

DXSampleFromColorRef

DXScalePemultArray

DXSampleFromColorRef

DXScalePremultArray

DXScaleSample

DXScaleSamplePercent

DXSrcCopy

DXTASKPROC

DXUnPreMultArray

DXUnPreMultSample

DXWeightedAverage

 

 

DXWeightedAverageArray

DXWeightedAverageArrayOver

DXWeightedAverage

DXWeightedAverageArray

DXWeightedAverageArrayOver

DXSrcCopy

DXTASKPROC

DXUnPreMultArray

DXUnPreMultSample

DXWeightedAverage

DXWeightedAverageArray

DXWeightedAverageArrayOver

DXTASKPROC

DXUnPreMultArray

DXUnPreMultSample

DXWeightedAverage

DXWeightedAverageArray

DXWeightedAverageArrayOver

DXOverArray

DXOverArrayMMX

DXPMSAMPLE_Alloca

DXPreMultArray

DXPreMultSample

DXSAMPLE_Alloca

DXSampleFromColorRef

DXScalePemultArray

DXSampleFromColorRef

DXScalePremultArray

DXScaleSample

DXScaleSamplePercent

DXSrcCopy

DXTASKPROC

DXUnPreMultArray

DXUnPreMultSample

DXWeightedAverage

DXWeightedAverageArray

DXWeightedAverageArrayOver

 

 

Structures

 

DXBASESAMPLE

 

Describes a color in 32-bit pixel format, consisting of relative red, green, blue, and alpha intensities.

TYPE DXBASESAMPLE
   Blue AS BYTE
   Green AS BYTE
   Red AS BYTE
   Alpha AS BYTE
END TYPE
 

 

DXBNDS

 

Describes either a continuous or a discrete boundary for a transform object.

'typedef struct DXBNDS {
' DXBNDTYPE eType;
' union {
' DXDBND D[4];
' DXDBND64 LD[4];
' DXCBND C[4];
' DXCBND64 LC[4];
' } u;
'} DXBNDS;

UNION u_DXBNDS
   D (3) AS DXDBND
   LD (3) AS DXDBND64
   C (3) AS DXCBND
   LC (3) AS DXCBND64
END UNION

TYPE DXBNDS
   eType AS LONG
   u AS u_DXBNDS
END TYPE

Members

eType
Member of the DXBNDTYPE enumeration, describing which member of the union to use.
u
Union of the structures that can be used to describe a boundary. This can contain one of the following structures.

D
Array of DXDBND discrete bounds, containing 32-bit long minimum and maximum values.
LD
Array of DXDBND64 discrete bounds, containing 64-bit LONGLONG minimum and maximum values.
C
Array of DXCBND continuous bounds, containing 32-bit float minimum and maximum values.
LC
Array of DXCBND64 continuous bounds, containing 64-bit double minimum and maximum values.

Remarks

The value of eType member determines which member of the union is used. The following table shows the value of the eType and the corresponding member of the union.
 

Value of eType Union member
DXBT_DISCRETE D
DXBT_DISCRETE64 LD
DXBT_CONTINUOUS C
DXBT_CONTINUOUS64 LC


You should never have to use this union directly. Instead, it is used by the CDXBnds template class (found in DXBounds.h) to create and manipulate image boundary objects. The most commonly used boundary object is the discrete CDXDBnds object.

The four members of this continuous or discrete array consist of an x-dimension, y-dimension, z-dimension, and t-dimension (time). Specify a minimum value of zero and a maximum value of one for any dimensions you use. For example, you can set the z-dimension and t-dimension this way for a 2-D image. If you use the CDXBnds template class, proper initialization is done for you.

The time dimension is intended for special data types, such as video or Graphics Interchange Format (GIF) animations.
 

 

DXCBND

 

Describes a continuous, 32-bit boundary for a transform object.

'typedef struct DXCBND {
' float Min;
' float Max;
'} DXCBND;

TYPE DXCBND
  nMin AS SINGLE
  nMax AS SINGLE
END TYPE

Members

Min
Value of type float that indicates the minimum boundary of a data set along a given dimension.
Max
Value of type float that indicates the maximum boundary of a data set along a given dimension.

Remarks

Continuous bounds are generally used to describe geometric objects.
 

 

DXCBND64

 

Describes a continuous, 64-bit boundary for a transform object.

'typedef struct DXCBND64 {
' double Min;
' double Max;
'} DXCBND64;

TYPE DXCBND64
   nMin AS DOUBLE
   nMax AS DOUBLE
END TYPE

Members

Min
Value of type double that indicates the minimum boundary of a data set along a given dimension.
Max
Value of type double that indicates the maximum boundary of a data set along a given dimension.

Remarks

Continuous bounds are generally used to describe geometric objects. This structure uses 64-bit values.
 

 

DXDBND

 

Describes a discrete, 32-bit boundary for a transform object.

'typedef struct DXDBND {
' long Min;
' long Max;
'} DXDBND;


TYPE DXDBND
   nMin AS LONG
   nMax AS LONG
END TYPE

Members

Min
Value of type long that indicates the minimum boundary of a data set along a given dimension.
Max
Value of type long that indicates the maximum boundary of a data set along a given dimension.

Remarks

Discrete bounds are generally used to describe image objects.
 

 

DXDBND

 

Describes a continuous, 64-bit boundary for a transform object.

'typedef struct DXDBND64 {
' LONGLONG Min;
' LONGLONG Max;
'} DXDBND64;

TYPE DXDBND64
   nMin AS QUAD
   nMax AS QUAD
END TYPE


Members

Min
Value of type LONGLONG that indicates the minimum boundary of a data set along a given dimension.
Max
Value of type LONGLONG that indicates the maximum boundary of a data set along a given dimension.

Remarks

Continuous bounds are generally used to describe geometric objects.

This structure uses 64-bit values.
 

 

DXDITHERDESC

 

Contains the information needed by the DXDitherArray helper function to dither an array of samples.

'typedef struct DXDITHERDESC {
' DXBASESAMPLE *pSamples;
' ULONG cSamples;
' ULONG x;
' ULONG y;
' DXSAMPLEFORMATENUM DestSurfaceFmt;
'} DXDITHERDESC;

TYPE DXDITHERDESC
   pSamples AS DXBASESAMPLE PTR
   cSamples AS DWORD
   x AS DWORD
   y AS DWORD
   DestSurfaceFmt AS LONG
END TYPE

Members

pSamples
Pointer to a structure of type DXBASESAMPLE that indicates the samples to dither onto the output surface.
cSamples
Value of type ULONG that indicates the number of samples in the pSamples buffer to dither.
x
Value of type ULONG that indicates the x-coordinate of the output surface.
y
Value of type ULONG that indicates the y-coordinate of the output surface.
DestSurfaceFmt
Member of the DXSAMPLEFORMATENUM enumeration that indicates the pixel format of the destination surface.

Remarks

You can use dithering to produce the effect of 32-bit and 16-bit color with an 8-bit color palette. The dithering algorithm uses a 4 x 4 dither pattern to produce the output.
 

 

DXLIMAPINFO

 

Describes sample indexes and weights used for linear interpolation.

'typedef struct DXLIMAPINFO {
' float IndexFrac;
' USHORT Index;
' BYTE Weight;
'} DXLIMAPINFO;

TYPE DXLIMAPINFO
   IndexFrac AS SINGLE
   Index AS WORD
   Weight AS BYTE
END TYPE

Members

IndexFrac
Not used.
Index
An unsigned short integer specifying the index of the sample to use in an interpolation or a filter.
Weight
A value of type BYTE that specifies the weight to apply when blending two samples. The first sample is weighted by Weight, and the second is weighted by the inverse of Weight. The weight should be a value ranging from 0 to 255.
 

 

DXNATIVETYPEINFO

 

Describes the underlying native pixel format of a DXSurface object.

'typedef struct tagDXNATIVETYPEINFO {
' BYTE *pCurrentData;
' BYTE *pFirstByte;
' long lPitch;
' DWORD dwColorKey;
'} DXNATIVETYPEINFO;

TYPE DXNATIVETYPEINFO
   pCurrentData AS BYTE PTR
   pFirstByte AS BYTE PTR
   lPitch AS LONG
   dwColorKey AS DWORD
END TYPE

Members

pCurrentData
Pointer to the first byte of a sample at the current x-axis and y-axis position in a DXSurface object.
pFirstByte
Pointer to the first byte of a sample at the origin of the DXSurface.
lPitch
Value of type long that indicates the number of bytes to add to pFirstByte to advance from one row to the next row in the DXSurface.
dwColorKey
Value of type DWORD used as a color key for the DXSurface.
 

 

DXOVERSAMPLEDESC

 

Describes a pixel to blend over another pixel.

'typedef struct tagDXOVERSAMPLEDESC {
' POINT p;
' DXPMSAMPLE Color;
'} DXOVERSAMPLEDESC;

TYPE DXOVERSAMPLEDESC
   p AS POINTAPI
   tColor AS DXPMSAMPLE
END TYPE

Members

p
Structure of type POINT that indicates the x-axis and y-axis positions of the pixel to blend.
tColor
Structure of type DXPMSAMPLE that indicates the alpha premultiplied color of the source pixel before blending.

Remarks
 

The IDXARGBReadWritePtr::OverSample method uses this structure to alpha blending one pixel over another, weighted by the alpha channel.
 

 

DXPACKEDRECTDESC

 

Describes a rectangular array of pixels in a DXSurface object.

'typedef struct tagDXPACKEDRECTDESC {
' DXBASESAMPLE *pSamples;
' BOOL bPremult;
' RECT rect;
' long lRowPadding;
'} DXPACKEDRECTDESC;

TYPE DXPACKEDRECTDESC
   pSamples AS DXBASESAMPLE PTR
   bPremult AS LONG
   rc AS RECT
   lRowPadding AS LONG
END TYPE

Members

pSamples
Pointer to destination buffer that holds the unpacked data. A buffer must be supplied for all surface formats and implementations.
bPremult
Value of type BOOL that indicates the format into which the samples are unpacked.
FALSE
The samples are unpacked into ARGB32 format.
TRUE
The samples are unpacked into the alpha premultipliedPMARGB32 format.
rc
Structure of type RECT that indicates the rectangular region to unpack. Both coordinates are relative to the locked region.
lRowPadding
Value of type long that indicates the difference between the width of the buffer of samples pointed to by pSamples and the width of the rectangle in rect. For instance, if rect is 5 pixels wide, but the pSamples buffer is 12 pixels wide, lRowPadding should be set to 7. If the width of rect and the buffer pSamples is the same, the value of lRowPadding should be set to 0. You must supply this value when calling either IDXARGBReadWritePtr::PackRect or IDXARGBReadPtr::UnpackRect.

Remarks

This structure was created to save memory when storing small images in large regions. The row padding subtracted from the rectangle width gives the number of samples per row.
 

 

DXPMSAMPLE

 

Describes a color in 32-bit pixel format, consisting of relative red, green, blue, and alpha intensities.

TYPE DXBASESAMPLE
   Blue AS BYTE
   Green AS BYTE
   Red AS BYTE
   Alpha AS BYTE
END TYPE
 

 

DXPtrFillInfo

 

Describes a fill operation that should be performed on procedural surfaces. It is used by the CDXBaseARGBPtr::FillSamples function.

'typedef struct DXPtrFillInfo {
' DXBASESAMPLE *pSamples;
' ULONG cSamples;
' ULONG x;
' ULONG y;
' BOOL bPremult;
'} DXPtrFillInfo;

TYPE DXPtrFillInfo
   pSamples AS DXBASESAMPLE PTR
   cSamples AS DWORD
   x AS DWORD
   y AS DWORD
   bPremult AS LONG
END TYPE

Members

pSamples
Pointer to the memory location to fill.
cSamples
Value of type ULONG that indicates the number of samples to fill.
x
Value of type ULONG that indicates the position along the x-axis within the coordinate space of the procedural surfaces. This is used for horizontal pattern alignment.
y
Value of type ULONG that indicates the position along the y-axis within the coordinate space of the procedural surfaces. This is used for vertical pattern alignment.
bPremult
Value of type BOOL that specifies whether the samples being written should be alpha premultiplied. If TRUE, the output samples are in PMARGB32 format; if FALSE, the output format is ARGB32.
 

 

DXRAWSURFACEINFO

 

Contains information needed by the IDXRawSurface interface to initialize a DXSurface from a custom raw surface.

'typedef struct DXRAWSURFACEINFO {
' BYTE *pFirstByte;
' long lPitch;
' ULONG Width;
' ULONG Height;
' const GUID *pPixelFormat;
' HDC hdc;
' DWORD dwColorKey;
' DXBASESAMPLE *pPalette;
'} DXRAWSURFACEINFO;

TYPE DXRAWSURFACEINFO
   pFirstByte AS BYTE PTR
   lPitch AS LONG
   Width AS DWORD
   Height AS DWORD
   pPixelFormat AS GUID
   hdc AS DWORD
   dwColorKey AS DWORD
   pPalette AS DXBASESAMPLE PTR
END TYPE

Members

pFirstByte
Pointer to a value of type BYTE that indicates the origin of the raw surface.
lPitch
Value of type long that indicates the number of bytes from the beginning of a row to the beginning of the next row. This number can be negative.
Width
Value of type ULONG that indicates the width of the raw surface, in pixels.
Height
Value of type ULONG that indicates the height of the raw surface, in pixels.
pPixelFormat
Pointer to the pixel format of the raw surface.
hdc
Handle to a device context (HDC) of the raw surface. You should create a memory device context for the raw surface so that clients can make Microsoft Windows Graphics Device Interface (GDI) calls to manipulate the surface.
dwColorKey
Value of type DWORD used as a color key for the raw surface. The high byte of this value must equal 0xFF for the color-keyed surface. The lower three bytes contain the native data type.
pPalette
Pointer to an optional palette used for the pixel colors of the raw surface.
 

 

DXRUNINFO

 

Describes run information associated with a DXSurface object.

'typedef struct DXRUNINFO {
' ULONG Type:2;
' ULONG Count:30;
'} DXRUNINFO;

TYPE DXRUNINFO
   dwType AS DWORD ' default value = 2
   Count AS DWORD  ' default value = 30
END TYPE

Members

dwType
Value of type ULONG that indicates the type of sample in the run. This can be one of the following types.

DXRUNTYPE_CLEAR
The corresponding samples are clear (alpha equals zero). They either have the alpha set to 0, or they match the color key.
DXRUNTYPE_TRANS
The corresponding samples are translucent. Alpha has a value between 0 and 255.
DXRUNTYPE_OPAQUE
The corresponding samples are opaque (alpha equals 255).
DXRUNTYPE_UNKNOWN
The pixel types have not been recorded by the surface; you should examine each sample when processing.

Count
Value of type ULONG that indicates the number of samples in the run.

Remarks

A run of samples is a number of adjacent samples in a row of a DXSurface with similar alpha characteristics. An entire row can be made of many runs, or only one, depending on the image stored in the DXSurface. Arrays of DXRUNINFO structures are returned from the IDXARGBReadPtr::MoveAndGetRunInfo method to describe a row and can be used to optimize alpha blending operations on DXSurface.
 

 

DXSAMPLE

 

Describes a color in 32-bit pixel format, consisting of relative red, green, blue, and alpha intensities.

TYPE DXSAMPLE
   Blue AS BYTE
   Green AS BYTE
   Red AS BYTE
   Alpha AS BYTE
END TYPE
 

 

DXTMTASKINFO

 

Describes a task to be performed by a DXTaskManager (task manager) object.

'typedef struct DXTMTASKINFO {
' PFNDXTASKPROC pfnTaskProc;
' PVOID pTaskData;
' PFNDXAPCPROC pfnCompletionAPC;
' DWORD dwCompletionData;
' const GUID *pRequestID;
'} DXTMTASKINFO;

TYPE DXTMTASKINFO
   pfnTaskProc AS DWORD PTR
   pTaskData AS DWORD PTR
   pfnCompletionAPC AS DWORD PTR
   dwCompletionData AS DWORD
   pRequestID AS GUID PTR
END TYPE

Members

pfnTaskProc
Pointer to a DXTASKPROC that specifies the function to execute.
pTaskData
Pointer to the task data used for the function call referred to by pfnTaskProc.
pfnCompletionAPC
Pointer to a DXAPCPROC that specifies an asynchronous procedure call function.
dwCompletionData
Pointer to the data used for the asynchronous procedure call referred to by the pfnCompletionAPC member.
pRequestID
globally unique identifier (GUID) that uniquely identifies the task to the task manager.

Remarks

Using this structure for task management requires that you have already implemented functions for the task manager to execute. You can do this in C++ by adding the following code to your .h file for each function you plan to use.

DXTASKPROC TaskFunctionName;
DXAPCPROC APCFunctionName;

You must next implement these functions in your .cpp file, as shown in the following code sample.

void __stdcall TaskFunctionName(void *pTaskData, BOOL *bContinueProcessing)
{ /* Insert code here. */ }

void __stdcall __stdcall APCFunctionName(DWORD dwData)
{ /* Insert code here. */ }
 

 

DXVEC

 

Describes either a continuous or a discrete four-dimensional (4-D) vector.

'typedef struct DXVEC {
' DXBNDTYPE eType;
' union {
' long D[4];
' LONGLONG LD[4];
' float C[4];
' double LC[4];
' };
'} DXVEC;


UNION u_DXVEC
   D (3) AS LONG
   LD (3) AS QUAD
   C (3) AS SINGLE
   LC (3) AS DOUBLE
END UNION

TYPE DXVEC
   eType AS LONG
   u AS u_DXVEC
END TYPE

Members

eType
DXBNDTYPE enumeration that specifies which member of the union to use.
D
Discrete, 32-bit 4-D vector.
LD
Discrete, 64-bit 4-D vector.
C
Continuous, 32-bit 4-D vector.
LC
Continuous, 64-bit 4-D vector.

Remarks

Four-dimensional vectors consist of an x-coordinate, a y-coordinate, a z-coordinate, and a time coordinate.
 

 

Enumerations

 

DXBLTOPTIONS

 

Describes the methods to use when blitting an image onto a DXSurface.

 

' DXBOF_DO_OVER = ( 1L << 0 )

%DXBOF_DO_OVER = 0
' Source samples should be alpha-blended over the samples in the destination DXSurface. Without this flag, the input samples replace the destination samples.
' DXBOF_DITHER = ( 1L << 1 )

%DXBOF_DITHER = 1
' Output surface samples should be dithered.

 

Remarks

These flags are used by the IDXSurfaceFactory::BitBlt and DXBitBlt functions.

Some transforms do not support dithered output. To determine whether a transform supports dithering, use the IDXTransform::GetMiscFlags method. If the returned DXTMISCFLAGS value has the DXTMF_DITHER_SUPPORTED flag set, the output can be dithered.
 

 

DXBNDID

 

Identifies an axis for a surface boundary.

%DXB_X = 0
' Selected boundary is on the x-axis.
%DXB_Y = 1
' Selected boundary is on the y-axis.
%DXB_Z = 2
' Selected boundary is on the z-axis.
%DXB_T = 3
' Selected boundary is on the time axis.

 

 

DXBNDTYPE

 

Identifies the data type within a DXBNDS union.

%DXBT_DISCRETE = 0
' The DXBNDS union is using the LONG data type.
%DXBT_DISCRETE64 = 1
' The indicated DXBNDS union is using the 64-bit LONGLONG data type.
%DXBT_CONTINUOUS = 2
' The indicated DXBNDS union is using the FLOAT data type.
%DXBT_CONTINUOUS64 = 3
' The indicated DXBNDS union is using the 64-bit double data type.

 

 

DXCOMPFUNC

 

Describes the method used for compositing by the Compositor transform.

%DXCOMPFUNC_SWAP_AB = &H10
' A flag used internally to switch the inputs for A and B.
%DXCOMPFUNC_FUNCMASK = &HF
' A bitmask used to check for valid input.
%DXCOMPFUNC_CLEAR = 0
' The transform should perform no operation on the output.
%DXCOMPFUNC_MIN
' Compares the brightness of each sample in both images, and shows only the less bright of the two samples.
%DXCOMPFUNC_MAX
' Compares the brightness of each sample in both images, and shows only the brighter of the two samples.
%DXCOMPFUNC_A
' The transform should write Image A to the output.
%DXCOMPFUNC_A_OVER_B
' The transform should place Image A over Image B. All of Image A will be visible, and Image B will show through any zero alpha regions of Image A.
%DXCOMPFUNC_A_IN_B
' For the resulting image, all parts of Image A that are contained in Image B show. Only regions with nonzero alpha for both images will be visible, and no part of Image B will show through.
%DXCOMPFUNC_A_OUT_B
' For the resulting image, all parts of Image B that are contained in Image A are removed. Areas in Image B with zero alpha are not cut out of Image A.
%DXCOMPFUNC_A_ATOP_B
' For the resulting image, Image A is placed over Image B, with each sample scaled by the alpha channel of Image B.
%DXCOMPFUNC_A_SUBTRACT_B
' For the resulting image, the sample color values of Image B are subtracted from the corresponding sample color values of Image A. The resulting color is scaled by the alpha values of Image A.
%DXCOMPFUNC_A_ADD_B
' For the resulting image, the sample color values of Image B are added to the corresponding sample color values of Image A. The resulting color value is scaled by the alpha value of Image A.
%DXCOMPFUNC_A_XOR_B
' For the resulting image, places where the two images do not overlap show as normal. Places that do overlap are scaled by their inverse value for alpha.
%DXCOMPFUNC_B = %DXCOMPFUNC_A OR %DXCOMPFUNC_SWAP_AB
' The transform should write Image B to the output.
%DXCOMPFUNC_B_OVER_A = %DXCOMPFUNC_A_OVER_B OR %DXCOMPFUNC_SWAP_AB
' The same operation as DXCOMPFUNC_A_OVER_B, with Image A and B switched.
%DXCOMPFUNC_B_IN_A = %DXCOMPFUNC_A_IN_B OR %DXCOMPFUNC_SWAP_AB
' The same operation as DXCOMPFUNC_A_IN_B, with Image A and B switched.
%DXCOMPFUNC_B_OUT_A = %DXCOMPFUNC_A_OUT_B OR %DXCOMPFUNC_SWAP_AB
' The same operation as DXCOMPFUNC_A_OUT_B, with Image A and B switched.
%DXCOMPFUNC_B_ATOP_A = %DXCOMPFUNC_A_ATOP_B OR %DXCOMPFUNC_SWAP_AB
' The same operation as DXCOMPFUNC_A_ATOP_B, with Image A and B switched.
%DXCOMPFUNC_B_SUBTRACT_A = %DXCOMPFUNC_A_SUBTRACT_B OR %DXCOMPFUNC_SWAP_AB
' The same operation as DXCOMPFUNC_A_SUBTRACT_B, with Image A and B switched.
%DXCOMPFUNC_B_ADD_A = %DXCOMPFUNC_A_ADD_B OR %DXCOMPFUNC_SWAP_AB
' The same operation as DXCOMPFUNC_A_ATOP_B, with Image A and B switched.
%DXCOMPFUNC_NUMFUNCS
' The number of supported compositing operations, used for parameter validation.

Remarks

The transform requires two inputs and one output, which are defined by calling the IDXTransform::Setup method. In the following material, Image A corresponds to setup input index 0, and Image B to setup input index 1. The composite operation combines the samples of Image A and Image B according to one of the listed methods. Each one corresponds to a different order of overlaying the images or a different way of combining the sample colors using each image's alpha channel.
 

 

DXCONVFILTERTYPE

 

Identifies a filter type to use with the IDXTConvolution interface.

%DXCFILTER_SRCCOPY = 0
' The convolution transform should use no filtering. For this option, the output is identical to the source. All custom properties set with the IDXTConvolution interface, such as IDXTConvolution::SetConvertToGray, are ignored for this option.
%DXCFILTER_BOX7X7 = 1
' The convolution transform should use a 7x7 blur filter. Each element of the filter matrix has an equal weight of 1/49. Selecting this filter also sets the bias to zero and alpha exclusion to FALSE.
%DXCFILTER_BLUR3X3 = 2
' The convolution transform should use a 3x3 blur filter. The elements of the filter are as follows:
' { 1/16, 1/8, 1/16, 1/8 , 1/4, 1/8 , 1/16, 1/8, 1/16 }
' Selecting this filter also sets the bias to zero and alpha exclusion to FALSE.
%DXCFILTER_SHARPEN = 3
' The convolution transform should use a standard, sharpen-image filter. The elements of the filter are as follows:
' { 0, -1, 0, -1, 5, -1, 0, -1, 0 }
' Selecting this filter also sets the bias to zero and alpha exclusion to TRUE.
%DXCFILTER_EMBOSS = 4
' The convolution transform should use a standard emboss image filter. Selecting this filter also sets the bias to 0.7 and alpha exclusion to TRUE. Color images are converted to gray scale by this filter.
%DXCFILTER_ENGRAVE = 5
' The convolution transform should use a standard engrave image filter. Selecting this filter also sets the bias to 0.7 and alpha exclusion to TRUE. Color images are converted to gray scale by this filter.
%DXCFILTER_NUM_FILTERS = 6
' An element used for parameter validation.
%DXCFILTER_CUSTOM = 7
' This filter type is selected when you call the IDXTConvolution::SetCustomFilter method. It cannot be set with the IDXTConvolution::SetFilterType method.

Remarks

Options such as bias, alpha exclusion, and gray scale are discussed in detail in the IDXTConvolution interface reference.
 

 

DXEFFECTTYPE

 

Describes the type of effect used for a particular transform.

' DXTET_PERIODIC = ( 1 << 0 ),
%DXTET_PERIODIC = 0
' Transform output at Progress = 1.0 is the same as the output at Progress = 0.0.
' DXTET_MORPH = ( 1 << 1 )
%DXTET_MORPH = 1
' Transform gradually changes the output from input 1 to input 2.

Remarks

A call to the IDXEffect::Capabilities method returns a value with one or both of these flags set. If both of these flags are set for a transform, it behaves as DXTET_PERIODIC with one input and DXTET_MORPH with two inputs.
 

Periodic transforms can be looped to simulate animation.
 

 

DXFILTERTYPE

 

Identifies a filtering algorithm to be used with the IDXTScale interface.

%DXFILTER_NEAREST = 0
' Color of the nearest mapped point should determine the destination color.
%DXFILTER_BILINEAR = 1
' Bilinear filter should be used to determine the destination color.
%DXFILTER_NUM_FILTERS = 2
' Number of filter types used for parameter validation.

Remarks

When an image is scaled, each pixel in the destination image is mapped back to the source image to determine its color. The filter used in scaling sets the method used to determine that color. For DXFILTER_NEAREST, the color of the closest source pixel for the mapped pixel determines the color of the destination pixel. Other filters use pixels surrounding the mapped pixel to determine the destination color.

The type of filter is selected by changing the value of the Quality property with the IDXTransform::SetQuality method. For more discussion on the role of the Quality property, see the Author's Guide to Transforms.
 

 

DXINOUTINFOFLAGS

 

Used by IDXTransform::GetInOutInfo to specify whether an input or output data object is required.

' DXINOUTF_OPTIONAL = ( 1L << 0 )
%DXINOUTF_OPTIONAL = 0
' Indicates the input or output data object is not required

Remarks

Using NULL instead of DXINOUTF_OPTIONAL indicates that the input or output data object is required.
 

 

DXLOCKSURF

 

Determines how a surface should be locked by the IDXSurface::LockSurface method.

%DXLOCKF_READ = 0
' Surface to lock is read-only.
' DXLOCKF_READWRITE = ( 1 << 0 ),
' Surface to lock is read/write.
%DXLOCKF_READWRITE = 1
' DXLOCKF_EXISTINGINFOONLY = ( 1 << 1 )
%DXLOCKF_EXISTINGINFOONLY = 2
' Lock should use existing sample runmap information.
' DXLOCKF_WANTRUNINFO = ( 1 << 2 )
%DXLOCKF_WANTRUNINFO = 4
' Lock should produce a sample runmap, if one does not exist.
' DXLOCKF_NONPREMULT = ( 1 << 16 )
%DXLOCKF_NONPREMULT = &H10000
' Surface to lock uses a sample format that is not alpha premultiplied.
%DXLOCKF_VALIDFLAGS = %DXLOCKF_READWRITE OR %DXLOCKF_EXISTINGINFOONLY OR %DXLOCKF_WANTRUNINFO OR %DXLOCKF_NONPREMULT
' Bitwise OR of all flags that is used to test for invalid input.

Remarks

A call to IDXSurface::LockSurface typically uses either DXLOCKF_READ or DXLOCKF_READWRITE. DXLOCKF_EXISTINGINFOONLY, if used in conjunction with DXLOCKF_WANTRUNINFO, prevents creation of a pixel runmap, if one does not exist.

The flags in the high word should be specific to the type of pointer that is requested. These flags define ARGB flags; they are optional for ARGB locks.

For DXLOCKF_NONPREMULT, the caller requests data that is not alpha premultiplied.
 

 

DXLUTCOLOR

 

Identifies which color balance is to be adjusted by a lookup table. It is used in the IDXLUTBuilder::GetColorBalance and IDXLUTBuilder::SetColorBalance methods.

%DXLUTCOLOR_RED = 9
' Color balance of the red channel.
%DXLUTCOLOR_GREEN = 1
' Color balance of the green channel.
%DXLUTCOLOR_BLUE = 2
' Color balance of the blue channel.
 

 

DXRUNTYPE

 

Describes the opacity of a sample run in the DXRUNINFO structure.

%DXRUNTYPE_CLEAR = 0
' Pixel run is clear (alpha = 0).
%DXRUNTYPE_OPAQUE = 1
' Pixel run is opaque (alpha = 255).
%DXRUNTYPE_TRANS = 2
' Pixel run is translucent.
%DXRUNTYPE_UNKNOWN = 3
' Run type is unknown.
 

 

DXSAMPLEFORMATENUM

 

Indicates the pixel format of a DXSurface object. This enumerated type is returned by the IDXARGBReadPtr::GetNativeType and IDXSurface::GetPixelFormat methods.

'%FLAGSMASK = ( 0x FFFF0000 ),
' Mask that specifies which bits of the longword are used to indicate transparency and dithering options.
'%NONPREMULT = ( 0x00010000 ),
' Flag that indicates that the pixel format is not alpha premultiplied.
'%TRANSPARENCY = ( 0x00020000 ),
' Flag that indicates that the surface uses a color keys for transparency.
'%TRANSLUCENCY = ( 0x00040000 ),
' Flag that indicates that the pixel format uses 8-bit alpha values.
'%2BITERROR = ( 0x00200000 ),
' Flag that indicates that the surface uses a 2-bit error term for dithering.
'%3BITERROR = ( 0x00300000 ),
' Flag that indicates that the surface uses a 3-bit error term for dithering.
'%4BITERROR = ( 0x00400000 ),
' Flag that indicates that the surface uses a 4-bit error term for dithering.
'%5BITERROR = ( 0x00500000 ),
' Flag that indicates that the surface uses a 5-bit error term for dithering.
'%ERRORMASK = ( 0x00700000 ),
' Mask of all bits used for dithering.
'%NONSTANDARD = ( 0 ),
' Flag that indicates that the surface pixel format is not one of the formats listed here. This flag can be combined with DXPF_NONPREMULT, if operations on the surface are more efficient with a pixel format that is not alpha premultiplied.
'%PMARGB32 = ( 1 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY ),
' A 32-bit pixel format, with eight bits each of alpha, red, green, and blue. The bits are stored in this order, with the alpha stored in the higher-order bits and the blue in the lower-order bits. For this format, the color values are alpha premultiplied.
'%ARGB32 = ( 2 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY ),
' A 32-bit pixel format, with eight bits each of alpha, red, green, and blue. The bits are stored in this order, with the alpha stored in the higher-order bits and the blue in the lower-order bits.
'%ARGB4444 = ( 3 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY | DXPF_4BITERROR ),
' A 16-bit pixel format, with four bits each of alpha, red, green, and blue.
'%A8 = ( 4 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY ),
' An 8-bit pixel format that stores only alpha values.
'%RGB32 = ( 5 ),
' A 32-bit pixel format, with eight bits each of red, green, and blue. This is essentially a 24-bit version of DXPF_ARGB32, with no alpha values.
'%RGB24 = ( 6 ),
' A 24 bit pixel format, with eight bits each of red, green, and blue.
'%RGB565 = ( 7 | DXPF_3BITERROR ),
' A 16-bit pixel format that uses five bits for red, six bits for green, and five bits for blue.
'%RGB555 = ( 8 | DXPF_3BITERROR ),
' A 16-bit pixel format that uses five bits for red, five bits for green, and five bits for blue. The highest-order bit is ignored.
'%RGB8 = ( 9 | DXPF_5BITERROR ),
' An 8-bit pixel format, where each value refers to a color in a palette.
'%ARGB1555 = ( 10 | DXPF_TRANSPARENCY | DXPF_3BITERROR ),
' A 16-bit pixel format that uses five bits for red, five bits for green, and five bits for blue. The last bit is used to flag a pixel as transparent.
'%RGB32_CK = ( DXPF_RGB32 | DXPF_TRANSPARENCY ),
' Same format as DXPF_RGB32 and uses a color key for transparency.
'%RGB24_CK = ( DXPF_RGB24 | DXPF_TRANSPARENCY ),
' Same format as DXPF_RGB24 and uses a color key for transparency.
'%RGB555_CK = ( DXPF_RGB555 | DXPF_TRANSPARENCY ),
' Same format as DXPF_RGB555 and uses a color key for transparency.
'%RGB565_CK = ( DXPF_RGB565 | DXPF_TRANSPARENCY ),
' Same format as DXPF_RGB565 and uses a color key for transparency.
'%RGB8_CK = ( DXPF_RGB8 | DXPF_TRANSPARENCY )
' Same format as DXPF_RGB8 and uses a color key for transparency.

%DXPF_FLAGSMASK = -65536 ' &HFFFF0000
%DXPF_NONPREMULT = 65536 ' &H10000
%DXPF_TRANSPARENCY = 131072 ' &H20000
%DXPF_TRANSLUCENCY = 262144 ' &H40000
%DXPF_2BITERROR = 2097152 ' &H200000
%DXPF_3BITERROR = 3145728 ' &H300000
%DXPF_4BITERROR = 4194304 ' &H400000
%DXPF_5BITERROR = 5242880 ' &H500000
%DXPF_ERRORMASK = 7340032 ' &H700000
%DXPF_NONSTANDARD = 0 ' &H0
%DXPF_PMARGB32 = 393217 ' &H60001
%DXPF_ARGB32 = 458754 ' &H70002
%DXPF_ARGB4444 = 4653059 ' &H470003
%DXPF_A8 = 393220 ' &H60004
%DXPF_RGB32 = 5 ' &H5
%DXPF_RGB24 = 6 ' &H6
%DXPF_RGB565 = 3145735 ' &H300007
%DXPF_RGB555 = 3145736 ' &H300008
%DXPF_RGB8 = 5242889 ' &H500009
%DXPF_ARGB1555 = 3276810 ' &H32000A
%DXPF_RGB32_CK = 131077 ' &H20005
%DXPF_RGB24_CK = 131078 ' &H20006
%DXPF_RGB555_CK = 3276808 ' &H320008
%DXPF_RGB565_CK = 3276807 ' &H320007
%DXPF_RGB8_CK = 5373961 ' &H520009

Remarks

You can use the mask to determine the pixel format of the IDXSurface and any dithering or transparency options used for rendering.
 

 

DXSFCREATE

 

Enables you to set special properties of DXSurface objects that are created with the IDXSurfaceFactory interface.

' DXSF_FORMAT_IS_CLSID = ( 1L << 0 )
%DXSF_FORMAT_IS_CLSID = 1
' If this flag is set in the dwflags parameter of the IDXSurfaceFactory::CreateSurface method, the pFormatID parameter is used to create the surface. If this flag is not set, the pFormatID parameter is ignored, and the default value (CLSID_DXSurface) is used. This gives you the option of creating custom DXSurface formats.
' DXSF_NO_LAZY_DDRAW_LOCK = ( 1L << 1 )
%DXSF_NO_LAZY_DDRAW_LOCK = 2
' Enables you to cancel the selection of "lazy DDraw locking" for the surface.

Remarks

By default, DXSurfaces are locked using a lazy lock of an underlying DirectDrawSurface. This technique locks the DirectDrawSurface the first time the DXSurface is locked, retrieves the pointer to the DirectDrawSurface, and immediately unlocks the DirectDrawSurface. Subsequent locks operations increment a counter. Lazy locking improves code performance markedly, but you should not use it if other operations on the DirectDrawSurface are occurring.
 

 

DXSURFMODCOMPOP

 

Describes the method used by the IDXSurfaceModifier interface for compositing operations.

%DXSURFMOD_COMP_OVER = 0
' Flag that specifies that the foreground surface is rendered directly over the background surface.
%DXSURFMOD_COMP_ALPHA_MASK = 1
' Flag that specifies that the foreground surface is rendered over the background surface scaled by the background's alpha channel.
%DXSURFMOD_COMP_MAX_VALID = 1
' Flag used by the interface to check for valid input.
 

 

DXSURFSTATUS

 

Describes general properties of a DXSurface object.

' DXSURF_TRANSIENT = ( 1 << 0 )
%DXSURF_TRANSIENT = 1
' Value that indicates that the pointer to the surface could change during run time.
' DXSURF_READONLY = ( 1 << 1 )
%DXSURF_READONLY = 1
' Value that indicates that the surface is read-only.
' DXSURF_VALIDFLAGS = ( DXSURF_TRANSIENT | DXSURF_READONLY )
%DXSURF_VALIDFLAGS = %DXSURF_TRANSIENT OR %DXSURF_READONLY
' Bitwise OR of the two flags used to check for valid input.
 

 

DXTMISCFLAGS

 

Describes flags that specify transform capabilities and rendering options.

' DXTMF_BLEND_WITH_OUTPUT = ( 1L << 0 ),
' Transform will perform a composite over the output surface when writing the result.
' DXTMF_DITHER_OUTPUT = ( 1L << 1 ),
' Transform dithers the result as it is written on the output surface. This flag can only be set if the DXTMF_DITHER_SUPPORTED flag is set for the transform.
' DXTMF_OPTION_MASK = ( 0x0000 FFFF ),
' Bitmask that defines valid transform-specific flags.
' DXTMF_VALID_OPTIONS = ( DXTMF_BLEND_WITH_OUTPUT | DXTMF_DITHER_OUTPUT ),
' Bitmask that defines valid, user-selectable option flags.
' DXTMF_BLEND_SUPPORTED = ( 1L << 16 ),
' Transform supports alpha blending.
' DXTMF_DITHER_SUPPORTED = ( 1L << 17 ),
' Transform supports image dithering.
' DXTMF_INPLACE_OPERATION = ( 1L << 24 ),
' Transform reads data from the output surface to compute the result.
' DXTMF_BOUNDS_SUPPORTED = ( 1L << 25 ),
' Transform supports use of the DXBNDS structure.
' DXTMF_PLACEMENT_SUPPORTED = ( 1L << 26 ),
' Transform supports use of the DXVEC structure.
' DXTMF_QUALITY_SUPPORTED = ( 1L << 27 ),
' Transform supports the Quality property with a value from 0 to 1 to specify how well to render the result.
' DXTMF_OPAQUE_RESULT = ( 1L << 28 )
' Transform produces all output with an alpha value of 255, making all samples opaque.

%BLEND_WITH_OUTPUT = 1
%DITHER_OUTPUT = 2
%OPTION_MASK = &H0000FFFF
%VALID_OPTIONS = %DXTMF_BLEND_WITH_OUTPUT OR %DXTMF_DITHER_OUTPUT
%BLEND_SUPPORTED = &H1000
%DITHER_SUPPORTED = &H2000
%INPLACE_OPERATION = &H1000000
%BOUNDS_SUPPORTED = &H2000000
%PLACEMENT_SUPPORTED = &H4000000
%QUALITY_SUPPORTED = &H8000000
%OPAQUE_RESULT = &H10000000

Remarks

Transform capabilities are determined by using the IDXTransform::GetMiscFlags method, and certain rendering options can be selected with the IDXTransform::SetMiscFlags method.

The constructor of the transform determines which of the _SUPPORTED flags are set for a transform. You need to use the IDXTransform::GetMiscFlags method to find out which of these transform flags are set. Transform users can only read the _SUPPORTED flags.

For example, if a call to IDXTransform::GetMiscFlags returns a value with the DXTMF_QUALITY_SUPPORTED flag set, you can use the IDXTransform::SetQuality and IDXTransform::GetQuality methods to adjust the rendering quality of the output.

Use the IDXTransform::SetMiscFlags method to change the DXTMF_BLEND_WITH_OUTPUT and DXTMF_DITHER_OUTPUT flags.
 

 

OPIDXLUTBUILDER

 

Lists the possible lookup table operations used by the lookup table builder interface, IDXLUTBuilder.

%DXLUTBUILDER_Gamma = 0
' Lookup table should perform a Gamma correction to the image.
%DXLUTBUILDER_Opacity = 1
' Lookup table should change the opacity of the image.
%DXLUTBUILDER_Brightness = 2
' Lookup table should change the brightness of the image.
%DXLUTBUILDER_Contrast = 3
' Lookup table should change the contrast of the image.
%DXLUTBUILDER_ColorBalance = 4
' Lookup table should change the color balance of the image.
%DXLUTBUILDER_Posterize = 5
' Lookup table should posterize the image.
%DXLUTBUILDER_Invert = 6
' Lookup table should invert the colors of the image.
%DXLUTBUILDER_Threshold = 7
' Lookup table should perform a threshold filtering of the data.
%DXLUTBUILDER_NUM_OPS = 8
' Number of valid lookup table operations, used for parameter validation.
 

 

dxtrans.idl

 

//------------------------------------------------------------------------------
//
//  Copyright Microsoft Corporation 1997-2000
//  All rights reserved.
//
//  File:   dxtrans.idl
//
//  Overview:
//      This is the IDL file for DirectX installable transform coclass, 
//      interface, and type definitions.
//
//------------------------------------------------------------------------------

cpp_quote("#include <servprov.h>")
cpp_quote("#include <ddraw.h>")
cpp_quote("#include <d3d.h>")
cpp_quote("#include <d3drm.h>")
cpp_quote("#include <urlmon.h>")

//--- Import base idl
import "oaidl.idl";
import "ocidl.idl";
import "servprov.idl";
import "comcat.idl";

//
//  Since direct draw does not have an IDL, we'll define DDSURFACEDESC to
//  be a void, but include ddraw.h in the header file.  This makes MIDL happy.
//
#ifndef DDSURFACEDESC
cpp_quote("#if 0")
cpp_quote("// Bogus definition used to make MIDL compiler happy")
typedef void DDSURFACEDESC;
typedef void D3DRMBOX;
typedef void D3DVECTOR;
typedef void D3DRMMATRIX4D;
typedef void* LPSECURITY_ATTRIBUTES;
cpp_quote("#endif")
#endif
//--- Additional includes

//--- Export
cpp_quote( "#ifdef _DXTRANSIMPL")
cpp_quote( "    #define _DXTRANS_IMPL_EXT _declspec(dllexport)")
cpp_quote( "#else")
cpp_quote( "    #define _DXTRANS_IMPL_EXT _declspec(dllimport)")
cpp_quote( "#endif")

//=== Forward References ====================================================
interface IDXTransformFactory;
interface IDXTransform;
interface IDXTaskManager;
interface IDXSurfaceFactory;
interface IDXSurface;
interface IDXARGBSurfaceInit;
interface IDXRawSurface;
interface IDXARGBReadPtr;
interface IDXARGBReadWritePtr;
interface IDXDCLock;
interface IDXTScale;
interface IDXLookupTable;
interface IDXTBindHost;
interface IBindHost;
interface IDXTScaleOutput;
interface IDXGradient;

//=== Constants =============================================================

cpp_quote("//")
cpp_quote("//   All GUIDs for DXTransform are declared in DXTGUID.C in the SDK include directory")
cpp_quote("//")
cpp_quote("EXTERN_C const GUID DDPF_RGB1;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB2;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB4;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB8;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB332;") 
cpp_quote("EXTERN_C const GUID DDPF_ARGB4444;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB565;") 
cpp_quote("EXTERN_C const GUID DDPF_BGR565;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB555;") 
cpp_quote("EXTERN_C const GUID DDPF_ARGB1555;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB24;") 
cpp_quote("EXTERN_C const GUID DDPF_BGR24;") 
cpp_quote("EXTERN_C const GUID DDPF_RGB32;") 
cpp_quote("EXTERN_C const GUID DDPF_BGR32;") 
cpp_quote("EXTERN_C const GUID DDPF_ABGR32;") 
cpp_quote("EXTERN_C const GUID DDPF_ARGB32;") 
cpp_quote("EXTERN_C const GUID DDPF_PMARGB32;") 
cpp_quote("EXTERN_C const GUID DDPF_A1;") 
cpp_quote("EXTERN_C const GUID DDPF_A2;") 
cpp_quote("EXTERN_C const GUID DDPF_A4;") 
cpp_quote("EXTERN_C const GUID DDPF_A8;") 
cpp_quote("EXTERN_C const GUID DDPF_Z8;") 
cpp_quote("EXTERN_C const GUID DDPF_Z16;") 
cpp_quote("EXTERN_C const GUID DDPF_Z24;") 
cpp_quote("EXTERN_C const GUID DDPF_Z32;") 
cpp_quote("//")
cpp_quote("//   Component categories")
cpp_quote("//")
cpp_quote("EXTERN_C const GUID CATID_DXImageTransform;")
cpp_quote("EXTERN_C const GUID CATID_DX3DTransform;")
cpp_quote("EXTERN_C const GUID CATID_DXAuthoringTransform;")
cpp_quote("EXTERN_C const GUID CATID_DXSurface;")
cpp_quote("//")
cpp_quote("//   Service IDs")
cpp_quote("//")
cpp_quote("EXTERN_C const GUID SID_SDirectDraw;")
cpp_quote("EXTERN_C const GUID SID_SDirect3DRM;")
cpp_quote("#define SID_SDXTaskManager CLSID_DXTaskManager")
cpp_quote("#define SID_SDXSurfaceFactory IID_IDXSurfaceFactory")
cpp_quote("#define SID_SDXTransformFactory IID_IDXTransformFactory")
cpp_quote("//")
cpp_quote("//   DXTransforms Core Type Library Version Info")
cpp_quote("//")
cpp_quote("#define DXTRANS_TLB_MAJOR_VER 1")
cpp_quote("#define DXTRANS_TLB_MINOR_VER 1")

//=== Struct & Enum definitions =============================================

//=== Interface definitions =================================================


//+-----------------------------------------------------------------------------
//
//  IDXBaseObject
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(17B59B2B-9CC8-11d1-9053-00C04FD9189D),
        helpstring("IDXBaseObject Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXBaseObject : IUnknown
    {
        HRESULT GetGenerationId( [out]ULONG *pID);
        HRESULT IncrementGenerationId([in] BOOL bRefresh);
        HRESULT GetObjectSize( [out] ULONG *pcbSize);
    };


//+-----------------------------------------------------------------------------
//
//  Bounding rectangle and vector structures.
//
//------------------------------------------------------------------------------

    //--- Dimension identifiers
    typedef enum DXBNDID
    {
        DXB_X = 0,
        DXB_Y = 1,
        DXB_Z = 2,
        DXB_T = 3
    } DXBNDID;

    //--- Bound types
    typedef enum DXBNDTYPE
    {
        DXBT_DISCRETE,
        DXBT_DISCRETE64,
        DXBT_CONTINUOUS,
        DXBT_CONTINUOUS64
    } DXBNDTYPE;

    //--- Discrete bounds (image & sound)
    typedef struct DXDBND
    {
        long  Min;    
        long  Max;
    } DXDBND;
    typedef DXDBND DXDBNDS[4];

    typedef struct DXDBND64
    {
        LONGLONG Min;    
        LONGLONG Max;
    } DXDBND64;
    typedef DXDBND64 DXDBNDS64[4];

    //--- Continuous bounds (geometry)
    typedef struct DXCBND
    {
        float Min;    
        float Max;
    } DXCBND;
    typedef DXCBND DXCBNDS[4];

    typedef struct DXCBND64
    {
        double Min;    
        double Max;
    } DXCBND64;
    typedef DXCBND64 DXCBNDS64[4];

    //--- Combined space
    typedef union DXBNDS switch( DXBNDTYPE eType ) u
    {
      case DXBT_DISCRETE:
        DXDBND D[4];
      case DXBT_DISCRETE64:
        DXDBND64 LD[4];
      case DXBT_CONTINUOUS:
        DXCBND C[4];
      case DXBT_CONTINUOUS64:
        DXCBND64 LC[4];
    } DXBNDS;

    //--- Discrete 4D vector
    typedef long DXDVEC[4];
    typedef LONGLONG DXDVEC64[4];

    //--- Continous 4D vector
    typedef float DXCVEC[4];
    typedef double DXCVEC64[4];

    //--- Combined space vector
    typedef union DXVEC switch( DXBNDTYPE eType ) u
    {
      case DXBT_DISCRETE:
        long D[4];
      case DXBT_DISCRETE64:
        LONGLONG LD[4];
      case DXBT_CONTINUOUS:
        float C[4];
      case DXBT_CONTINUOUS64:
        double LC[4];
    } DXVEC;


//+-----------------------------------------------------------------------------
//
//  IDXTransformFactory
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(6A950B2B-A971-11d1-81C8-0000F87557DB),
        helpstring("IDXTransformFactory Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTransformFactory : IServiceProvider
    {
        HRESULT SetService( [in]REFGUID guidService, 
                            [in]IUnknown *pUnkService,
                            [in]BOOL bWeakReference);

        HRESULT CreateTransform( [in, size_is(ulNumInputs)]IUnknown** punkInputs,
                                 [in]ULONG ulNumInputs,
                                 [in, size_is(ulNumOutputs)]IUnknown** punkOutputs,
                                 [in]ULONG ulNumOutputs,
                                 [in]IPropertyBag* pInitProps, [in]IErrorLog* pErrLog,
                                 [in]REFCLSID TransCLSID, [in]REFIID TransIID,
                                 [out, iid_is(TransIID)]void** ppTransform );

        HRESULT InitializeTransform( [in]IDXTransform* pTransform,
                                     [in, size_is(ulNumInputs)]IUnknown** punkInputs,
                                     [in]ULONG ulNumInputs,
                                     [in, size_is(ulNumOutputs)]IUnknown** punkOutputs,
                                     [in]ULONG ulNumOutputs,
                                     [in]IPropertyBag* pInitProps, [in]IErrorLog* pErrLog );
    };


//+-----------------------------------------------------------------------------
//
//  IDXTransform
//
//------------------------------------------------------------------------------

    typedef enum DXTMISCFLAGS
    {
        DXTMF_BLEND_WITH_OUTPUT   = ( 1L << 0 ),
        DXTMF_DITHER_OUTPUT       = ( 1L << 1 ),
        DXTMF_OPTION_MASK         = (0x0000FFFF),   // Low word is settable options
        DXTMF_VALID_OPTIONS       = (DXTMF_BLEND_WITH_OUTPUT | DXTMF_DITHER_OUTPUT),
        //
        //  Status flags can not be changed by call to SetMiscFlags
        //
        DXTMF_BLEND_SUPPORTED     = ( 1L << 16 ),
        DXTMF_DITHER_SUPPORTED    = ( 1L << 17 ),
        DXTMF_INPLACE_OPERATION   = ( 1L << 24 ),
        DXTMF_BOUNDS_SUPPORTED    = ( 1L << 25 ),
        DXTMF_PLACEMENT_SUPPORTED = ( 1L << 26 ),
        DXTMF_QUALITY_SUPPORTED   = ( 1L << 27 ),
        DXTMF_OPAQUE_RESULT       = ( 1L << 28 )
    } DXTMISCFLAGS;

    typedef enum DXINOUTINFOFLAGS
    {
        DXINOUTF_OPTIONAL = ( 1L << 0)
    } DXINOUTINFOFLAGS;

    [
        object,
        uuid(30A5FB78-E11F-11d1-9064-00C04FD9189D),
        helpstring("IDXTransform Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTransform : IDXBaseObject
    {
        HRESULT Setup( [in, size_is(ulNumInputs)] IUnknown * const * punkInputs,
                       [in]ULONG ulNumInputs,
                       [in, size_is(ulNumOutputs)] IUnknown * const * punkOutputs,
                       [in]ULONG ulNumOutputs,
                       [in]DWORD dwFlags );
        HRESULT Execute( [in]const GUID* pRequestID, [in]const DXBNDS *pClipBnds,
                         [in]const DXVEC *pPlacement );
        HRESULT MapBoundsIn2Out( [in] const DXBNDS *pInBounds,
                                 [in]ULONG ulNumInBnds,
                                 [in]ULONG ulOutIndex,
                                 [out]DXBNDS *pOutBounds );
        HRESULT MapBoundsOut2In( [in] ULONG ulOutIndex,
                                 [in] const DXBNDS *pOutBounds,
                                 [in] ULONG ulInIndex,
                                 [out]DXBNDS *pInBounds );
        HRESULT SetMiscFlags( [in] DWORD dwMiscFlags);
        HRESULT GetMiscFlags( [out]DWORD * pdwMiscFlags );
        HRESULT GetInOutInfo( [in]BOOL bIsOutput, [in]ULONG ulIndex,
                              [out]DWORD *pdwFlags, [out, size_is(*pcIDs)] GUID *pIDs,
                              [in, out] ULONG *pcIDs,
                              [out] IUnknown **ppUnkCurrentObject);
        HRESULT SetQuality( [in] float fQuality );
        HRESULT GetQuality( [out] float * fQuality );
    };


//+-----------------------------------------------------------------------------
//
//  IDXSurfacePick
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(30A5FB79-E11F-11d1-9064-00C04FD9189D),
        helpstring("IDXSurfacePick Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXSurfacePick : IUnknown
    {
        HRESULT PointPick([in]const DXVEC *pPoint,
                          [out]ULONG * pulInputSurfaceIndex,
                          [out]DXVEC *pInputPoint);
    };


//+-----------------------------------------------------------------------------
//
//  IDXTBindHost
//
//  Overview:
//      This interface is used to set a site-specific bind host for a transform.
//      Only transforms that need access to a bind host need to implement this 
//      interface.
//
//      For some reason, MIDL does not like IBindHost, so we've declared this
//      interface local.
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(D26BCE55-E9DC-11d1-9066-00C04FD9189D),
        helpstring("IDXTBindHost Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTBindHost : IUnknown
    {
        HRESULT SetBindHost([in] IBindHost * pBindHost);
    };


//+-----------------------------------------------------------------------------
//
//  IDXTaskManager

//
//  Overview:
//      This interface is used to implement a task managment service provider to
//      optimize thread usage.
//
//------------------------------------------------------------------------------

    typedef void (__stdcall DXTASKPROC)(void *pTaskData, BOOL* pbContinueProcessing );
    typedef DXTASKPROC *PFNDXTASKPROC;

    typedef void (__stdcall DXAPCPROC)(DWORD dwData);
    typedef DXAPCPROC *PFNDXAPCPROC;

cpp_quote("#ifdef __cplusplus")

    cpp_quote("typedef struct DXTMTASKINFO" )
    cpp_quote("{")
    cpp_quote("    PFNDXTASKPROC pfnTaskProc;       // Pointer to function to execute")
    cpp_quote("    PVOID         pTaskData;         // Pointer to argument data")
    cpp_quote("    PFNDXAPCPROC  pfnCompletionAPC;  // Pointer to completion APC proc")
    cpp_quote("    DWORD         dwCompletionData;  // Pointer to APC proc data")
    cpp_quote("    const GUID*   pRequestID;        // Used to identify groups of tasks")
    cpp_quote("} DXTMTASKINFO;")

cpp_quote("#else")

        typedef struct DXTMTASKINFO
        {
            PVOID       pfnTaskProc;       // Pointer to function to execute
            PVOID       pTaskData;         // Pointer to argument data
            PVOID       pfnCompletionAPC;  // Pointer to completion APC proc
            DWORD       dwCompletionData;  // Pointer to APC proc data
            const GUID* pRequestID;        // Used to identify groups of tasks
        } DXTMTASKINFO;

cpp_quote("#endif")

    [
        object,
        uuid(254DBBC1-F922-11d0-883A-3C8B00C10000),
        helpstring("IDXTaskManager Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXTaskManager : IUnknown
    {
        HRESULT QueryNumProcessors( [out]ULONG* pulNumProc );
        HRESULT SetThreadPoolSize( [in]ULONG ulNumThreads );
        HRESULT GetThreadPoolSize( [out]ULONG* pulNumThreads );
        HRESULT SetConcurrencyLimit( [in]ULONG ulNumThreads );
        HRESULT GetConcurrencyLimit( [out]ULONG* pulNumThreads );
        HRESULT ScheduleTasks( [in]DXTMTASKINFO TaskInfo[],
                               [in]HANDLE Events[],
                               [out]DWORD TaskIDs[],
                               [in]ULONG ulNumTasks, [in]ULONG ulWaitPeriod );
        HRESULT TerminateTasks( [in]DWORD TaskIDs[], [in]ULONG ulCount,
                                [in]ULONG ulTimeOut );
        HRESULT TerminateRequest( [in]REFIID RequestID, [in]ULONG ulTimeOut );
    };


//+-----------------------------------------------------------------------------
//
//  Sample structures (C++)
//
//  Overview:
//      We want an operator so that we can cast from a DXSAMPLE to a DWORD, so 
//      for C++ we will define the structure a special way.
//
//------------------------------------------------------------------------------

cpp_quote("#ifdef __cplusplus")

    cpp_quote("/////////////////////////////////////////////////////")
    cpp_quote("")
    cpp_quote("class DXBASESAMPLE;")
    cpp_quote("class DXSAMPLE;")
    cpp_quote("class DXPMSAMPLE;")
    cpp_quote("")
    cpp_quote("/////////////////////////////////////////////////////")
    cpp_quote("")
    cpp_quote("class DXBASESAMPLE")
    cpp_quote("{")
    cpp_quote("public:")
    cpp_quote("    BYTE Blue;")
    cpp_quote("    BYTE Green;")
    cpp_quote("    BYTE Red;")
    cpp_quote("    BYTE Alpha;")
    cpp_quote("    DXBASESAMPLE() {}")
    cpp_quote("    DXBASESAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) :")
    cpp_quote("        Alpha(alpha),")
    cpp_quote("        Red(red),")
    cpp_quote("        Green(green),")
    cpp_quote("        Blue(blue) {}")
    cpp_quote("    DXBASESAMPLE(const DWORD val) { *this = (*(DXBASESAMPLE *)&val); }")
    cpp_quote("    operator DWORD () const {return *((DWORD *)this); }")
    cpp_quote("    DWORD operator=(const DWORD val) { return *this = *((DXBASESAMPLE *)&val); }")
    cpp_quote("}; // DXBASESAMPLE")
    cpp_quote("")
    cpp_quote("/////////////////////////////////////////////////////")
    cpp_quote("")
    cpp_quote("class DXSAMPLE : public DXBASESAMPLE")
    cpp_quote("{")
    cpp_quote("public:")
    cpp_quote("    DXSAMPLE() {}")
    cpp_quote("    DXSAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) :")
    cpp_quote("         DXBASESAMPLE(alpha, red, green, blue) {}")
    cpp_quote("    DXSAMPLE(const DWORD val) { *this = (*(DXSAMPLE *)&val); }")
    cpp_quote("    operator DWORD () const {return *((DWORD *)this); }")
    cpp_quote("    DWORD operator=(const DWORD val) { return *this = *((DXSAMPLE *)&val); }")
    cpp_quote("    operator DXPMSAMPLE() const;")
    cpp_quote("}; // DXSAMPLE")
    cpp_quote("")
    cpp_quote("/////////////////////////////////////////////////////")
    cpp_quote("")
    cpp_quote("class DXPMSAMPLE : public DXBASESAMPLE")
    cpp_quote("{")
    cpp_quote("public:")
    cpp_quote("    DXPMSAMPLE() {}")
    cpp_quote("    DXPMSAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) :")
    cpp_quote("         DXBASESAMPLE(alpha, red, green, blue) {}")
    cpp_quote("    DXPMSAMPLE(const DWORD val) { *this = (*(DXPMSAMPLE *)&val); }")
    cpp_quote("    operator DWORD () const {return *((DWORD *)this); }")
    cpp_quote("    DWORD operator=(const DWORD val) { return *this = *((DXPMSAMPLE *)&val); }")
    cpp_quote("    operator DXSAMPLE() const;")
    cpp_quote("}; // DXPMSAMPLE")
    cpp_quote("")
    cpp_quote("//")
    cpp_quote("// The following cast operators are to prevent a direct assignment of a DXSAMPLE to a DXPMSAMPLE")
    cpp_quote("//")
    cpp_quote("inline DXSAMPLE::operator DXPMSAMPLE() const { return *((DXPMSAMPLE *)this); }")
    cpp_quote("inline DXPMSAMPLE::operator DXSAMPLE() const { return *((DXSAMPLE *)this); }")


//+-----------------------------------------------------------------------------
//
//  Sample structures (IDL, C)
//
//------------------------------------------------------------------------------

cpp_quote("#else // !__cplusplus")

    typedef struct DXBASESAMPLE
    {
        BYTE Blue;
        BYTE Green;
        BYTE Red; 
        BYTE Alpha;
    } DXBASESAMPLE;

    typedef struct DXSAMPLE
    {
        BYTE Blue;
        BYTE Green;
        BYTE Red; 
        BYTE Alpha;
    } DXSAMPLE;

    typedef struct DXPMSAMPLE
    {
        BYTE Blue;
        BYTE Green;
        BYTE Red; 
        BYTE Alpha;
    } DXPMSAMPLE;

cpp_quote("#endif // !__cplusplus")

//+-----------------------------------------------------------------------------
//
//  DXRUNINFO structures.
//
//------------------------------------------------------------------------------

    typedef enum DXRUNTYPE
    {
        DXRUNTYPE_CLEAR  = 0,        // The run is zero Alpha
        DXRUNTYPE_OPAQUE = 1,        // The run is full Alpha (i.e. 255)
        DXRUNTYPE_TRANS  = 2,        // The run is non-zero Alpha
        DXRUNTYPE_UNKNOWN= 3         // The run type is unknown.  Caller must inspect.
    } DXRUNTYPE;

    const ULONG DX_MAX_RUN_INFO_COUNT = 128; // Defines the maximum number of RUNINFOs in a single row


    cpp_quote("// Ignore the definition used by MIDL for TLB generation")
    cpp_quote("#if 0")

    typedef struct DXRUNINFO
    {
        ULONG Bitfields;
    } DXRUNINFO;

    cpp_quote("#endif // 0")

    // Emit the C definition to the H file directly, as bit fields are not
    // supported by MIDL.

    cpp_quote("typedef struct DXRUNINFO")
    cpp_quote("{")
    cpp_quote("    ULONG   Type  : 2;   // Type")
    cpp_quote("    ULONG   Count : 30;  // Number of samples in run")
    cpp_quote("} DXRUNINFO;")


    typedef enum DXSFCREATE
    {
        DXSF_FORMAT_IS_CLSID    = ( 1L << 0 ),
        DXSF_NO_LAZY_DDRAW_LOCK = ( 1L << 1 )
    } DXSFCREATE;

    typedef enum DXBLTOPTIONS
    {
        DXBOF_DO_OVER          = (1L << 0),
        DXBOF_DITHER           = (1L << 1)
    } DXBLTOPTIONS;


//+-----------------------------------------------------------------------------
//
//  IDXSurfaceModifier
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(144946F5-C4D4-11d1-81D1-0000F87557DB),
        helpstring("IDXSurfaceFactory Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXSurfaceFactory : IUnknown
    {
        HRESULT CreateSurface([in] IUnknown *pDirectDraw,
                              [in] const DDSURFACEDESC * pDDSurfaceDesc,
                              [in] const GUID * pFormatID,
                              [in] const DXBNDS *pBounds, 
                              [in] DWORD dwFlags,
                              [in] IUnknown *punkOuter,
                              [in] REFIID riid, 
                              [out, iid_is( riid )] void ** ppDXSurface);

        HRESULT CreateFromDDSurface([in] IUnknown *pDDrawSurface,
                              [in] const GUID *pFormatID,
                              [in] DWORD dwFlags,
                              [in] IUnknown *punkOuter,
                              [in] REFIID riid, 
                              [out, iid_is( riid )] void ** ppDXSurface);

        HRESULT LoadImage(
                          [in] const LPWSTR pszFileName,
                          [in] IUnknown *pDirectDraw,
                          [in] const DDSURFACEDESC * pDDSurfaceDesc,
                          [in] const GUID *pFormatID,
                          [in] REFIID riid, 
                          [out, iid_is( riid )] void ** ppDXSurface);

        HRESULT LoadImageFromStream([in] IStream *pStream,
                                    [in] IUnknown *pDirectDraw,
                                    [in] const DDSURFACEDESC * pDDSurfaceDesc,
                                    [in] const GUID *pFormatID,
                                    [in] REFIID riid, 
                                    [out, iid_is( riid )] void ** ppDXSurface);

        HRESULT CopySurfaceToNewFormat( [in]IDXSurface* pSrc,
                                                [in] IUnknown *pDirectDraw,
                                                [in] const DDSURFACEDESC * pDDSurfaceDesc,
                                                [in] const GUID *pDestFormatID,
                                                [out] IDXSurface** ppNewSurface );

        HRESULT CreateD3DRMTexture([in] IDXSurface *pSrc,
                                           [in] IUnknown *pDirectDraw,
                                           [in] IUnknown *pD3DRM3,
                                           [in] REFIID riid,
                                           [out, iid_is(riid)] void **ppTexture3);

        HRESULT BitBlt([in] IDXSurface *pDest,
                       [in] const DXVEC *pPlacement,
                       [in] IDXSurface *pSrc,
                       [in] const DXBNDS *pClipBounds,
                       [in] DWORD dwFlags);
    };


//+-----------------------------------------------------------------------------
//
//  IDXSurfaceModifier
//
//------------------------------------------------------------------------------

    typedef enum DXSURFMODCOMPOP
    {
        DXSURFMOD_COMP_OVER         = 0,
        DXSURFMOD_COMP_ALPHA_MASK   = 1,
        DXSURFMOD_COMP_MAX_VALID    = 1
    } DXSURFMODCOMPOP;
    
    [
        object,
        uuid(9EA3B637-C37D-11d1-905E-00C04FD9189D),
        helpstring("IDXSurfaceModifier Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXSurfaceModifier : IUnknown
    {
        HRESULT SetFillColor([in] DXSAMPLE Color);
        HRESULT GetFillColor([out] DXSAMPLE *pColor);
        HRESULT SetBounds([in] const DXBNDS *pBounds ); // Get supported though IDXSurface interface
        HRESULT SetBackground([in] IDXSurface *pSurface);
        HRESULT GetBackground([out] IDXSurface **ppSurface);
        HRESULT SetCompositeOperation([in] DXSURFMODCOMPOP CompOp);
        HRESULT GetCompositeOperation([out] DXSURFMODCOMPOP *pCompOp);
        //
        //  The following methods only apply to the FOREGROUND surface
        //
        HRESULT SetForeground([in] IDXSurface *pSurface, [in] BOOL bTile, [in] const POINT * pOrigin);
        HRESULT GetForeground([out] IDXSurface **ppSurface, [out] BOOL *pbTile, [out] POINT * pOrigin);
        HRESULT SetOpacity([in] float Opacity);
        HRESULT GetOpacity([out] float *pOpacity);    
        HRESULT SetLookup( [in]IDXLookupTable * pLookupTable );
        HRESULT GetLookup( [out]IDXLookupTable ** ppLookupTable );
    };


//+-----------------------------------------------------------------------------
//
//  IDXSurface
//
//------------------------------------------------------------------------------

    typedef enum DXSAMPLEFORMATENUM
    {
        DXPF_FLAGSMASK      = (0xFFFF0000), // Top word is flags, low word is enum  
        DXPF_NONPREMULT     = (0x00010000), // Flags to be OR'd with pixel formats
        DXPF_TRANSPARENCY   = (0x00020000), // Color key or one-bit alpha (alpha only 0 or 0xFF)
        DXPF_TRANSLUCENCY   = (0x00040000), // Alpha can be any value from 0->0xFF
        //
        //  This 3-bit field is used to determine what type of dithering to be used
        //  
        DXPF_2BITERROR      = (0x00200000), // 2 bits of error term 
        DXPF_3BITERROR      = (0x00300000), // 3 bits of error term for color (16-bit color)
        DXPF_4BITERROR      = (0x00400000), // 4 bits of error term (ARGB 4444)
        DXPF_5BITERROR      = (0x00500000), // 5 bits of error term for color (8-bit color)
        DXPF_ERRORMASK      = (0x00700000), // Mask of bits used for dithering

        DXPF_NONSTANDARD    = (0),  // To be used for any surface that is not one of the following formats
                                    // This can be combined with DXPFNONPREMULT if the surface can work
                                    // better in non-premultiplied space.
        DXPF_PMARGB32       = (1 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY),
        DXPF_ARGB32         = (2 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY),
        DXPF_ARGB4444       = (3 | DXPF_NONPREMULT | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY | DXPF_4BITERROR),
        DXPF_A8             = (4 | DXPF_TRANSPARENCY | DXPF_TRANSLUCENCY),
        DXPF_RGB32          = (5),
        DXPF_RGB24          = (6),
        DXPF_RGB565         = (7 | DXPF_3BITERROR),
        DXPF_RGB555         = (8 | DXPF_3BITERROR),
        DXPF_RGB8           = (9 | DXPF_5BITERROR),
        DXPF_ARGB1555       = (10 | DXPF_TRANSPARENCY | DXPF_3BITERROR),
        DXPF_RGB32_CK       = (DXPF_RGB32 | DXPF_TRANSPARENCY),
        DXPF_RGB24_CK       = (DXPF_RGB24 | DXPF_TRANSPARENCY),
        DXPF_RGB555_CK      = (DXPF_RGB555 | DXPF_TRANSPARENCY),
        DXPF_RGB565_CK      = (DXPF_RGB565 | DXPF_TRANSPARENCY),
        DXPF_RGB8_CK        = (DXPF_RGB8 | DXPF_TRANSPARENCY)
    } DXSAMPLEFORMATENUM;

    typedef enum DXLOCKSURF
    {
        DXLOCKF_READ        =       0,
        DXLOCKF_READWRITE   =       (1 << 0),
        DXLOCKF_EXISTINGINFOONLY =  (1 << 1),   // If used in conjunction with WANTRUNINFO will prevent creation of a runmap if one does not exist
        DXLOCKF_WANTRUNINFO =       (1 << 2),
        //
        // The flags in the high word should be specific to the type of pointer that
        // is requested.  These flags define ARGB flags.  These flags are advisory and
        // are not required to be set for ARGB locks.
        //
        DXLOCKF_NONPREMULT  =   (1 << 16),    // Caller will request non-premultiplied data
        DXLOCKF_VALIDFLAGS  =   (DXLOCKF_READWRITE | DXLOCKF_EXISTINGINFOONLY | DXLOCKF_WANTRUNINFO | DXLOCKF_NONPREMULT)
    } DXLOCKSURF;

    typedef enum DXSURFSTATUS
    {
        DXSURF_TRANSIENT    =   (1 << 0),   // Data in this surface changes often.    
        DXSURF_READONLY     =   (1 << 1),   // Surface is read-only
        DXSURF_VALIDFLAGS   =   (DXSURF_TRANSIENT | DXSURF_READONLY)    
    } DXSURFSTATUS;

    [
        object,
        uuid(B39FD73F-E139-11d1-9065-00C04FD9189D),
        helpstring("IDXSurface Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXSurface : IDXBaseObject
    {
        HRESULT GetPixelFormat([out] GUID * pFormatID, [out] DXSAMPLEFORMATENUM *pSampleFormatEnum); 
        HRESULT GetBounds( [out]DXBNDS *pBounds );
        HRESULT GetStatusFlags([out] DWORD * pdwStatusFlags);
        HRESULT SetStatusFlags([in] DWORD dwStatusFlags);
        HRESULT LockSurface( [in]const DXBNDS *pBounds, [in]ULONG ulTimeOut, [in]DWORD dwFlags, 
                             [in]REFIID riid, [out, iid_is(riid)] void **ppPointer,
                             [out]ULONG* pulGenerationId );
        HRESULT GetDirectDrawSurface( [in] REFIID riid,
                                      [out, iid_is(riid)] void ** ppSurface);
        HRESULT GetColorKey(DXSAMPLE * pColorKey);  // Can return E_NOTIMPL
        HRESULT SetColorKey(DXSAMPLE ColorKey);     // Set color of 0 to get rid of color key, can return E_NOTIMPL
        HRESULT LockSurfaceDC( [in] const DXBNDS *pBounds, [in]ULONG ulTimeOut, [in] DWORD dwFlags,
                               [out] IDXDCLock **ppDCLock);
        HRESULT SetAppData(DWORD_PTR dwAppData);
        HRESULT GetAppData(DWORD_PTR *pdwAppData);
    };


//+-----------------------------------------------------------------------------
//
//  IDXSurfaceInit
//
//------------------------------------------------------------------------------

    [
        object,
        uuid(9EA3B639-C37D-11d1-905E-00C04FD9189D),
        helpstring("IDXSurfaceInit Interface"),
        pointer_default(unique),
        local
    ]
    interface IDXSurfaceInit : IUnknown
    {
        HRESULT InitSurface([in] IUnknown *pDirectDraw,
                            [in] const DDSURFACEDESC *pDDSurfaceDesc,
                            [in] const GUID * pFormatID,
                            [in] const DXBNDS *pBounds,
                            [in] DWORD dwFlags);
    };


//+-----------------------------------------------------------------------------
//
//  IDXARGBSurfaceInit
//
//------------------------------------------------------------------------------