Init from working directory of svn repository.
#include "bitmap.h"
#include "stdio.h"
Bitmap::Bitmap(char* b, int h, int w)
{
bits = b;
height = h;
width = w;
}
Bitmap::Bitmap(char* filename)
{
}
void Bitmap::WriteToFile(char* filename)
{
FILE* fileout;
if(! (fileout = fopen(filename, "w+")))
{
printf("Error while trying to write bitmap to %s\n", filename);
exit(1);
}
else
{
fprintf(fileout, "#define %s_width %d\n", filename, width);
fprintf(fileout, "#define %s_height %d\n", filename, height);
fprintf(fileout, "static char %s_bits[] = {\n", filename);
for(int row_counter = 0; row_counter < height; row_counter++)
{
for(int column_counter = 0; (8 * column_counter) < width; column_counter++)
{
fprintf(fileout, "%c,", bits[row_counter * width + column_counter]);
if((column_counter % 16) == 0)
fprintf(fileout, "\n"); /* put a newline once in a while */
}
}
fprintf(fileout, "};\n");
fclose(fileout);
}
}