lol yea its a long int. heres the code, but i haven't figured this bit out yet.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
BYTE* loadPicture(void)
{
HANDLE hBitMap = LoadImage(0, "img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
BITMAP bitmap;
GetObject(hBitMap,sizeof(BITMAP),&bitmap);
int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8;
printf("%d %d %d %d \n", bitmap.bmHeight, bitmap.bmWidth, bitmap.bmBitsPixel, size);
BYTE *lpBits = malloc(size);
GetBitmapBits((HBITMAP)hBitMap,size,lpBits );
return lpBits;
}
long int getPixel(int x, int y, BYTE* lpBits)
{
}
int main(int argc, char *argv[])
{
BYTE *lpBits;
lpBits = loadPicture();
int i;
int pixel[4];
for(i = 0; i < 160; i = i + 4) {
printf("%d %d %d %d \n", lpBits[i], lpBits[i + 1], lpBits[i + 2], lpBits[i + 3]);
}
system("PAUSE");
return 0;
}
lpBits is a pointer to an array of BYTEs, which is just the components of each color in a bitmap. What i need now is a getPixel function which returns an long integer representing the four bytes which make up the color of a particular pixel. Then when i want to compare it to something else (not in the code yet), ill want to read it as 4 bytes again. I figured this way would be simpler to manage, but perhaps not.