ansilove

ANSI and ASCII art to PNG converter in C
Log | Files | Refs | README | LICENSE

commit b9ddd741c44ebafb5c6ad46446294df82dea5f18
parent 2c470727b8a68798be30db259101c32e28265d86
Author: Frederic Cambus <fred@statdns.com>
Date:   Tue, 18 Apr 2017 11:54:33 +0200

Harmonize canvas names in all loaders

Diffstat:
Msrc/loaders/ansi.c | 88++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/loaders/artworx.c | 14+++++++-------
Msrc/loaders/binary.c | 44++++++++++++++++++++++----------------------
Msrc/loaders/icedraw.c | 14+++++++-------
Msrc/loaders/pcboard.c | 44++++++++++++++++++++++----------------------
Msrc/loaders/tundra.c | 10+++++-----
Msrc/loaders/xbin.c | 48++++++++++++++++++++++++------------------------
7 files changed, 131 insertions(+), 131 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -49,7 +49,7 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil } // libgd image pointers - gdImagePtr im_ANSi; + gdImagePtr canvas; // ANSi processing loops int32_t loop = 0, ansi_sequence_loop, seq_graphics_loop; @@ -418,9 +418,9 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil } // create that damn thingy - im_ANSi = gdImageCreate(columns * bits,(position_y_max)*fontData.height); + canvas = gdImageCreate(columns * bits,(position_y_max)*fontData.height); - if (!im_ANSi) { + if (!canvas) { perror("Can't allocate ANSi buffer image memory"); exit(6); } @@ -431,52 +431,52 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil if (ced) { - ced_background = gdImageColorAllocate(im_ANSi, 170, 170, 170); - ced_foreground = gdImageColorAllocate(im_ANSi, 0, 0, 0); - gdImageFill(im_ANSi, 0, 0, ced_background); + ced_background = gdImageColorAllocate(canvas, 170, 170, 170); + ced_foreground = gdImageColorAllocate(canvas, 0, 0, 0); + gdImageFill(canvas, 0, 0, ced_background); } else if (workbench) { - gdImageFill(im_ANSi, 0, 0, 0); - - colors[0] = gdImageColorAllocate(im_ANSi, 170, 170, 170); - colors[1] = gdImageColorAllocate(im_ANSi, 0, 0, 0); - colors[2] = gdImageColorAllocate(im_ANSi, 255, 255, 255); - colors[3] = gdImageColorAllocate(im_ANSi, 102, 136, 187); - colors[4] = gdImageColorAllocate(im_ANSi, 0, 0, 255); - colors[5] = gdImageColorAllocate(im_ANSi, 255, 0, 255); - colors[6] = gdImageColorAllocate(im_ANSi, 0, 255, 255); - colors[7] = gdImageColorAllocate(im_ANSi, 255, 255, 255); - colors[8] = gdImageColorAllocate(im_ANSi, 170, 170, 170); - colors[9] = gdImageColorAllocate(im_ANSi, 0, 0, 0); - colors[10] = gdImageColorAllocate(im_ANSi, 255, 255, 255); - colors[11] = gdImageColorAllocate(im_ANSi, 102, 136, 187); - colors[12] = gdImageColorAllocate(im_ANSi, 0, 0, 255); - colors[13] = gdImageColorAllocate(im_ANSi, 255, 0, 255); - colors[14] = gdImageColorAllocate(im_ANSi, 0, 255, 255); - colors[15] = gdImageColorAllocate(im_ANSi, 255, 255, 255); + gdImageFill(canvas, 0, 0, 0); + + colors[0] = gdImageColorAllocate(canvas, 170, 170, 170); + colors[1] = gdImageColorAllocate(canvas, 0, 0, 0); + colors[2] = gdImageColorAllocate(canvas, 255, 255, 255); + colors[3] = gdImageColorAllocate(canvas, 102, 136, 187); + colors[4] = gdImageColorAllocate(canvas, 0, 0, 255); + colors[5] = gdImageColorAllocate(canvas, 255, 0, 255); + colors[6] = gdImageColorAllocate(canvas, 0, 255, 255); + colors[7] = gdImageColorAllocate(canvas, 255, 255, 255); + colors[8] = gdImageColorAllocate(canvas, 170, 170, 170); + colors[9] = gdImageColorAllocate(canvas, 0, 0, 0); + colors[10] = gdImageColorAllocate(canvas, 255, 255, 255); + colors[11] = gdImageColorAllocate(canvas, 102, 136, 187); + colors[12] = gdImageColorAllocate(canvas, 0, 0, 255); + colors[13] = gdImageColorAllocate(canvas, 255, 0, 255); + colors[14] = gdImageColorAllocate(canvas, 0, 255, 255); + colors[15] = gdImageColorAllocate(canvas, 255, 255, 255); } else { // Allocate standard ANSi color palette - colors[0] = gdImageColorAllocate(im_ANSi, 0, 0, 0); - colors[1] = gdImageColorAllocate(im_ANSi, 170, 0, 0); - colors[2] = gdImageColorAllocate(im_ANSi, 0, 170, 0); - colors[3] = gdImageColorAllocate(im_ANSi, 170, 85, 0); - colors[4] = gdImageColorAllocate(im_ANSi, 0, 0, 170); - colors[5] = gdImageColorAllocate(im_ANSi, 170, 0, 170); - colors[6] = gdImageColorAllocate(im_ANSi, 0, 170, 170); - colors[7] = gdImageColorAllocate(im_ANSi, 170, 170, 170); - colors[8] = gdImageColorAllocate(im_ANSi, 85, 85, 85); - colors[9] = gdImageColorAllocate(im_ANSi, 255, 85, 85); - colors[10] = gdImageColorAllocate(im_ANSi, 85, 255, 85); - colors[11] = gdImageColorAllocate(im_ANSi, 255, 255, 85); - colors[12] = gdImageColorAllocate(im_ANSi, 85, 85, 255); - colors[13] = gdImageColorAllocate(im_ANSi, 255, 85, 255); - colors[14] = gdImageColorAllocate(im_ANSi, 85, 255, 255); - colors[15] = gdImageColorAllocate(im_ANSi, 255, 255, 255); + colors[0] = gdImageColorAllocate(canvas, 0, 0, 0); + colors[1] = gdImageColorAllocate(canvas, 170, 0, 0); + colors[2] = gdImageColorAllocate(canvas, 0, 170, 0); + colors[3] = gdImageColorAllocate(canvas, 170, 85, 0); + colors[4] = gdImageColorAllocate(canvas, 0, 0, 170); + colors[5] = gdImageColorAllocate(canvas, 170, 0, 170); + colors[6] = gdImageColorAllocate(canvas, 0, 170, 170); + colors[7] = gdImageColorAllocate(canvas, 170, 170, 170); + colors[8] = gdImageColorAllocate(canvas, 85, 85, 85); + colors[9] = gdImageColorAllocate(canvas, 255, 85, 85); + colors[10] = gdImageColorAllocate(canvas, 85, 255, 85); + colors[11] = gdImageColorAllocate(canvas, 255, 255, 85); + colors[12] = gdImageColorAllocate(canvas, 85, 85, 255); + colors[13] = gdImageColorAllocate(canvas, 255, 85, 255); + colors[14] = gdImageColorAllocate(canvas, 85, 255, 255); + colors[15] = gdImageColorAllocate(canvas, 255, 255, 255); } // even more definitions, sigh @@ -496,10 +496,10 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil position_y = ansi_buffer[loop].position_y; if (ced) { - alDrawChar(im_ANSi, fontData.font_data, bits, fontData.height, + alDrawChar(canvas, fontData.font_data, bits, fontData.height, position_x, position_y, ced_background, ced_foreground, character); } else { - alDrawChar(im_ANSi, fontData.font_data, bits, fontData.height, + alDrawChar(canvas, fontData.font_data, bits, fontData.height, position_x, position_y, colors[background], colors[foreground], character); } @@ -508,11 +508,11 @@ void ansi(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil // transparent flag used? if (transparent) { - gdImageColorTransparent(im_ANSi, 0); + gdImageColorTransparent(canvas, 0); } // create output image - output(im_ANSi, outputFile, retinaout, createRetinaRep); + output(canvas, outputFile, retinaout, createRetinaRep); // free memory free(ansi_buffer); diff --git a/src/loaders/artworx.c b/src/loaders/artworx.c @@ -17,13 +17,13 @@ void artworx(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output unsigned char *font_data_adf; // libgd image pointers - gdImagePtr im_ADF; + gdImagePtr canvas; // create ADF instance - im_ADF = gdImageCreate(640,(((inputFileSize - 192 - 4096 -1) / 2) / 80) * 16); + canvas = gdImageCreate(640,(((inputFileSize - 192 - 4096 -1) / 2) / 80) * 16); // error output - if (!im_ADF) { + if (!canvas) { perror("Can't allocate buffer image memory"); exit (7); } @@ -48,12 +48,12 @@ void artworx(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output for (loop = 0; loop < 16; loop++) { index = (adf_colors[loop] * 3) + 1; - gdImageColorAllocate(im_ADF, (inputFileBuffer[index] << 2 | inputFileBuffer[index] >> 4), + gdImageColorAllocate(canvas, (inputFileBuffer[index] << 2 | inputFileBuffer[index] >> 4), (inputFileBuffer[index + 1] << 2 | inputFileBuffer[index + 1] >> 4), (inputFileBuffer[index + 2] << 2 | inputFileBuffer[index + 2] >> 4)); } - gdImageColorAllocate(im_ADF, 0, 0, 0); + gdImageColorAllocate(canvas, 0, 0, 0); // process ADF int32_t position_x = 0, position_y = 0; @@ -74,14 +74,14 @@ void artworx(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output background = (attribute & 240) >> 4; foreground = attribute & 15; - alDrawChar(im_ADF, font_data, 8, 16, position_x, position_y, background, foreground, character); + alDrawChar(canvas, font_data, 8, 16, position_x, position_y, background, foreground, character); position_x++; loop+=2; } // create output file - output(im_ADF, outputFile, retinaout, createRetinaRep); + output(canvas, outputFile, retinaout, createRetinaRep); // nuke garbage free(font_data_adf); diff --git a/src/loaders/binary.c b/src/loaders/binary.c @@ -20,39 +20,39 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF alSelectFont(&fontData, font); // libgd image pointers - gdImagePtr im_Binary; + gdImagePtr canvas; // allocate buffer image memory - im_Binary = gdImageCreate(columns * bits, + canvas = gdImageCreate(columns * bits, ((inputFileSize / 2) / columns * fontData.height)); - if (!im_Binary) { + if (!canvas) { perror("Error, can't allocate buffer image memory"); exit (6); } // allocate black color - gdImageColorAllocate(im_Binary, 0, 0, 0); + gdImageColorAllocate(canvas, 0, 0, 0); // allocate color palette int32_t colors[16]; - colors[0] = gdImageColorAllocate(im_Binary, 0, 0, 0); - colors[1] = gdImageColorAllocate(im_Binary, 0, 0, 170); - colors[2] = gdImageColorAllocate(im_Binary, 0, 170, 0); - colors[3] = gdImageColorAllocate(im_Binary, 0, 170, 170); - colors[4] = gdImageColorAllocate(im_Binary, 170, 0, 0); - colors[5] = gdImageColorAllocate(im_Binary, 170, 0, 170); - colors[6] = gdImageColorAllocate(im_Binary, 170, 85, 0); - colors[7] = gdImageColorAllocate(im_Binary, 170, 170, 170); - colors[8] = gdImageColorAllocate(im_Binary, 85, 85, 85); - colors[9] = gdImageColorAllocate(im_Binary, 85, 85, 255); - colors[10] = gdImageColorAllocate(im_Binary, 85, 255, 85); - colors[11] = gdImageColorAllocate(im_Binary, 85, 255, 255); - colors[12] = gdImageColorAllocate(im_Binary, 255, 85, 85); - colors[13] = gdImageColorAllocate(im_Binary, 255, 85, 255); - colors[14] = gdImageColorAllocate(im_Binary, 255, 255, 85); - colors[15] = gdImageColorAllocate(im_Binary, 255, 255, 255); + colors[0] = gdImageColorAllocate(canvas, 0, 0, 0); + colors[1] = gdImageColorAllocate(canvas, 0, 0, 170); + colors[2] = gdImageColorAllocate(canvas, 0, 170, 0); + colors[3] = gdImageColorAllocate(canvas, 0, 170, 170); + colors[4] = gdImageColorAllocate(canvas, 170, 0, 0); + colors[5] = gdImageColorAllocate(canvas, 170, 0, 170); + colors[6] = gdImageColorAllocate(canvas, 170, 85, 0); + colors[7] = gdImageColorAllocate(canvas, 170, 170, 170); + colors[8] = gdImageColorAllocate(canvas, 85, 85, 85); + colors[9] = gdImageColorAllocate(canvas, 85, 85, 255); + colors[10] = gdImageColorAllocate(canvas, 85, 255, 85); + colors[11] = gdImageColorAllocate(canvas, 85, 255, 255); + colors[12] = gdImageColorAllocate(canvas, 255, 85, 85); + colors[13] = gdImageColorAllocate(canvas, 255, 85, 255); + colors[14] = gdImageColorAllocate(canvas, 255, 255, 85); + colors[15] = gdImageColorAllocate(canvas, 255, 255, 255); // process binary int32_t character, attribute, background, foreground; @@ -77,7 +77,7 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF background -= 8; } - alDrawChar(im_Binary, fontData.font_data, bits, fontData.height, + alDrawChar(canvas, fontData.font_data, bits, fontData.height, position_x, position_y, colors[background], colors[foreground], character); position_x++; @@ -85,5 +85,5 @@ void binary(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF } // create output image - output(im_Binary, outputFile, retinaout, createRetinaRep); + output(canvas, outputFile, retinaout, createRetinaRep); } diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -20,7 +20,7 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output int32_t x2 = (inputFileBuffer[9] << 8) + inputFileBuffer[8]; // libgd image pointers - gdImagePtr im_IDF; + gdImagePtr canvas; int32_t loop; int32_t index; @@ -95,20 +95,20 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output } // create IDF instance - im_IDF = gdImageCreate((x2 + 1) * 8, i / 2 / 80 * 16); + canvas = gdImageCreate((x2 + 1) * 8, i / 2 / 80 * 16); // error output - if (!im_IDF) { + if (!canvas) { perror("Can't allocate buffer image memory"); exit (9); } - gdImageColorAllocate(im_IDF, 0, 0, 0); + gdImageColorAllocate(canvas, 0, 0, 0); // process IDF palette for (loop = 0; loop < 16; loop++) { index = (loop * 3) + inputFileSize - 48; - colors[loop] = gdImageColorAllocate(im_IDF, (inputFileBuffer[index] << 2 | inputFileBuffer[index] >> 4), + colors[loop] = gdImageColorAllocate(canvas, (inputFileBuffer[index] << 2 | inputFileBuffer[index] >> 4), (inputFileBuffer[index + 1] << 2 | inputFileBuffer[index + 1] >> 4), (inputFileBuffer[index + 2] << 2 | inputFileBuffer[index + 2] >> 4)); } @@ -131,13 +131,13 @@ void icedraw(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output background = (attribute & 240) >> 4; foreground = attribute & 15; - alDrawChar(im_IDF, font_data, 8, 16, position_x, position_y, colors[background], colors[foreground], character); + alDrawChar(canvas, font_data, 8, 16, position_x, position_y, colors[background], colors[foreground], character); position_x++; } // create output file - output(im_IDF, outputFile, retinaout, createRetinaRep); + output(canvas, outputFile, retinaout, createRetinaRep); // free memory free(font_data_idf); diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -22,7 +22,7 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output alSelectFont(&fontData, font); // libgd image pointers - gdImagePtr im_PCB; + gdImagePtr canvas; // process PCBoard int32_t character, current_character, next_character; @@ -144,31 +144,31 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output position_y_max++; // allocate buffer image memory - im_PCB = gdImageCreate(columns * bits, (position_y_max)*fontData.height); + canvas = gdImageCreate(columns * bits, (position_y_max)*fontData.height); // allocate black color and create background canvas - gdImageColorAllocate(im_PCB, 0, 0, 0); - gdImageFill(im_PCB, 0, 0, 0); + gdImageColorAllocate(canvas, 0, 0, 0); + gdImageFill(canvas, 0, 0, 0); // allocate color palette int32_t colors[71]; - colors[48] = gdImageColorAllocate(im_PCB, 0, 0, 0); - colors[49] = gdImageColorAllocate(im_PCB, 0, 0, 170); - colors[50] = gdImageColorAllocate(im_PCB, 0, 170, 0); - colors[51] = gdImageColorAllocate(im_PCB, 0, 170, 170); - colors[52] = gdImageColorAllocate(im_PCB, 170, 0, 0); - colors[53] = gdImageColorAllocate(im_PCB, 170, 0, 170); - colors[54] = gdImageColorAllocate(im_PCB, 170, 85, 0); - colors[55] = gdImageColorAllocate(im_PCB, 170, 170, 170); - colors[56] = gdImageColorAllocate(im_PCB, 85, 85, 85); - colors[57] = gdImageColorAllocate(im_PCB, 85, 85, 255); - colors[65] = gdImageColorAllocate(im_PCB, 85, 255, 85); - colors[66] = gdImageColorAllocate(im_PCB, 85, 255, 255); - colors[67] = gdImageColorAllocate(im_PCB, 255, 85, 85); - colors[68] = gdImageColorAllocate(im_PCB, 255, 85, 255); - colors[69] = gdImageColorAllocate(im_PCB, 255, 255, 85); - colors[70] = gdImageColorAllocate(im_PCB, 255, 255, 255); + colors[48] = gdImageColorAllocate(canvas, 0, 0, 0); + colors[49] = gdImageColorAllocate(canvas, 0, 0, 170); + colors[50] = gdImageColorAllocate(canvas, 0, 170, 0); + colors[51] = gdImageColorAllocate(canvas, 0, 170, 170); + colors[52] = gdImageColorAllocate(canvas, 170, 0, 0); + colors[53] = gdImageColorAllocate(canvas, 170, 0, 170); + colors[54] = gdImageColorAllocate(canvas, 170, 85, 0); + colors[55] = gdImageColorAllocate(canvas, 170, 170, 170); + colors[56] = gdImageColorAllocate(canvas, 85, 85, 85); + colors[57] = gdImageColorAllocate(canvas, 85, 85, 255); + colors[65] = gdImageColorAllocate(canvas, 85, 255, 85); + colors[66] = gdImageColorAllocate(canvas, 85, 255, 255); + colors[67] = gdImageColorAllocate(canvas, 255, 85, 85); + colors[68] = gdImageColorAllocate(canvas, 255, 85, 255); + colors[69] = gdImageColorAllocate(canvas, 255, 255, 85); + colors[70] = gdImageColorAllocate(canvas, 255, 255, 255); // the last value of loop tells us how many items are stored in there int32_t pcbBufferItems = structIndex; @@ -183,12 +183,12 @@ void pcboard(unsigned char *inputFileBuffer, int32_t inputFileSize, char *output foreground = pcboard_buffer[loop].foreground; character = pcboard_buffer[loop].current_character; - alDrawChar(im_PCB, fontData.font_data, bits, fontData.height, + alDrawChar(canvas, fontData.font_data, bits, fontData.height, position_x, position_y, colors[background], colors[foreground], character); } // create output image - output(im_PCB, outputFile, retinaout, createRetinaRep); + output(canvas, outputFile, retinaout, createRetinaRep); // free memory free(pcboard_buffer); diff --git a/src/loaders/tundra.c b/src/loaders/tundra.c @@ -23,7 +23,7 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF alSelectFont(&fontData, font); // libgd image pointers - gdImagePtr im_Tundra; + gdImagePtr canvas; // extract tundra header tundra_version = inputFileBuffer[0]; @@ -95,9 +95,9 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF position_y++; // allocate buffer image memory - im_Tundra = gdImageCreateTrueColor(columns * bits , (position_y) * fontData.height); + canvas = gdImageCreateTrueColor(columns * bits , (position_y) * fontData.height); - if (!im_Tundra) { + if (!canvas) { perror("Error, can't allocate buffer image memory"); exit (6); } @@ -169,7 +169,7 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF if (character !=1 && character !=2 && character !=4 && character !=6) { - alDrawChar(im_Tundra, fontData.font_data, bits, fontData.height, + alDrawChar(canvas, fontData.font_data, bits, fontData.height, position_x, position_y, background, foreground, character); position_x++; @@ -179,6 +179,6 @@ void tundra(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputF } // create output image - output(im_Tundra, outputFile, retinaout, createRetinaRep); + output(canvas, outputFile, retinaout, createRetinaRep); } diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c @@ -25,17 +25,17 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil int32_t xbin_fontsize = inputFileBuffer[ 9 ]; int32_t xbin_flags = inputFileBuffer[ 10 ]; - gdImagePtr im_XBIN; + gdImagePtr canvas; - im_XBIN = gdImageCreate(8 * xbin_width, xbin_fontsize * xbin_height); + canvas = gdImageCreate(8 * xbin_width, xbin_fontsize * xbin_height); - if (!im_XBIN) { + if (!canvas) { perror("Error, can't allocate buffer image memory"); exit (6); } // allocate black color - gdImageColorAllocate(im_XBIN, 0, 0, 0); + gdImageColorAllocate(canvas, 0, 0, 0); int32_t colors[16]; int32_t offset = 11; @@ -49,7 +49,7 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil { index = (loop * 3) + offset; - colors[loop] = gdImageColorAllocate(im_XBIN, (inputFileBuffer[index] << 2 | inputFileBuffer[index] >> 4), + colors[loop] = gdImageColorAllocate(canvas, (inputFileBuffer[index] << 2 | inputFileBuffer[index] >> 4), (inputFileBuffer[index + 1] << 2 | inputFileBuffer[index + 1] >> 4), (inputFileBuffer[index + 2] << 2 | inputFileBuffer[index + 2] >> 4)); } @@ -57,22 +57,22 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil offset += 48; } else { - colors[0] = gdImageColorAllocate(im_XBIN, 0, 0, 0); - colors[1] = gdImageColorAllocate(im_XBIN, 0, 0, 170); - colors[2] = gdImageColorAllocate(im_XBIN, 0, 170, 0); - colors[3] = gdImageColorAllocate(im_XBIN, 0, 170, 170); - colors[4] = gdImageColorAllocate(im_XBIN, 170, 0, 0); - colors[5] = gdImageColorAllocate(im_XBIN, 170, 0, 170); - colors[6] = gdImageColorAllocate(im_XBIN, 170, 85, 0); - colors[7] = gdImageColorAllocate(im_XBIN, 170, 170, 170); - colors[8] = gdImageColorAllocate(im_XBIN, 85, 85, 85); - colors[9] = gdImageColorAllocate(im_XBIN, 85, 85, 255); - colors[10] = gdImageColorAllocate(im_XBIN, 85, 255, 85); - colors[11] = gdImageColorAllocate(im_XBIN, 85, 255, 255); - colors[12] = gdImageColorAllocate(im_XBIN, 255, 85, 85); - colors[13] = gdImageColorAllocate(im_XBIN, 255, 85, 255); - colors[14] = gdImageColorAllocate(im_XBIN, 255, 255, 85); - colors[15] = gdImageColorAllocate(im_XBIN, 255, 255, 255); + colors[0] = gdImageColorAllocate(canvas, 0, 0, 0); + colors[1] = gdImageColorAllocate(canvas, 0, 0, 170); + colors[2] = gdImageColorAllocate(canvas, 0, 170, 0); + colors[3] = gdImageColorAllocate(canvas, 0, 170, 170); + colors[4] = gdImageColorAllocate(canvas, 170, 0, 0); + colors[5] = gdImageColorAllocate(canvas, 170, 0, 170); + colors[6] = gdImageColorAllocate(canvas, 170, 85, 0); + colors[7] = gdImageColorAllocate(canvas, 170, 170, 170); + colors[8] = gdImageColorAllocate(canvas, 85, 85, 85); + colors[9] = gdImageColorAllocate(canvas, 85, 85, 255); + colors[10] = gdImageColorAllocate(canvas, 85, 255, 85); + colors[11] = gdImageColorAllocate(canvas, 85, 255, 255); + colors[12] = gdImageColorAllocate(canvas, 255, 85, 85); + colors[13] = gdImageColorAllocate(canvas, 255, 85, 255); + colors[14] = gdImageColorAllocate(canvas, 255, 255, 85); + colors[15] = gdImageColorAllocate(canvas, 255, 255, 255); } // font @@ -150,7 +150,7 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil background = (attribute & 240) >> 4; foreground = attribute & 15; - alDrawChar(im_XBIN, font_data, 8, 16, position_x, position_y, colors[background], colors[foreground], character); + alDrawChar(canvas, font_data, 8, 16, position_x, position_y, colors[background], colors[foreground], character); position_x++; @@ -178,7 +178,7 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil background = (attribute & 240) >> 4; foreground = attribute & 15; - alDrawChar(im_XBIN, font_data, 8, xbin_fontsize, position_x, position_y, colors[background], colors[foreground], character); + alDrawChar(canvas, font_data, 8, xbin_fontsize, position_x, position_y, colors[background], colors[foreground], character); position_x++; offset+=2; @@ -186,7 +186,7 @@ void xbin(unsigned char *inputFileBuffer, int32_t inputFileSize, char *outputFil } // create output file - output(im_XBIN, outputFile, retinaout, createRetinaRep); + output(canvas, outputFile, retinaout, createRetinaRep); // nuke garbage free(font_data_xbin);