typedef struct RGB_VALUE
{
int nRed;
int nGreen;
int nBule;
}RGBVALUE;
RGBVALUE GetRGBValue(COLORREF color)
{
RGBVALUE stRGB;
stRGB.nRed = color&RGB(255,0,0);
stRGB.nGreen = (color&RGB(0,255,0)) >> 8;
stRGB.nBule = (color&RGB(0,0,255)) >> 16;
return stRGB;
}
else if (true == bPixel)
{
memset(&DDde,0,sizeof(DDde));
DDde.dwSize = sizeof(DDde);
lpOBuf[nNum]->Lock(NULL, &DDde,
DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
if (16 == PixelMode)
{
COLORREF color = RGB(255,0,255);
RGBVALUE stRGB = GetRGBValue(color);
color = _RGB16BIT565(stRGB.nRed,stRGB.nGreen,stRGB.nBule); int mempitch = DDde.lPitch/2;
WORD * video_buffer = (WORD *)DDde.lpSurface;
for (int nRow = 0; nRow < height; nRow++)
{
for ( int nCol = 0; nCol < width; nCol++)
{
video_buffer[nCol+nRow*mempitch] = color;
}
}
}
else if (32 == PixelMode)
{
COLORREF color = RGB(128,128,128);
RGBVALUE stRGB = GetRGBValue(color);
color = _RGB32BIT(0, stRGB.nRed, stRGB.nGreen, stRGB.nBule);
int mempitch = DDde.lPitch/4;
DWORD * video_buffer = (DWORD *)DDde.lpSurface;
for (int nRow = 0; nRow < height; nRow++)
{
for ( int nCol = 0; nCol < width; nCol++)
{
video_buffer[nCol+nRow*mempitch] = color;
}
}
}
lpOBuf[nNum]->Unlock(NULL);
}