Functions
Using the Blitter

Functions

HRESULT D3DBlt (CVD3DOBJECT d3dObjectSource, CVD3DOBJECT d3dObjectTarget)
 This function blits a given source surface/ texture to a given destination surface/ texture.
 
HRESULT D3DBltRect (CVD3DOBJECT d3dObjectSource, const RECT *pSourceRect, CVD3DOBJECT d3dObjectTarget, const RECT *pTargetRect)
 This function blits a given source surface/ texture to a given destination surface/ texture.
 
HRESULT D3DCreateSurface (CVD3D d3d, DWORD dwWidth, DWORD dwHeight, TColorFormat tcf, CVD3DOBJECT &d3dObject)
 Creates a surface render target.
 
HRESULT D3DCreateSurfaceEntrance (CVD3D d3d, DWORD dwWidth, DWORD dwHeight, TColorFormat tcf, CVD3DOBJECT &d3dObject)
 Creates a source surface.
 
HRESULT D3DGetBackbuffer (CVD3D d3d, CVD3DOBJECT &d3dObject)
 Returns the backbuffer attached to the given D3D context.
 
BOOL D3DIsBltSource (CVD3DOBJECT d3dObject)
 This function checks whether or not the given object can be used as a source for blit operations.
 
BOOL D3DIsBltTarget (CVD3DOBJECT d3dObject)
 This function checks whether or not the given object can be used as a target for blit operations.
 

Detailed Description

Function Documentation

HRESULT D3DBlt ( CVD3DOBJECT  d3dObjectSource,
CVD3DOBJECT  d3dObjectTarget 
)

This function blits a given source surface/ texture to a given destination surface/ texture.

The image will be stretched during blitting if the image sizes don't match.

Attention
As blitting is done by the graphics driver the capability to blit from a defined source to a defined target varies from driver to driver. The following table lists the capabilities of a GeForce 9800 graphics card:

XRGB TargetsXRGB Source
 SurfaceEntranceSurfaceTextureEntranceTexture
WriteImageToObjectokokok-
Blt to Backbufferokok-ok
Blt to SurfaceEntranceok---
Blt to Surfaceokok-ok
Blt to TextureEntrance----
Blt to Textureokok-ok
Parameters
[in]d3dObjectSourceThe source surface.
[in]d3dObjectTargetThe destination surface.
Returns
0 if no error occurred, otherwise a value != 0 indicates the error code.
Supported platforms:
Win32
Win64
Related Topics:
Glossary
D3DBltRect
D3DCreateSurfaceEntrance
D3DCreateSurface
D3DCreateTextureEntrance
D3DCreateTexture
D3DIsBltSource
D3DIsBltTarget
Examples:
Visual C++ - VC Sliding Average Example
Sample Code in Visual C++:
...
// create a source texture
D3DCreateTextureEntrance (m_D3D, dwWidth, dwHeight, TCF_XRGB, m_D3DTextureSrc);
...
// create a destination texture
D3DCreateTexture (m_D3D, dwWidth, dwHeight, TCF_XRGB, m_D3DTextureDst);
...
// create a destination surface
D3DCreateSurface (m_D3D, dwWidth, dwHeight, TCF_XRGB, m_D3DSurfaceDst);
...
...
// ...and render it to the dst surface
D3DRender (m_D3DTextureSrc, m_D3DSurfaceDst, m_D3DActiveShader);
// copy dst Surface to the second input texture
D3DBlt (m_D3DSurfaceDst, m_D3DTextureDst);
...
HRESULT D3DBltRect ( CVD3DOBJECT  d3dObjectSource,
const RECT *  pSourceRect,
CVD3DOBJECT  d3dObjectTarget,
const RECT *  pTargetRect 
)

This function blits a given source surface/ texture to a given destination surface/ texture.

source and a target rectangular AOI are supported. The image will be stretched during blitting if the image sizes of the two AOIs don't match. If both AOIs are set to NULL the function behaves like D3DBlt.

Attention
As blitting is done by the graphics driver the capability to blit from a defined source to a defined target varies from driver to driver. The following table lists the capabilities of a GeForce 9800 graphics card:

XRGB TargetsXRGB Source
 SurfaceEntranceSurfaceTextureEntranceTexture
WriteImageToObjectokokok-
Blt to Backbufferokok-ok
Blt to SurfaceEntranceok---
Blt to Surfaceokok-ok
Blt to TextureEntrance----
Blt to Textureokok-ok
Parameters
[in]d3dObjectSourceThe source surface.
[in]pSourceRectThe source AOI.
[in]d3dObjectTargetThe destination surface.
[in]pTargetRectThe destination AOI.
Returns
0 if no error occurred, otherwise a value != 0 indicates the error code.
Supported platforms:
Win32
Win64
Related Topics:
Glossary
D3DBlt
D3DCreateSurfaceEntrance
D3DCreateSurface
D3DCreateTextureEntrance
D3DCreateTexture
D3DIsBltSource
D3DIsBltTarget
Examples:
Visual C++ - VC Sliding Average Example
Sample Code in Visual C++:
...
// create a source texture
D3DCreateTextureEntrance (m_D3D, dwWidth, dwHeight, TCF_XRGB, m_D3DTextureSrc);
...
// create a destination texture
D3DCreateTexture (m_D3D, dwWidth, dwHeight, TCF_XRGB, m_D3DTextureDst);
...
// create a destination surface
D3DCreateSurface (m_D3D, dwWidth, dwHeight, TCF_XRGB, m_D3DSurfaceDst);
...
...
// ...and render it to the dst surface
D3DRender (m_D3DTextureSrc, m_D3DSurfaceDst, m_D3DActiveShader);
// copy dst Surface to the second input texture
D3DBlt (m_D3DSurfaceDst, m_D3DTextureDst);
...
HRESULT D3DCreateSurface ( CVD3D  d3d,
DWORD  dwWidth,
DWORD  dwHeight,
TColorFormat  tcf,
CVD3DOBJECT d3dObject 
)

Creates a surface render target.

The object may be used to render another object to itself. It may also be used as a source or target for blitting operations. To transfer the image back to the host call D3DUpdate after rendering.

Attention
Reference counting is implemented using the ShareObject and ReleaseObject functions of the Image Manager. To finally free the object use ReleaseObject.
Parameters
[in]d3dThe D3D context.
[in]dwWidthThe width of the image (has to be less or equal to the maximum width of the D3D context).
[in]dwHeightThe height of the image (has to be less or equal to the maximum height of the D3D context).
[in]tcfThe colour format of the image. See TColorFormat for possible colour formats.
[out]d3dObjectHandle to the newly created CVD3DOBJECT object.
Returns
0 if no error occurred, otherwise a value != 0 indicates the error code.
Supported platforms:
Win32
Win64
Related Topics:
D3DGetObjectInfo
D3DCreate
D3DCreateTextureEntrance
D3DCreateTexture
D3DCreateSurfaceEntrance
D3DCreateMirror
Examples:
Visual C++ - VC Sliding Average Example
HRESULT D3DCreateSurfaceEntrance ( CVD3D  d3d,
DWORD  dwWidth,
DWORD  dwHeight,
TColorFormat  tcf,
CVD3DOBJECT d3dObject 
)

Creates a source surface.

Typically you will write a host image to this surface using D3DWriteImageToObject and use it as a source for blitting operations.

Attention
Reference counting is implemented using the ShareObject and ReleaseObject functions of the Image Manager. To finally free the object use ReleaseObject.
Parameters
[in]d3dThe D3D context.
[in]dwWidthThe width of the image which has to be less or equal to the maximum width of the D3D context.
[in]dwHeightThe height of the image which has to be less or equal to the maximum height of the D3D context.
[in]tcfThe colour format of the image. See TColorFormat for possible colour formats.
[out]d3dObjectHandle to the newly created CVD3DOBJECT object.
Returns
0 if no error occurred, otherwise a value != 0 indicates the error code.
Supported platforms:
Win32
Win64
Related Topics:
D3DGetObjectInfo
D3DCreate
D3DCreateTextureEntrance
D3DCreateTexture
D3DCreateSurface
D3DCreateMirror
HRESULT D3DGetBackbuffer ( CVD3D  d3d,
CVD3DOBJECT d3dObject 
)

Returns the backbuffer attached to the given D3D context.

The object can be used as a source or target for blitting operations.

Attention
Use ReleaseObject to free the memory.
Parameters
[in]d3dThe D3D context.
[out]d3dObjectCVD3DOBJECT pointing to the backbuffer.
Returns
0 if no error occurred, otherwise a value != 0 indicates the error code.
Supported platforms:
Win32
Win64
Related Topics:
Glossary
D3DPresentBackbuffer
BOOL D3DIsBltSource ( CVD3DOBJECT  d3dObject)

This function checks whether or not the given object can be used as a source for blit operations.

Parameters
[in]d3dObjectHandle to the object to be processed.
Returns
TRUE if it can be used as a blit source, FALSE otherwise.
Supported platforms:
Win32
Win64
Related Topics:
Glossary
D3DCreateSurfaceEntrance
D3DCreateSurface
D3DCreateTextureEntrance
D3DCreateTexture
D3DBlt
D3DBltRect
D3DIsBltTarget
D3DIsRenderSource
D3DIsRenderTarget
Examples:
Delphi - Delphi BayerToRGB Example
Visual Basic .Net - VB.NET GPU Example
Visual C++ - VC GPU Demo
BOOL D3DIsBltTarget ( CVD3DOBJECT  d3dObject)

This function checks whether or not the given object can be used as a target for blit operations.

Parameters
[in]d3dObjectHandle to the object to be processed.
Returns
TRUE if it can be used as a blit target, FALSE otherwise.
Supported platforms:
Win32
Win64
Related Topics:
Glossary
D3DCreateSurfaceEntrance
D3DCreateSurface
D3DCreateTextureEntrance
D3DCreateTexture
D3DBlt
D3DBltRect
D3DIsBltSource
D3DIsRenderSource
D3DIsRenderTarget
Examples:
Delphi - Delphi BayerToRGB Example
Visual Basic .Net - VB.NET GPU Example
Visual C++ - VC GPU Demo