ansilove

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

commit 70144b60f6e4e069d5cb6f1550ec1c0cbfb433d1
parent 05c5a1b9cc1a1cc102bb3955b72c129c0589c03f
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu, 21 Jan 2016 11:49:24 +0100

Fixing regression in the CED mode rendering

Diffstat:
Msrc/loaders/ansi.c | 19++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/loaders/ansi.c b/src/loaders/ansi.c @@ -466,15 +466,15 @@ void ansi(char *input, char *output, char *retinaout, char *font, int32_t int_bi } int32_t colors[16]; + + int32_t ced_background = 0, ced_foreground = 0; + if (ced) { - colors[0]=gdImageColorAllocate(im_ANSi, 170, 170, 170); - - for (loop=1; loop<16; loop++) - { - colors[loop]=gdImageColorAllocate(im_ANSi, 0, 0, 0); - } + ced_background = gdImageColorAllocate(im_ANSi, 170, 170, 170); + ced_foreground = gdImageColorAllocate(im_ANSi, 0, 0, 0); + gdImageFill(im_ANSi, 0, 0, ced_background); } else if (workbench) { @@ -537,8 +537,13 @@ void ansi(char *input, char *output, char *retinaout, char *font, int32_t int_bi position_x = ansi_buffer[loop].position_x; position_y = ansi_buffer[loop].position_y; - alDrawChar(im_ANSi, fontData.font_data, int_bits, fontData.font_size_y, + if (ced) { + alDrawChar(im_ANSi, fontData.font_data, int_bits, fontData.font_size_y, + position_x, position_y, ced_background, ced_foreground, character); + } else { + alDrawChar(im_ANSi, fontData.font_data, int_bits, fontData.font_size_y, position_x, position_y, colors[color_background], colors[color_foreground], character); + } }