MapModes and memdc
I can't seem to find out how to accomplish using a memory DC correctly when my Screen DC Mapping Mode is set to MM_ANISOTROPIC. Here's the information:
I want to plot a world map using latitudes and logitudes without a lot of conversions, so I've set my screen DC as MM_ANISOTROPIC with Window Extents of 360000 x 180000. Then I set my Viewport ORG so that 0,0 is in center of the screen. Upper Left corner is -180000, 90000. Lower right corner is 180000, -90000. This satisfies the correct real-world orientation.
Here is the code for that:
SetMapMode (hdc, MM_ANISOTROPIC);
SetWindowExtEx (hdc, 360000, 180000, NULL);
SetViewportExtEx(hdc, cxClient / 2, -cyClient / 2 , NULL);
SetViewportOrgEx(hdc, cxClient / 2, cyClient / 2 , NULL);
I want to setup a memory DC so that I can write to it and then bitblt is to the Screen DC. I'm wanting to do this so that I can over-write the map with other objects that will be moving....such as airplanes, ships, etc...
Here's the code I've used to set up the memory DC:
GetClientRect(hwnd, &rc);
hdcMem = CreateCompatibleDC(hdc);
hbmMem = CreateCompatibleBitmap(hdc,
rc.right-rc.left,
rc.bottom-rc.top);
hbmOld = SelectObject(hdcMem, hbmMem);
I'm confused on what mapping mode to set up for hdcMem. So I 0set:
SetMapMode (hdcMem, MM_ANISOTROPIC);
SetWindowExtEx (hdcMem, 360000, 180000, NULL);
SetViewportExtEx(hdcMem, cxClient / 2, -cyClient / 2 , NULL);
SetViewportOrgEx(hdcMem, cxClient / 2, cyClient / 2 , NULL);
???
And then on the bitblt.....what are the starting points for hdc and hdcMem???
BitBlt(hdc,
-180000, -90000,
360000, 180000,
hdcMem,
-180000, -90000,
SRCCOPY);
I can't seem to find ANY examples of this anywhere. I've tried all sorts of combinations of MapModes for the hdcMem, and different BitBlts
I am stictly using SDK, with no MFC, DirectX, or OpenGL. I know that sounds crazy, but I really want to see this through!!
Anyone have any ideas???
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement