🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11987

Re: Lots of data

#11987
From: M. Finch
Date: Fri, 02 Jan 2004 21:50
86 lines
4139 bytes
>
> Create a bitmap compatible with the HDC of the client area on the screen.
> Call GetClientRect to get the dimensions of that client area and use
> CreateCompatibleBitmap to get a bitmap sized for the screen.
>

Ed,

ok, without getting into where its put just yet (right now I have it in my
paint code)....AND....sorry to belabor this in case I'm boring anyone...

Problem:
    I get one of the aircraft bitmap on the screen at 0,0.....  I assume
that all 160 of them are being displayed at 0,0 on-top of each other.

What I'm doing:
    I have a screen DC
    Create a background DC - make it the same size as screen DC
    Create an airplane DC - make it the same size as the airplane bitmap
    160+ times
             Blit the airplane onto the background
    Blit the background onto the screen.

I perform the following
        hbm = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP1));

//create an off screen memory area for the main screen
        hdcMem = CreateCompatibleDC(hDC);
//create a compatible bitmap the size of the screen HDC
        hbmMem = CreateCompatibleBitmap(hdcMem, width, height);
//create a memory for the aircraft bitmap
        hdcbm = CreateCompatibleDC(NULL);
//setup a buffer area for the plane bitmap so we can find its size
        GetObject(hbm,sizeof(bm),&bm);
//size the DC to the size of the plane bitmap
        hbmPlane = CreateCompatibleBitmap(hdcbm,bm.bmWidth,bm.bmHeight);
//Select the compatible Bitmap into background memory
        hbmT = SelectObject(hdcMem,hbmMem);
//Select the airplane Bitmap into airplane memory
        hbmB = SelectObject(hdcbm,hbm);


That being done, now I go through my list...
 now = head
 while now != NULL

BitBlt(hdcMem,tempLonLat.x,tempLonLat.y,bm.bmWidth,
         bm.bmHeight,hdcbm,0,0,SRCCOPY);
                 // VERY confused here.  see below
 now = next

Now blit it onto screen

BitBlt(hDC,0,0,rect.right-rect.left,rect.bottom-rect.top,hdcMem,0,0,SRCCOPY)

end pseudocode


QUESTION...
  I'm REALLY confused about where the destination of the blit is to be on
the screen back-buffer.  I have my map mode set as follows:
          SetMapMode(hDC,MM_ANISOTROPIC);
          SetWindowExtEx(hDC, xwin,ywin,NULL);
//xwin is 360000    ywin is 180000
          SetViewportExtEx(hDC,width,-height,NULL);
//width and height are the client window size

So in my blit to the back buffer above, I've taken the lon/lat of the
aircraft and convert to device coords, using LPtoDP...THEN use that as the
destination of the blit.
I originally used the Logical coordinates (actual lon/lat [*1000]) and that
didn't seem to work either.

So I have made the CreateCompatibleDC for the screen in device coordinates.
I tried making it logical coordinates and get an error creating the
CreateCompatibleBitmap.

OR...
should I create the compatibleDC for the off screen, then set the map mode
and
SetWindowExtEx and SetViewportEx for the off screen DC also?

Whew!!!  I think I've gone off the deep end with this....

Any further help would sure be appreciated....
Technical Details
Message-ID: <3ff5e797$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3ff41d43$1@newsgroups.borland.com> <3ff421ca$1@newsgroups.borland.com> <3ff44fe4$1@newsgroups.borland.com> <3ff458ce@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,894ad098f15950e6
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-02 14:09:52 PST
Reply-To: "M. Finch" <mlfsup@nospam.comcast.net>
From: "M. Finch" <mlfsup@nospam.comcast.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ff41d43$1@newsgroups.borland.com> <3ff421ca$1@newsgroups.borland.com> <3ff44fe4$1@newsgroups.borland.com> <3ff458ce@newsgroups.borland.com>
Subject: Re: Lots of data
Date: Fri, 2 Jan 2004 16:50:15 -0500
Lines: 92
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 68.51.77.211
Message-ID: <3ff5e797$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1073080215 68.51.77.211 (2 Jan 2004 13:50:15 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail