Originally Posted by
mr_empty
hi all,
i want a white image file with very large pixel, say about 40000 X 40000, since i cannot find the same size of image to turn it into white, so i need to create myself. but i 'm new in mfc graphics, does anybody knwo how to create it? what is the procedure or any sample code? thanks!
In MFC something like;
Code:
//needs error checking
//create an image object
CImage Image;
Image.Create(40000,40000,32,0);//change depth and flags as needed
//get the DC to draw to
CDC *pDC=CDC::FromHandle(Image.GetDC());
//fill with white
pDC->FillSolidRect(0,0,40000,40000,RGB(255,255,255));
//save image
CString sPath="C:\\SomeFolder\\WhiteImage.bmp";
Image.Save(sPath,GUID_NULL);
//clean up
Image.ReleaseDC(pDC->Detach());
It is easier if you don't need to save the image. Use GetDC(), CreateCompatibleBitmap(), FillRect() and ReleaseDC().