From: "Stan" Newsgroups: borland.public.delphi.graphics Subject: Comparing 2 RGB Quads - revisited Date: Wed, 20 Mar 2002 17:52:25 +0100 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 195.78.15.29 Message-ID: <3c98be50_2@dnews> X-Trace: dnews 1016643152 195.78.15.29 (20 Mar 2002 08:52:32 -0800) Path: dnews Xref: dnews borland.public.delphi.graphics:47352 Ok - a few days ago I posted a question about this, and Nils kindly provided some code that would indeed compare 2 RGB quads. My original problem was that the comparison was failing on a test machine running Windows 98. Nils' solution still didn't solve the problem. A colleague of mine had a look and found exactly what the problemn was and how to fix it and I think this may be of interest in this group. When creating a 32Bit bitmap, or loading one from file, or copying a bitmap from another pixel format - you NEVER know the state of the Alpha channel byte. So, when making the comparison between 2 pixels from 2 separate bitmaps, you should either initialize the Alpha channels or not include them in the comparison. I opted for the second approach and here's the modified version of the code kindly provided by Nils. (Longword(SrcRow^[x - i]) and $FFFFFF) = (Longword(TransQuad) and $FFFFFF) SrcRow = PRGBQuadArray = ScanLine[Y]; i = Column in Scanline. TransQuad = 4Byte RGBQuad to compare against. by "Anding" with $FFFFFF we basically leave the Alpha Channel out of the comparison. Regards Stan