Share via


CreateFromDDSurface method

Creates a DXSurface that contains a specified DirectDrawSurface object.

Syntax

HRESULT retVal = object.CreateFromDDSurface(pDDrawSurface, pFormatID, dwFlags, punkOuter, riid, ppDXSurface);

Parameters

  • pDDrawSurface [in]
    Type: IUnknown

    Pointer to a DirectDrawSurface object to wrap with a new DXSurface.

  • pFormatID [in]
    Type: const GUID

    Optional pointer to the source pixel format. If NULL, the pixel format of the DirectDrawSurface object is used. If non-NULL, the pixel format of the DirectDrawSurface object is ignored, and the data is treated as though it were the format specified by this GUID. This is usually used to force a DirectDrawSurface object that has no alpha channel to be treated as a 32-bit surface with alpha.

  • dwFlags [in]
    Type: DWORD

    DXSFCREATE creation flags. A value of DXSF_FORMAT_IS_CLSID specifies that the pFormatID parameter is the CLSID of a custom surface implementation.

  • punkOuter [in]
    Type: IUnknown

    Optional outer IUnknown interface pointer for aggregation.

  • riid [in]
    Type: REFIID

    Interface to return from the new surface.

  • ppDXSurface [out]
    Type: void

    Address of a pointer to the new interface.

Remarks

The default behavior for a system memory DXSurface is to do all lock arbitration at the DXSurface level for performance and correct lock behavior. The DirectDrawSurface object is locked once to obtain a memory pointer and then released. If the user plans to access the underlying IDirectDrawSurface::Lock method directly (not via the DXSurface interface), DXSF_NO_LAZY_DDRAW_LOCK must be used. In this case, a lock to the DXSurface always locks the underlying DirectDrawSurface object, assuring safe access. This is the default for video-memory-based surfaces.

The resulting DXSurface uses the source color key of the underlying DirectDrawSurface object.

See also

Reference

IDXSurfaceFactory::CreateSurface

DXSFCREATE