Compare bitmaps
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Compare bitmaps

  1. #1
    Join Date
    Aug 2003
    Russian Federation

    Compare bitmaps

    can anyone tell me, how to compare two bitmaps?
    any offers are accepted... better examples...

  2. #2
    Join Date
    May 2001
    Oslo, Norway
    How do you need to compare them ?

    There is a whole range of compare functions logically speaking:
    Bitmaps are visuals, but also bit maps, so you can either compare them through some complex visual formulae or simply compare for any difference bitwise. Either way you better have direct bitmap data available for both cases, because:

    1. If you need to compare them through visual filter, you will have to compare the ARGB data anyway, because the filter will most likely be custom made and those like to work on hand-on data and. Besides the only efficient source for this data is direct memory pointer unless you utilise custom filter that works with DIB or DDB structures or you go the really wicked way of GetPixel (don't !

    2. If you need to compare them bitwise, the comparing of memory is an integrated hardware function which of course means FAST. F.e. CRT function named memcmp fits the bill perfectly.

    So either way you need to obtain the "bit map" - which means ARGB data. There are several ways to do this:

    1. If you have bitmaps in some Windows GDI form or structure, obtain the bits through GetDIBits, or LockBits or some other function. Check the MSDN for details on whats available but the latter two are

    2. If you are comparing bitmaps in your own proprietary format you may already have a direct memory pointer. Then it's a piece of cake

    3. Screen bitmaps can be read best through GetObject I think -> You will obtain a bitmap selected into screen DC which is a bitmap only existing in video memory. The rest is all about doing what you do on a bitmap to get its bits.

    This is it basically. Hope it helped!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center