This commit is contained in:
Casey 2022-02-03 22:36:09 +03:00
parent 321999ef6a
commit 47d30d3654
7 changed files with 20 additions and 5 deletions

View File

@ -1,4 +1,4 @@
CFLAGS := -Wall -Wextra -Werror -pedantic -std=c99 -ggdb
CFLAGS := -Wall -Wextra -Werror -pedantic -std=c99
CLIBS := -lm
INCLUDES := -Isrc
OBJECTS := obj/stb_image.o obj/stb_image_resize.o \

View File

@ -52,7 +52,7 @@ const __option_t __style_options[ASC_STL_ENDL + 1] = {
"24-bit RGB (TrueColor)" },
{ ASC_STL_PALETTE,
{ "pal", "palette", "custom", NULL },
"Custom palette (specified via -P)" },
"Custom palette (specified via -P). Either GIMP palette file or N*3 RGB pixels" },
{ -1, { NULL }, NULL }
};

View File

@ -1,5 +1,7 @@
#include "colors.h"
#include "commons.h"
#include <stdio.h>
#include <stdlib.h>
void m_prepare_dither(asc_state_t *state)
{
@ -37,3 +39,9 @@ void m_prepare_dither(asc_state_t *state)
}
}
}
void c_fatal(int code, const char *reason)
{
fprintf(stderr, "Error: %s\n", reason);
exit(code);
}

View File

@ -3,6 +3,7 @@
#include "args.h"
void c_fatal(int code, const char *reason);
void m_prepare_dither(asc_state_t *state);
#endif

View File

@ -28,7 +28,13 @@ int main(int argc, char **argv)
mod_braille_prepare(&state);
mod_braille_main(state);
break;
default:
case ASC_MOD_GRADIENT:
fprintf(stderr, "Error: ASC_MOD_GRADIENT is not implemented yet\n");
break;
case ASC_MOD_BRUTEFORCE:
fprintf(stderr, "Error: ASC_MOD_BRUTEFORCE is not implemented yet\n");
break;
case ASC_MOD_ENDL:
break;
}

View File

@ -199,7 +199,7 @@ void __blk_put_pixel(asc_state_t state, rgba8 top, rgba8 bot, bool final)
case ASC_STL_ANSI_VGA: pal = c_palette_ansi_vga; break;
case ASC_STL_ANSI_XTERM: pal = c_palette_ansi_xterm; break;
case ASC_STL_ANSI_DISCORD: pal = c_palette_ansi_discord; break;
default: break;
default: c_fatal(9, "[UNREACH] Palette is unset"); return;
}
int index_top = closest_color(pal, top),
index_bot = closest_color(pal, bot);

View File

@ -152,7 +152,7 @@ void __bra_put_pixel(asc_state_t state, rgba8 min, rgba8 max, uint8_t ch, bool f
case ASC_STL_ANSI_VGA: pal = c_palette_ansi_vga; break;
case ASC_STL_ANSI_XTERM: pal = c_palette_ansi_xterm; break;
case ASC_STL_ANSI_DISCORD: pal = c_palette_ansi_discord; break;
default: break;
default: c_fatal(9, "[UNREACH] Palette is unset"); return;
}
__bra_putc_ansi(state,
closest_color(pal, min), closest_color(pal, max), ch, pal, final);