A header file that contains int types of specified widths and corresponding macros.
uint8_t is the most space saving way to store a positive int from 0-255(255 requires 8 bits). Must be positive because the "signed" is what enables the use of -/+ signs as the first bit. All these types of int have specific sizes, so you use them when you need to make sure a variable has aa specific amount of space allocated.
BYTE: 1 byte. WORD: 2. DWORD: 4 bytes. LONG: 4 bytes.
What (in ASCII, decimal, or hexadecimal) must the first two bytes of any BMP file be? Leading bytes used to identify file formats (with high probability) are generally called "magic numbers."
BM (Ascii), which refers to the file type of the bitmap file in the beginning of the bitmapfileheader.
bf: Bitmap File. bfSize: Contains the size of the whole bmp-file. Image, headers, everything. bi: Bitmap Info. biSize contains the size of the bitmapinfoheader.
The bytes representing the pixels are ordered top-down, so the first pixel printed is in the upper left corner. Goes "from 0 and down". Rows are printed top down. If it were positive rows would be printed from the bottom and up. Remember that both start printing from the left!
biBitCount
this function takes filename and mode as arguments. In copy.c the mode iss et to "r" which means "read an already existing file". If the file does not exist fopen will return NULL.
The third arg in fread indicates how many elements of size(defined in 2nd arg) to be read. Our code only reads the bmp info/file headers of its own size, and there is only one of each, so only 1 needs to be read.
int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4; padding = (-5 % 4) % 4 padding = 3 % 4 = 3
Moves the file pointer the number of steps given in arg 2 (here "padding" number of steps if there is any padding in the current position?)
Current position of file pointer.