#include "mkBitMap.hpp" using namespace std; //note that the requirement for file byte ordering is for little endian, so this program //will have to be modified to handle big endian architectures CBitMap::~CBitMap(){ for (int i=0; i<16; i++){ delete data[i]; } }; CBitMap::CBitMap(const string &number){ unsigned int i, j; height = 16; width = 8 * number.size(); //this intWidth biznez is to pad out to the appropriate number of bytes intWidth = number.size() / 4; if (!intWidth){ intWidth = 1; }else{ if (number.size() % 4) intWidth++; } bmh.SetHeight(height); bmh.SetWidth(width); for (i=0; i<16; i++){ data[i] = new unsigned char[intWidth * 4]; for (j=0; j=0; j--){ if (j < 15) printf(","); swap = 0; for (int k=0; k<8; k++){ if (arr[k] & digits[i][j]) swap |= arr[7-k]; } printf("0x%02x", swap); } printf("}, //%d\n", i); } printf(" };\n"); */ unsigned int idx, numChars = number.size(); string chr; for (i=0; i<16; i++){ for (j=0; j 9) idx = 0; data[i][j] = digits[idx][i]; } } unsigned int numBytes = 0; numBytes += bmfh.GetOutputSize(); numBytes += bmh.GetOutputSize(); numBytes += rgbLetters.GetOutputSize(); numBytes += rgbBackground.GetOutputSize(); numBytes += intWidth * 4; bmfh.SetSize(numBytes); // rgbLetters.rgbRed = 0xFF; // rgbLetters.rgbBlue = 0xFF; // rgbLetters.rgbGreen = 0xFF; rgbBackground.rgbRed = 0xFF; rgbBackground.rgbBlue = 0xFF; rgbBackground.rgbGreen = 0xFF; }; void CBitMap::Dump(FILE *fout){//must be opened in binary mode! bmfh.Dump(fout); bmh.Dump(fout); rgbLetters.Dump(fout); rgbBackground.Dump(fout); unsigned int i, j; for (i=0; i<16; i++){ for (j=0; j