3D DirectX



- 7


// , // . // , // 5 . DWORD dwRShift = O.DWORD dwGShift = 0;

DWORD dwBShift = O.DWORD dwNotMask;

if ((ds.ddpfPixelFormat.dwFlags & DDPF RGB) &&

(iBitCount = 16)) {

if (iBitCount == 16) { dwNotMask = OxFFFFFFEO;

/b> 11.

} else {

dwNotMask = OxFFFFFFOO;

} DWORD dwMask = ds.ddpfPixelFormat.dwRBitMask;

ASSERT(dwMask) ;

while ((dwMask & 001) == 0) {

dwRShift++;

dwMask = dwMask 1;

} while ((dwMask & dwNotMask) != 0) {

dwRShift++;

dwMask = dwMask 1;

} dwMask = ds.ddpfPixelFormat.dwGBitMask;

ASSERT(dwMask) ;

while ((dwMask & 001) == 0) (

dwGShift++;

dwMask = dwMask 1;

) while ((dwMask & dwNotMask) != 0) {

dwGShift++;

dwMask = dwMask 1;

}

dwMask = ds.ddpfPixelFormat.dwBBitMask;

ASSERT(dwMask) ;

while ((dwMask & 001) == 0) {

dwBShift++;

dwMask = dwMask 1;

) while ((dwMask & dwNotMask) != 0) {

dwBShift++;

dwMask = dwMask 1;

} i

// // m_hr = iS-Lock(NULL,

Sds,

DDLOCK_SURFACEMEMORYPTR I DDLOCK_WAIT,

NULL) ;

ASSERT(m_hr == DD_OK) ;

for (int = 0; iHeight; y++) { switch (iBitCount) { case 8: {

BYTE* pDIBPix = pDIBLine;

BYTE* pSurfPix = pSurfLine;

for (int x = 0; x iWidth; x++) {*pDIBPix++ =

'^ 259

// *pSurfPix++;

} } break;

case 16: (

WORD* pDIBPix = (WORD*)pDIBLine;

WORD* pSurfPix = (WORD*)pSurfLine;

WORD r, g, b;

// (int x = 0; x iWidth; x++) ( r = (*pSurfPix & (WORD)

ds.ddpfPixel Format.dwRBitMask) dwRShift;

g = (*pSurfPix & (WORD)

ds.ddpfPixelFormat.dwGBitMask) dwGShift;

b = (*pSurfPix & (WORD)

ds.ddpfPixeiFormat.dwBBitMask) dwBShift;

*pDIBPix++ = ((r & OxIF) 10) ( (g & OxIF) 5) I (b S OxIF) ;

p3urfPix++;

} } break;

case 24: {

BYTE* pDIBPix = pDIBLine;

BYTE* pSurfPix = pSurfLine;