Sign in to follow this  

Ok...i have a problem

Recommended Posts

// Create A Temporary Bitmap
BITMAPINFO bi = {0}; // The Type Of Bitmap We Request

DWORD *pBits = 0; // Pointer To The Bitmap Bits
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biBitCount = 32; 
bi.bmiHeader.biWidth = TextureCopy[0]->sizeX;
bi.bmiHeader.biHeight = TextureCopy[0]->sizeY;
bi.bmiHeader.biCompression = BI_RGB;
bi.bmiHeader.biPlanes = 1;

hdcTemp = CreateCompatibleDC(0);
hbmpTemp = ::CreateDIBSection(hdcTemp, &bi, DIB_RGB_COLORS, (void**)&pBits,0,0);

for(int y = 0;y < TextureCopy[0]->sizeY * TextureCopy[0]->sizeX;y++)
{ = TextureCopy[0]->data[y * (1)]; = TextureCopy[0]->data[(y * (1)) + 1]; = TextureCopy[0]->data[(y * (1)) + 2];
Myclr.alpha = 255;




CDC temp;



// Paint Code :


dc.BitBlt(rect.left,,rect.right,rect.bottom,&temp,0,0,SRCCOPY); problem is...i want to display a bitmap...My code works but the problem displays it black/white...Instead of color???? [Edited by - Ohmy on August 16, 2004 7:10:38 PM]

Share this post

Link to post
Share on other sites
Try giving the DC of a window that you have created to CreateCompatiableDC instead of NULL (like the one you're going to blit the bitmap to), ie:

HDC hDC = GetDC(hWnd);
hdcTemp = CreateCompatibleDC(hDC);
ReleaseDC(hDC, hWnd);

Share this post

Link to post
Share on other sites
CreateCompatibleDC(NULL)/*or 0*/looks alright to me(the same as the current display surface)
-try adding:
bi.bmiHeader.biClrUsed=0;/*true colors*/
bi.bmiHeader.biClrImpotant=0;/*all colors are important*/

I hope it works.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this