bool load_bits_and_headers(Byte* bytes) { close(); int pos = 0; memcpy(&file_header, bytes + pos, sizeof(BITMAPFILEHEADER)); pos += sizeof(BITMAPFILEHEADER); memcpy(&info_header, bytes + pos, sizeof(BITMAPINFOHEADER)); pos += sizeof(BITMAPINFOHEADER); return fill_bitmap(bytes + pos, bits_size()); }
elem_t ba_init(void) { /* ba_init() PRE: Must be called before use of any other ba_ functions. Should only be called once. POST: Returns the number of values that can be stored in one variable of type `bit'. If <limits.h> does not define `CHAR_BIT' then the module global variable `BITS_SZ' has been set to the appropriate value. */ #ifndef BITS_SZ if (!BITS_SZ) { BITS_SZ = bits_size(); } #endif return (BITS_SZ); } /* ba_init() */