mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
notcurses-view: print blitter name #805
This commit is contained in:
parent
431d4a449d
commit
37ceb753bf
3
NEWS.md
3
NEWS.md
@ -1,6 +1,9 @@
|
||||
This document attempts to list user-visible changes and any major internal
|
||||
rearrangements of Notcurses.
|
||||
|
||||
* 1.6.4 (not yet released)
|
||||
* Added `notcurses_str_blitter()`.
|
||||
|
||||
* 1.6.3 (2020-07-16)
|
||||
* No user-visible changes.
|
||||
|
||||
|
3
USAGE.md
3
USAGE.md
@ -2639,6 +2639,9 @@ typedef enum {
|
||||
NCBLIT_SIXEL, // 6 rows, 1 col (RGB), spotty support among terminals
|
||||
} ncblitter_e;
|
||||
|
||||
// Get the name of a blitter.
|
||||
const char* notcurses_str_blitter(ncblitter_e blitter);
|
||||
|
||||
struct ncvisual_options {
|
||||
// if no ncplane is provided, one will be created using the exact size
|
||||
// necessary to render the source with perfect fidelity (this might be
|
||||
|
@ -82,6 +82,8 @@ typedef int (*streamcb)(struct notcurses*, struct ncvisual*, void*);
|
||||
|
||||
**char* ncvisual_subtitle(const struct ncvisual* ncv);**
|
||||
|
||||
**const char* notcurses_str_blitter(ncblitter_e blitter);**
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
An **ncvisual** is a virtual pixel framebuffer. They can be created from
|
||||
|
@ -895,6 +895,9 @@ typedef struct notcurses_options {
|
||||
// there can be four numbers separated by commas.
|
||||
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").
|
||||
API int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode);
|
||||
|
||||
|
@ -85,6 +85,7 @@ typedef struct notcurses_options {
|
||||
struct notcurses* notcurses_init(const notcurses_options*, FILE*);
|
||||
void notcurses_version_components(int* major, int* minor, int* patch, int* tweak);
|
||||
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_render(struct notcurses*);
|
||||
int notcurses_render_to_file(struct notcurses* nc, FILE* fp);
|
||||
|
@ -499,6 +499,31 @@ const struct blitset notcurses_blitters[] = {
|
||||
.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){
|
||||
if(vopts->flags > NCVISUAL_OPTION_BLEND){
|
||||
return -1;
|
||||
|
@ -72,6 +72,9 @@ int interrogate_terminfo(tinfo* ti){
|
||||
return -1;
|
||||
}
|
||||
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->standout, "smso"); // begin standout mode
|
||||
terminfostr(&ti->uline, "smul"); // begin underline mode
|
||||
|
@ -61,7 +61,8 @@ auto perframe(struct ncvisual* ncv, struct ncvisual_options* vopts,
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
intmax_t ns = timespec_to_ns(&now) - timespec_to_ns(start);
|
||||
// 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);
|
||||
if(subtitle){
|
||||
if(!subtitle_plane){
|
||||
|
Loading…
x
Reference in New Issue
Block a user