August 3rd, 2003, 09:48 AM
can anyone tell me, how to compare two bitmaps?
any offers are accepted... better examples...
August 4th, 2003, 06:57 AM
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!
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.