libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit 9c6bbee649914e8d17ab3cbab991f61f76c0d92c
parent 069be3afa785edb263b9a6ae1253b42b1619b79a
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 17 Feb 2020 09:21:16 +0100

Add support for user-specified columns in the PCBoard loader.

Diffstat:
Msrc/loaders/pcboard.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c @@ -47,6 +47,9 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) struct fontStruct fontData; size_t loop = 0, structIndex = 0; + options->columns = options->columns ? options->columns : 80; + uint16_t columns = options->columns; + /* font selection */ select_font(&fontData, options->font); @@ -66,7 +69,7 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) while (loop < ctx->length) { cursor = &ctx->buffer[loop]; - if (column == 80) { + if (column == columns) { row++; column = 0; } @@ -149,7 +152,7 @@ ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options) rowMax++; /* allocate buffer image memory */ - canvas = gdImageCreate(80 * options->bits, (rowMax)*fontData.height); + canvas = gdImageCreate(columns * options->bits, (rowMax)*fontData.height); if (!canvas) { ctx->error = ANSILOVE_GD_ERROR;