🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Multi-thread OR Event-based?

#1750
From: JD
Date: Wed, 13 Jun 2007 19:37
37 lines
2197 bytes
"Robert G. Hoover" <not.a.real.address@anywhere.sorry> wrote:
>

Please trim your posts.

> [...] I see that BitBlt needs a source DC. I don't have one.

I would suggest that you use a TBitmap instead. It's 
Canvas::Handle is a DC and you can get a DC for the
screen this way:

    HWND hWnd = ::GetDesktopWindow();
    HDC hDC = ::GetWindowDC( hWnd );

If you need to manipulate the TBitmap, you can use it's Pixels[][] 
property (very slow) or you can use it's ScanLine[] property
(very fast). The following sample converts the TBitmap to gray
scale but note that the offsets differ for variouse PixelFormat
styles. The sample assumes pf24bit.

    for( int y = 0; y < Bmp->Height; ++y )
      {
          BYTE* ScanLine = static_cast<BYTE*>( Bmp->ScanLine[y] );
          for( int x = 0; x < Bmp->Width; ++x )
            {
                BYTE R = ScanLine[ x * 3 + 0 ];
                BYTE G = ScanLine[ x * 3 + 1 ];
                BYTE B = ScanLine[ x * 3 + 2 ];
                BYTE L = (BYTE)((R * 0.299) + (G * 0.587) + (B * 0.114));
                ScanLine[ x * 3 + 0 ] = L;
                ScanLine[ x * 3 + 1 ] = L;
                ScanLine[ x * 3 + 2 ] = L;
            }
      }

~ JD
Technical Details
Message-ID: <4670478a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <46701cfb@newsgroups.borland.com> <46702326$1@newsgroups.borland.com> <46702831@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,27bec389d3c536e6
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: Multi-thread OR Event-based?
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 64.12.116.144     
X-Forwarded-For: 172.133.175.184
References: <46701cfb@newsgroups.borland.com> <46702326$1@newsgroups.borland.com> <46702831@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4670478a$1@newsgroups.borland.com>
Date: 13 Jun 2007 12:37:46 -0700
X-Trace: newsgroups.borland.com 1181763466 207.105.83.66 (13 Jun 2007 12:37:46 -0700)
Lines: 38
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail