AltPluzF4
March 12th, 2009, 10:35 PM
I'm trying to compare images, but the alpha is making the comparison fail (even if the rgb are correct)
BITMAP large;
GetObject(hScreen, sizeof(BITMAP), &large);
int lBps = large.bmBitsPixel / 8;
int lSize = large.bmHeight * large.bmWidth * lBps;
BYTE *lBytes = new BYTE[lSize];
GetBitmapBits(hScreen, lSize, lBytes);
Is what I'm using to get the bytes of the image.
I've been able to solve this by a cheap little hack:
for (int z = 3; z < lSize-4; z+=4)
lBytes[z] = 0;
However, I'm curious... what would be the best way to do this? I'm getting the HBITMAP via CreateCompatabileBitmap and BitBlt'ing the image to it with SRCCOPY.
Again, my problem has been solved by the simple for loop, and everything works fine. I'm just curious if there's a better method.
Thanks for any input.
BITMAP large;
GetObject(hScreen, sizeof(BITMAP), &large);
int lBps = large.bmBitsPixel / 8;
int lSize = large.bmHeight * large.bmWidth * lBps;
BYTE *lBytes = new BYTE[lSize];
GetBitmapBits(hScreen, lSize, lBytes);
Is what I'm using to get the bytes of the image.
I've been able to solve this by a cheap little hack:
for (int z = 3; z < lSize-4; z+=4)
lBytes[z] = 0;
However, I'm curious... what would be the best way to do this? I'm getting the HBITMAP via CreateCompatabileBitmap and BitBlt'ing the image to it with SRCCOPY.
Again, my problem has been solved by the simple for loop, and everything works fine. I'm just curious if there's a better method.
Thanks for any input.