/** * \file * * * \author Stefano Fedrigo * * \brief Conversion tool from image TXT format to LCD bitmap */ /* * $Log$ * Revision 1.1 2006/09/19 17:48:00 bernie * Add temporary logo. * * Revision 1.3 2004/09/24 17:25:32 powersoft * Fix for new version of ImageMagick. * * Revision 1.2 2004/03/13 22:52:54 aleph * documentation fixes * * Revision 1.1 2004/01/26 15:31:17 aleph * Add boot images and tools for importing them * */ #include #include #include extern "C" { #include #include } #define RASTER_WIDTH 82 #define RASTER_HEIGHT 64 // Minimum color level to consider a pixel on #define COLOR_THRESHOLD 128 using namespace std; int main(void) { char buf[64]; int n; unsigned char mask; unsigned char line[RASTER_WIDTH]; for (int l = 0; l < RASTER_HEIGHT/8; l++) { mask = 1; memset(line, 0, sizeof(line)); do { for (int x = 0; x < RASTER_WIDTH; x++) { if (!cin.getline(buf, sizeof(buf))) goto print_line; istringstream ss(buf); string s; char c; ss >> s // skip glob coord spec >> c // skip open paren >> n; // this is the red level //DEBUG //cout << "s='" << s << "' n='" << n << "'" << endl; if (n < COLOR_THRESHOLD) line[x] |= mask; } } while (mask <<= 1); print_line: cout << "\n\t"; for (int x = 0; x < RASTER_WIDTH; x++) { printf("0x%02X", line[x]); if (x % 8 == 7) cout << ",\n\t"; else cout << ", "; } cout << endl; } return 0; }