Click here to Skip to main content
15,907,905 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello all,

I am having a hard time, searching one HDC within another HDC. I have been able to do it if the pixels are all the same.
How do I set the comparison to give me an error of lets say 1%?
Here is the the portion of the compare logic for each pixel:

C++
for(int y = 0; y < Rect_To_Compare.bottom; ++y) {
    for(int x = 0; x < Rect_To_Compare.right; ++x) {
        COLORREF Color = ::GetPixel(DlgDC, (x + Rect_To_Compare.left), (y + Rect_To_Compare.top) );
        COLORREF ColorToCompare = ::GetPixel(BitmapDC,x,y);
        if(Color != ColorToCompare) {
            result = false;
        }
    }
}


Any help would be greatly appreciated.
Posted
Comments
Sergey Alexandrovich Kryukov 18-May-12 19:01pm    
Just one word: Wow! :-)
--SA

1 solution

Don't you see that the "error" result (which, by the way, makes very little sense) depends on the pixels found by each HDC?! Set aside ridiculous performance of this code. So, this question makes no sense at all.

I really, really hope you're going to understand this.

—SA
 
Share this answer
 
v2
Comments
FISH786 18-May-12 19:08pm    
You right. I am having perfomance issue and am just searching on BITMAPINFO. I guess, I have work cut out for me on reading. I was expecting a quick resolution before I finished reading. Guess not going to happen.
BTW the above code works as part of a function, its just slow. not just slow VERY SLOW. So yes you right with WOW! :(
Sergey Alexandrovich Kryukov 28-May-12 17:00pm    
If you are agree, please accept this answer formally (green button) -- thanks.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900