notcurses-view: print blitter name #805

This commit is contained in:
nick black 2020-07-19 02:54:53 -04:00
parent 431d4a449d
commit 37ceb753bf
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
8 changed files with 42 additions and 1 deletions

View File

@ -1,6 +1,9 @@
This document attempts to list user-visible changes and any major internal This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses. rearrangements of Notcurses.
* 1.6.4 (not yet released)
* Added `notcurses_str_blitter()`.
* 1.6.3 (2020-07-16) * 1.6.3 (2020-07-16)
* No user-visible changes. * No user-visible changes.

View File

@ -2639,6 +2639,9 @@ typedef enum {
NCBLIT_SIXEL, // 6 rows, 1 col (RGB), spotty support among terminals NCBLIT_SIXEL, // 6 rows, 1 col (RGB), spotty support among terminals
} ncblitter_e; } ncblitter_e;
// Get the name of a blitter.
const char* notcurses_str_blitter(ncblitter_e blitter);
struct ncvisual_options { struct ncvisual_options {
// if no ncplane is provided, one will be created using the exact size // if no ncplane is provided, one will be created using the exact size
// necessary to render the source with perfect fidelity (this might be // necessary to render the source with perfect fidelity (this might be

View File

@ -82,6 +82,8 @@ typedef int (*streamcb)(struct notcurses*, struct ncvisual*, void*);
**char* ncvisual_subtitle(const struct ncvisual* ncv);** **char* ncvisual_subtitle(const struct ncvisual* ncv);**
**const char* notcurses_str_blitter(ncblitter_e blitter);**
# DESCRIPTION # DESCRIPTION
An **ncvisual** is a virtual pixel framebuffer. They can be created from An **ncvisual** is a virtual pixel framebuffer. They can be created from

View File

@ -895,6 +895,9 @@ typedef struct notcurses_options {
// there can be four numbers separated by commas. // there can be four numbers separated by commas.
API int notcurses_lex_margins(const char* op, notcurses_options* opts); API int notcurses_lex_margins(const char* op, notcurses_options* opts);
// Get the name of a blitter.
API const char* notcurses_str_blitter(ncblitter_e blitter);
// Lex a visual scaling mode (one of "none", "stretch", or "scale"). // Lex a visual scaling mode (one of "none", "stretch", or "scale").
API int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode); API int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode);

View File

@ -85,6 +85,7 @@ typedef struct notcurses_options {
struct notcurses* notcurses_init(const notcurses_options*, FILE*); struct notcurses* notcurses_init(const notcurses_options*, FILE*);
void notcurses_version_components(int* major, int* minor, int* patch, int* tweak); void notcurses_version_components(int* major, int* minor, int* patch, int* tweak);
int notcurses_lex_margins(const char* op, notcurses_options* opts); int notcurses_lex_margins(const char* op, notcurses_options* opts);
const char* notcurses_str_blitter(ncblitter_e blitter);
int notcurses_stop(struct notcurses*); int notcurses_stop(struct notcurses*);
int notcurses_render(struct notcurses*); int notcurses_render(struct notcurses*);
int notcurses_render_to_file(struct notcurses* nc, FILE* fp); int notcurses_render_to_file(struct notcurses* nc, FILE* fp);

View File

@ -499,6 +499,31 @@ const struct blitset notcurses_blitters[] = {
.blit = NULL, .fill = false, }, .blit = NULL, .fill = false, },
}; };
const char* notcurses_str_blitter(ncblitter_e blitter){
switch(blitter){
case NCBLIT_DEFAULT:
return "default";
case NCBLIT_8x1:
return "eightstep";
case NCBLIT_1x1:
return "ascii";
case NCBLIT_2x1:
return "halfblocks";
case NCBLIT_1x1x4:
return "shadeblocks";
case NCBLIT_2x2:
return "quadblitter";
case NCBLIT_4x1:
return "fourstep";
case NCBLIT_BRAILLE:
return "braille";
case NCBLIT_SIXEL:
return "sixel";
default:
return NULL;
}
}
int ncblit_bgrx(const void* data, int linesize, const struct ncvisual_options* vopts){ int ncblit_bgrx(const void* data, int linesize, const struct ncvisual_options* vopts){
if(vopts->flags > NCVISUAL_OPTION_BLEND){ if(vopts->flags > NCVISUAL_OPTION_BLEND){
return -1; return -1;

View File

@ -72,6 +72,9 @@ int interrogate_terminfo(tinfo* ti){
return -1; return -1;
} }
terminfostr(&ti->civis, "civis"); // cursor invisible terminfostr(&ti->civis, "civis"); // cursor invisible
if(ti->civis == NULL){
terminfostr(&ti->civis, "chts");// hard-to-see cursor
}
terminfostr(&ti->cnorm, "cnorm"); // cursor normal (undo civis/cvvis) terminfostr(&ti->cnorm, "cnorm"); // cursor normal (undo civis/cvvis)
terminfostr(&ti->standout, "smso"); // begin standout mode terminfostr(&ti->standout, "smso"); // begin standout mode
terminfostr(&ti->uline, "smul"); // begin underline mode terminfostr(&ti->uline, "smul"); // begin underline mode

View File

@ -61,7 +61,8 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
intmax_t ns = timespec_to_ns(&now) - timespec_to_ns(start); intmax_t ns = timespec_to_ns(&now) - timespec_to_ns(start);
// clear top line only // clear top line only
stdn->printf(0, NCAlign::Left, "frame %06d\u2026", *framecount); stdn->printf(0, NCAlign::Left, "frame %06d\u2026 (%s)", *framecount,
notcurses_str_blitter(vopts->blitter));
char* subtitle = ncvisual_subtitle(ncv); char* subtitle = ncvisual_subtitle(ncv);
if(subtitle){ if(subtitle){
if(!subtitle_plane){ if(!subtitle_plane){