I am using an external buffer to collect the dot-by-dot generation of Sierpinski polygons. I would like to draw GDI objects like polygons onto that buffer. I am successfully generating a memory devise context for the buffer and drawing a polygon on it. I can bitblt that to the display adapter and see Sierpinski dots surrounded with a polygon. When I generate a .bmp file I see only the Sierpinski dots.
I deduce my buffer per se is not affected by drawing the polygon on the memory devise context. It must have a buffer of its own. I guess I'm bitblting the memory device context buffer to the display adapter. I am using my own memory buffer to generate the.bmp file.
I think I can solve my problem if I can bitblt the contents of the memory device buffer to my own buffer. How can I do that? Pehaps I could also convey a pointer to the memory device contex buffer to my .bmp file routine, if I knew how to access that.
hBitMap=CreateCompatibleBitmap(hdc,maxX,maxY);
nBits=SetBitmapBits(hBitMap,maxW*maxY*4,ScreenBuffer); hdcMem=CreateCompatibleDC(hdc); SelectObject(hdcMem,hBitMap);
BitBlt(hdc,0,0,xDisplay,yDisplay,hdcMem,0,0,SRCCOPY);
if(fOutline)
{
lBrush.lbStyle=BS_HOLLOW;
hBrush=CreateBrushIndirect(&lBrush);
SelectObject(hdcMem,hBrush);
if(!Polygon(hdcMem,sPt, iCode+3))
MessageBox(hWnd,"Bitmap polygon failed", "Sierpinski Polygons",0);
BitBlt(hdc,0,0,xDisplay,yDisplay,hdcMem,0,0,SRCCOPY);
}
if(bBitMap)
{
DibFileSave (szBitmapName,szAppName, maxX, maxY, ScreenBuffer);
bBitMap=FALSE;
}
DeleteDC(hdcMem);