RenderWare V2.1

Previous Page Index Next Page

void *

RwGetCameraImage(RwCamera *cam);

Return Value

The image buffer of a RenderWare camera can be either a memory device context with a memory bitmap selected, a device independent bitmap (DIB) ,a user specified RwRaster or a DirectDraw surface.

To determine whether RwGetCameraImage() returns a memory device context, DIB or Direct Draw surface handle for RenderWare allocated bitmaps, use RwGetDeviceInfo() as follows:

RwCamera *cam;
RwInt32 usingDIBs, usingDD, usingDIBSections;
HDC hdc;

LPDIRECTDRAWSURFACE lpSurface;

BITMAPINFOHEADER *dib;

RwGetDeviceInfo(rwWINUSINGDIBS, &usingDIBs, sizeof(usingDIBs));

RwGetDeviceInfo(rwWINUSINGDIBSECTIONS, &usingDIBSections, sizeof(usingDIBSections));

RwGetDeviceInfo(rwWINUSINGDD, &usingDD, sizeof(usingDD));

if (usingDIBs)
dib = (BITMAPINFOHEADER *)RwGetCameraImage(cam);
else if (usingDibSections)
hdc = (HDC)RwGetCameraImage(cam);

else if (usingDD)
{
lpSurface = RwGetCameraImage(cam);
if (IDirectDrawSurface_GetDC(lpSurface, &hdc) == DD_OK)

{

/* use hdc here */
IDirectDrawSurface_ReleaseDC(lpSurface, hdc);

}

}

The Direct Draw surface should not be locked between an RwBeginCameraUpdate().. RwEndCameraUpdate() block;