coastline 0.0.4
Loading...
Searching...
No Matches
ddutil.h File Reference

The helpers of DirectDraw that load bitmaps into surfaces, match colours to the pixels of a surface, and set colour keys. More...

#include <windows.h>
#include <ddraw.h>
Include dependency graph for ddutil.h:

Go to the source code of this file.

Functions

IDirectDrawSurface * DDLoadBitmap (IDirectDraw2 *pDirectDraw, LPCSTR pszBitmap, int nWidth, int nHeight, DDSURFACEDESC *pDesc)
 Create an off-screen surface and copy a bitmap into it.
HRESULT DDReLoadBitmap (IDirectDrawSurface *pSurface, LPCSTR pszBitmap)
 Copy a bitmap into a surface again, as after the surface is restored.
HRESULT DDCopyBitmap (IDirectDrawSurface *pSurface, HBITMAP hBitmap, int x, int y, int nWidth, int nHeight)
 Restore a surface and stretch a part of a bitmap over all of it.
DWORD DDColorMatch (IDirectDrawSurface *pSurface, COLORREF color)
 Find the pixel value of a surface for a colour, by drawing the colour at the top left of the surface and reading the pixel back.
HRESULT DDSetColorKey (IDirectDrawSurface *pSurface, COLORREF color)
 Make a colour the source colour key of a surface.

Detailed Description

The helpers of DirectDraw that load bitmaps into surfaces, match colours to the pixels of a surface, and set colour keys.

Function Documentation

◆ DDLoadBitmap()

IDirectDrawSurface * DDLoadBitmap ( IDirectDraw2 * pDirectDraw,
LPCSTR pszBitmap,
int nWidth,
int nHeight,
DDSURFACEDESC * pDesc )

Create an off-screen surface and copy a bitmap into it.

The bitmap is a resource of the game, or failing that a file.

Parameters
pDirectDrawThe DirectDraw interface that creates the surface.
pszBitmapThe name of the resource or the path of the file.
nWidthThe width to load the bitmap at, or 0 for its own.
nHeightThe height to load the bitmap at, or 0 for its own.
pDescReceives the description the surface was created with. It must not be null.
Returns
The surface, or null when the bitmap does not load or the surface is not created.
Ghidra address:
BRD3D: 0x1000b680

◆ DDReLoadBitmap()

HRESULT DDReLoadBitmap ( IDirectDrawSurface * pSurface,
LPCSTR pszBitmap )

Copy a bitmap into a surface again, as after the surface is restored.

Parameters
pSurfaceThe surface.
pszBitmapThe name of the resource or the path of the file.
Returns
The result of DDCopyBitmap(), or E_FAIL when the bitmap does not load.
Ghidra address:
BRD3D: 0x1000b790

◆ DDCopyBitmap()

HRESULT DDCopyBitmap ( IDirectDrawSurface * pSurface,
HBITMAP hBitmap,
int x,
int y,
int nWidth,
int nHeight )

Restore a surface and stretch a part of a bitmap over all of it.

Parameters
pSurfaceThe surface.
hBitmapThe bitmap.
xThe left of the part.
yThe top of the part.
nWidthThe width of the part, or 0 for the width of the bitmap.
nHeightThe height of the part, or 0 for the height of the bitmap.
Returns
The result of GetDC() of the surface, or E_FAIL when either argument is null.
Ghidra address:
BRD3D: 0x1000b820

◆ DDColorMatch()

DWORD DDColorMatch ( IDirectDrawSurface * pSurface,
COLORREF color )

Find the pixel value of a surface for a colour, by drawing the colour at the top left of the surface and reading the pixel back.

Parameters
pSurfaceThe surface.
colorThe colour, or CLR_INVALID to read the pixel as it is.
Returns
The pixel value, or CLR_INVALID when the surface does not lock.
Ghidra address:
BRD3D: 0x1000b940

◆ DDSetColorKey()

HRESULT DDSetColorKey ( IDirectDrawSurface * pSurface,
COLORREF color )

Make a colour the source colour key of a surface.

Parameters
pSurfaceThe surface.
colorThe colour.
Returns
The result of SetColorKey() of the surface.
Ghidra address:
BRD3D: 0x1000ba40