ansilove

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

commit d0a641b935ed84ea11b255d3d42393432870dee4
parent 98e5fae26a0b65077bef454d56a09c2abc0ce818
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat, 16 Jan 2016 16:21:05 +0100

Allocating standard, CED and WorkBench color palettes in the ANSI image buffer

Diffstat:
Msrc/ansilove.c | 88++++++++++++++++++++++++++++++++++---------------------------------------------
1 file changed, 38 insertions(+), 50 deletions(-)

diff --git a/src/ansilove.c b/src/ansilove.c @@ -647,68 +647,56 @@ void alAnsiLoader(char *input, char *output, char *retinaout, char *font, int32_ if (ced) { - for (loop=0; loop<16; loop++) + colors[0]=gdImageColorAllocate(im_ANSi, 170, 170, 170); + + for (loop=1; loop<16; loop++) { - colors[loop]=gdImageColorAllocate(im_ANSi, 170, 170, 170); + colors[loop]=gdImageColorAllocate(im_ANSi, 0, 0, 0); } - - int32_t ced_color; - ced_color = gdImageColorAllocate(im_ANSi, 170, 170, 170); - ced_color = gdImageColorAllocate(im_Backgrnd, 170, 170, 170); - - gdImageFill(im_ANSi,0,0,ced_color); - gdImageFilledRectangle(im_Backgrnd, 0, 0, 144, 16, ced_color); - } else if (workbench) { - gdImageColorAllocate(im_ANSi, 170, 170, 170); gdImageFill(im_ANSi, 0, 0, 0); - - colors[0] = gdImageColorAllocate(im_Font, 170, 170, 170); - colors[1] = gdImageColorAllocate(im_Font, 0, 0, 255); - colors[2] = gdImageColorAllocate(im_Font, 255, 255, 255); - colors[3] = gdImageColorAllocate(im_Font, 0, 255, 255); - colors[4] = gdImageColorAllocate(im_Font, 0, 0, 0); - colors[5] = gdImageColorAllocate(im_Font, 255, 0, 255); - colors[6] = gdImageColorAllocate(im_Font, 102, 136, 187); - colors[7] = gdImageColorAllocate(im_Font, 255, 255, 255); - colors[8] = gdImageColorAllocate(im_Font, 170, 170, 170); - colors[9] = gdImageColorAllocate(im_Font, 0, 0, 255); - colors[10] = gdImageColorAllocate(im_Font, 255, 255, 255); - colors[11] = gdImageColorAllocate(im_Font, 0, 255, 255); - colors[12] = gdImageColorAllocate(im_Font, 0, 0, 0); - colors[13] = gdImageColorAllocate(im_Font, 255, 0, 255); - colors[14] = gdImageColorAllocate(im_Font, 102, 136, 187); - colors[15] = gdImageColorAllocate(im_Font, 255, 255, 255); - - gdImagePaletteCopy(im_Backgrnd, im_Font); + colors[0] = gdImageColorAllocate(im_ANSi, 170, 170, 170); + colors[1] = gdImageColorAllocate(im_ANSi, 0, 0, 255); + colors[2] = gdImageColorAllocate(im_ANSi, 255, 255, 255); + colors[3] = gdImageColorAllocate(im_ANSi, 0, 255, 255); + colors[4] = gdImageColorAllocate(im_ANSi, 0, 0, 0); + colors[5] = gdImageColorAllocate(im_ANSi, 255, 0, 255); + colors[6] = gdImageColorAllocate(im_ANSi, 102, 136, 187); + colors[7] = gdImageColorAllocate(im_ANSi, 255, 255, 255); + colors[8] = gdImageColorAllocate(im_ANSi, 170, 170, 170); + colors[9] = gdImageColorAllocate(im_ANSi, 0, 0, 255); + colors[10] = gdImageColorAllocate(im_ANSi, 255, 255, 255); + colors[11] = gdImageColorAllocate(im_ANSi, 0, 255, 255); + colors[12] = gdImageColorAllocate(im_ANSi, 0, 0, 0); + colors[13] = gdImageColorAllocate(im_ANSi, 255, 0, 255); + colors[14] = gdImageColorAllocate(im_ANSi, 102, 136, 187); + colors[15] = gdImageColorAllocate(im_ANSi, 255, 255, 255); } else { // Allocate standard ANSi color palette - colors[0] = gdImageColorAllocate(im_Font, 0, 0, 0); - colors[1] = gdImageColorAllocate(im_Font, 170, 0, 0); - colors[2] = gdImageColorAllocate(im_Font, 0, 170, 0); - colors[3] = gdImageColorAllocate(im_Font, 170, 85, 0); - colors[4] = gdImageColorAllocate(im_Font, 0, 0, 170); - colors[5] = gdImageColorAllocate(im_Font, 170, 0, 170); - colors[6] = gdImageColorAllocate(im_Font, 0, 170, 170); - colors[7] = gdImageColorAllocate(im_Font, 170, 170, 170); - colors[8] = gdImageColorAllocate(im_Font, 85, 85, 85); - colors[9] = gdImageColorAllocate(im_Font, 255, 85, 85); - colors[10] = gdImageColorAllocate(im_Font, 85, 255, 85); - colors[11] = gdImageColorAllocate(im_Font, 255, 255, 85); - colors[12] = gdImageColorAllocate(im_Font, 85, 85, 255); - colors[13] = gdImageColorAllocate(im_Font, 255, 85, 255); - colors[14] = gdImageColorAllocate(im_Font, 85, 255, 255); - colors[15] = gdImageColorAllocate(im_Font, 255, 255, 255); - colors[20] = gdImageColorAllocate(im_Font, 200, 220, 169); - - gdImagePaletteCopy(im_Backgrnd, im_Font); - + 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[20] = gdImageColorAllocate(im_ANSi, 200, 220, 169); + background_canvas = gdImageColorAllocate(im_ANSi, 0, 0, 0); }