Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/ansilove.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ extern "C" {
#define ANSILOVE_FONT_TOPAZ500 36
#define ANSILOVE_FONT_TOPAZ500_PLUS 37

/* Atari fonts */
#define ANSILOVE_FONT_ANSITERM 40

/* Rendering modes */
#define ANSILOVE_MODE_CED 1
#define ANSILOVE_MODE_TRANSPARENT 2
#define ANSILOVE_MODE_WORKBENCH 3
#define ANSILOVE_MODE_ANSITERM1 4 /* ANSIterm default palette (#1), muted high colors */
#define ANSILOVE_MODE_ANSITERM3 5 /* ANSIterm palette #3, intense/saturated high colors */
#define ANSILOVE_MODE_FANSI 6 /* FANSI default palette, slightly brighter, weird cyan */

struct ansilove_png {
uint8_t *buffer;
Expand Down
4 changes: 2 additions & 2 deletions man/libansilove.3
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ images, supporting ANSI (.ANS), PCBoard (.PCB), Binary (.BIN), Artworx
(.ADF), iCE Draw (.IDF), Tundra (.TND) and XBin (.XB) formats.
.Pp
It creates size optimized 4-bit PNG files and supports 80x25 and 80x50
PC fonts (including all the 14 MS-DOS charsets), Amiga fonts, and
iCE colors.
PC fonts (including all the 14 MS-DOS charsets), Amiga and Atari fonts,
and iCE colors.
.Pp
All library functions take a context, defined as an
.Em ansilove_ctx
Expand Down
53 changes: 53 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#define PCB_COLORS 71

/* ANSI palette */

static const uint8_t ansi_palette_red[] = {
0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa,
0x55, 0xff, 0x55, 0xff, 0x55, 0xff, 0x55, 0xff
Expand All @@ -40,6 +42,8 @@ static const uint8_t ansi_palette_blue[] = {
0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff
};

/* Amiga palette */

static const uint8_t workbench_palette_red[] = {
0xaa, 0x00, 0xff, 0x66, 0x00, 0xff, 0x00, 0xff,
0xaa, 0x00, 0xff, 0x66, 0x00, 0xff, 0x00, 0xff
Expand All @@ -55,6 +59,55 @@ static const uint8_t workbench_palette_blue[] = {
0xaa, 0x00, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xff
};

/* Three Atari ST palettes */

static const uint8_t ansiterm1_palette_red[] = {
0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0xB6,
0x6D, 0xFF, 0x6D, 0xFF, 0x6D, 0xFF, 0x6D, 0xFF
};

static const uint8_t ansiterm1_palette_green[] = {
0x00, 0x00, 0x92, 0x6D, 0x00, 0x00, 0x92, 0xB6,
0x6D, 0x6D, 0xFF, 0xFF, 0x6D, 0x6D, 0xFF, 0xFF
};

static const uint8_t ansiterm1_palette_blue[] = {
0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0xB6,
0x6D, 0x6D, 0x00, 0x6D, 0xFF, 0xFF, 0xFF, 0xFF
};

static const uint8_t ansiterm3_palette_red[] = {
0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0x92,
0x49, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF
};

static const uint8_t ansiterm3_palette_green[] = {
0x00, 0x00, 0x92, 0x6D, 0x00, 0x00, 0x92, 0x92,
0x49, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF
};

static const uint8_t ansiterm3_palette_blue[] = {
0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x92,
0x49, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF
};

static const uint8_t fansi_palette_red[] = {
0x00, 0xB6, 0x00, 0xDB, 0x00, 0xB6, 0x00, 0xDB,
0x92, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF
};

static const uint8_t fansi_palette_green[] = {
0x00, 0x00, 0xB6, 0xB6, 0x00, 0x00, 0x92, 0xDB,
0x92, 0x00, 0xFF, 0xFF, 0x00, 0x6D, 0xFF, 0xFF
};

static const uint8_t fansi_palette_blue[] = {
0x00, 0x00, 0x00, 0x00, 0xB6, 0x92, 0xFF, 0xDB,
0x92, 0x00, 0x00, 0x00, 0xFF, 0xB6, 0xFF, 0xFF
};

/* VGA palette */

static const uint8_t vga_palette_red[] = {
0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa,
0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff
Expand Down
8 changes: 8 additions & 0 deletions src/fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "fonts/font_amiga_topaz_1200_plus.h"
#include "fonts/font_amiga_topaz_500.h"
#include "fonts/font_amiga_topaz_500_plus.h"
#include "fonts/font_atari_ansiterm.h"


void
select_font(struct fontStruct *fontData, int font)
Expand Down Expand Up @@ -173,6 +175,12 @@ select_font(struct fontStruct *fontData, int font)
fontData->width = 8;
fontData->height = 16;
break;
case ANSILOVE_FONT_ANSITERM:
fontData->font_data = font_atari_ansiterm;
fontData->width = 8;
fontData->height = 16;
break;

default:
/* in all other cases use the standard DOS font */
fontData->font_data = font_pc_80x25;
Expand Down
2 changes: 2 additions & 0 deletions src/fonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ extern const uint8_t font_amiga_topaz_1200_plus[4096];
extern const uint8_t font_amiga_topaz_500[4096];
extern const uint8_t font_amiga_topaz_500_plus[4096];

extern const uint8_t font_atari_ansiterm[4096];

#endif /* FONTS_H */
Loading