Re: Grabbing the pixels of a bmp
Now i have this
===========================
pBitmap->GetBitmap(&bmpX);
LPVOID bmpinfo;
pBitmap->GetObject(sizeof(BITMAP), bmpinfo);
BYTE* bmpBuffer = (BYTE *)GlobalAlloc (GPTR, bmpX.bmWidth*bmpX.bmHeight);
pBitmap->GetBitmapBits(bmpX.bmWidthBytes*bmpX.bmHeight,bmpBuffer);
for (int i = 0; i < ds.dsBm.bmHeight; i++) {
for (int j = 0; j < ds.dsBm.bmWidth; j++) {
if (bmpBuffer[i*ds.dsBm.bmHeight+j] == RGB(255,255,0)
AfxMessageBox ("Hit it", MB_OK, NULL);
-===============================
"Jack" <jl@knight.com> ???g???l???s?D:OjJxcaGgGHA.1204@TK2MSFTNGP02.phx.gbl...
"doug mansell" <doug_mansell@hotmail.com>
???????:umIGUg$fGHA.3916@TK2MSFTNGP04.phx.gbl...
Jack wrote:
Hi,
I wonder how to grab the 'current' pixel of a bitmap
say
*****************
*((**************)
is the bitmap
I want to get the first row, first column pixel value
How do I do that in VC?
Thanks
Jack
You could read about this function: GetBitmapBits
doesn't work either
pBitmap->GetBitmap(&bmpX);
BYTE* bmpBuffer = (BYTE *)GlobalAlloc (GPTR, bmpX.bmWidth*bmpX.bmHeight);
for (int i = 0; i < ds.dsBm.bmHeight; i) {
for (int j = 0; i < ds.dsBm.bmWidth; j) {
if (bmpBuffer[i*ds.dsBm.bmHeight] == RGB(255,255,0))
AfxMessageBox ("Hit it", MB_OK, NULL);
}
}
}