I have FULL CONFIDENCE of lending you a hand in extending your existing LockBits code from a single pixel to a rectangle (area) of pixels because I have used LockBits myself to manipulate TIFF images in a WinForms application. I, of course, know all the tricky issues related to LockBits — in particular, the size of bitmap row in memory (given by Stride property) may NOT correspond to exact image width because PADDING may be present. System adds the padding bytes to bitmap memory array for efficiency purpose and one must be careful not to “confuse” padding bytes with actual image bytes.
Just one question: Do you want the array of pixels (that you are searching for) match EXACTLY, i.e. PIXEL-TO-PIXEL, within the specific area? Assuming you want an EXACT match, I suppose code should be written such that it starts the matching process starting with the first pixel within that specific area and carries out search to the last pixel within the specific area UNTIL match is found. Of course, certain optimizations can be carried out to speed up the search one of which is to use pointers. C# does allow us to drop down to the level of pointer manipulations and we can leverage this fact as we have already “LockBits” the area in memory.
Although new to Freelancer.com, I have EXTENSIVE experience (> 10 years) in GDI+, C# / .Net. I am ready to start IMMEDIATELY.
Thanks,
Tushar