Hi
Please tell me how to create a bitmap. Draw on it and how to save that bitmap to a bmp file.
I done following : on a button click event.
[code=cpp]
CDC* pDC = GetDC();
CDC memDC;
CBitmap newbmp;
CImage img;
CBrush brush;
brush.CreateSol idBrush(RGB(0, 0, 255));
pDC->SelectObject(& brush);
memDC.CreateCom patibleDC(pDC);
btmap.CreateCom patibleBitmap(& memDC, 300, 300);
pDC->Rectangle(10 , 10, 80, 80);
pDC->Ellipse(60,60, 220,220);
memDC.SelectObj ect(&newbmp);
memDC.BitBlt(0, 0,300,300,pDC,0 ,0,SRCCOPY);
CString loc("C:\\atest. bmp");
LPCTSTR bmp = (LPCTSTR)loc;
img.Attach(newb mp);
img.Save(bmp,Gd iplus::ImageFor matBMP);
ReleaseDC(pDC);
[/code]
But all do just get the window details and save it. If there a window above that it will also draw that.
Every thing we draw with pDC come on the screen. Such that is there any way to draw to CDC of bitmap (similar to CDC pDC = GetDC();). And when we save it then only what we draw on that CDC should be saved, nothing more.
Please reply immediatly ..
Thanks in advance
Aqeek
Please tell me how to create a bitmap. Draw on it and how to save that bitmap to a bmp file.
I done following : on a button click event.
[code=cpp]
CDC* pDC = GetDC();
CDC memDC;
CBitmap newbmp;
CImage img;
CBrush brush;
brush.CreateSol idBrush(RGB(0, 0, 255));
pDC->SelectObject(& brush);
memDC.CreateCom patibleDC(pDC);
btmap.CreateCom patibleBitmap(& memDC, 300, 300);
pDC->Rectangle(10 , 10, 80, 80);
pDC->Ellipse(60,60, 220,220);
memDC.SelectObj ect(&newbmp);
memDC.BitBlt(0, 0,300,300,pDC,0 ,0,SRCCOPY);
CString loc("C:\\atest. bmp");
LPCTSTR bmp = (LPCTSTR)loc;
img.Attach(newb mp);
img.Save(bmp,Gd iplus::ImageFor matBMP);
ReleaseDC(pDC);
[/code]
But all do just get the window details and save it. If there a window above that it will also draw that.
Every thing we draw with pDC come on the screen. Such that is there any way to draw to CDC of bitmap (similar to CDC pDC = GetDC();). And when we save it then only what we draw on that CDC should be saved, nothing more.
Please reply immediatly ..
Thanks in advance
Aqeek
Comment