mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
add notcurses_lex_blitter()
This commit is contained in:
parent
5d6df94187
commit
104bbfef50
5
NEWS.md
5
NEWS.md
@ -1,6 +1,11 @@
|
||||
This document attempts to list user-visible changes and any major internal
|
||||
rearrangements of Notcurses.
|
||||
|
||||
* 1.6.6 (2020-07-19)
|
||||
* `notcurses-pydemo` is now only installed alongside the Python module,
|
||||
using setuptools. CMake no longer installs it.
|
||||
* Added `notcurses_lex_blitter()` and `notcurses_str_scalemode()`.
|
||||
|
||||
* 1.6.5 (2020-07-19)
|
||||
* No user-visible changes.
|
||||
|
||||
|
9
USAGE.md
9
USAGE.md
@ -2639,6 +2639,9 @@ typedef enum {
|
||||
NCBLIT_SIXEL, // 6 rows, 1 col (RGB), spotty support among terminals
|
||||
} ncblitter_e;
|
||||
|
||||
// Lex a blitter.
|
||||
int notcurses_lex_blitter(const char* op, ncblitter_e* blitter);
|
||||
|
||||
// Get the name of a blitter.
|
||||
const char* notcurses_str_blitter(ncblitter_e blitter);
|
||||
|
||||
@ -2671,6 +2674,12 @@ typedef enum {
|
||||
NCSCALE_STRETCH,
|
||||
} ncscale_e;
|
||||
|
||||
// Lex a visual scaling mode (one of "none", "stretch", or "scale").
|
||||
int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode);
|
||||
|
||||
// Get the name of a scaling mode.
|
||||
const char* notcurses_str_scalemode(ncscale_e scalemode);
|
||||
|
||||
// the streaming operation ceases immediately, and that value is propagated out.
|
||||
// The recommended absolute display time target is passed in 'tspec'.
|
||||
typedef int (*streamcb)(struct ncplane*, struct ncvisual*,
|
||||
|
@ -82,6 +82,12 @@ typedef int (*streamcb)(struct notcurses*, struct ncvisual*, void*);
|
||||
|
||||
**char* ncvisual_subtitle(const struct ncvisual* ncv);**
|
||||
|
||||
**int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode);**
|
||||
|
||||
**const char* notcurses_str_scalemode(ncscale_e scalemode);**
|
||||
|
||||
**int notcurses_lex_blitter(const char* op, ncblitter_e* blitter);**
|
||||
|
||||
**const char* notcurses_str_blitter(ncblitter_e blitter);**
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -895,12 +895,18 @@ typedef struct notcurses_options {
|
||||
// there can be four numbers separated by commas.
|
||||
API int notcurses_lex_margins(const char* op, notcurses_options* opts);
|
||||
|
||||
// Lex a blitter.
|
||||
API int notcurses_lex_blitter(const char* op, ncblitter_e* blitter);
|
||||
|
||||
// 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);
|
||||
|
||||
// Get the name of a scaling mode.
|
||||
API const char* notcurses_str_scalemode(ncscale_e scalemode);
|
||||
|
||||
// Initialize a notcurses context on the connected terminal at 'fp'. 'fp' must
|
||||
// be a tty. You'll usually want stdout. NULL can be supplied for 'fp', in
|
||||
// which case /dev/tty will be opened. Returns NULL on error, including any
|
||||
|
@ -146,6 +146,7 @@ typedef enum {
|
||||
NCBLIT_SIXEL, // 6 rows, 1 col (RGB)
|
||||
} ncblitter_e;
|
||||
const char* notcurses_str_blitter(ncblitter_e blitter);
|
||||
int notcurses_lex_blitter(const char* op, ncblitter_e* blitter);
|
||||
uint32_t* ncplane_rgba(const struct ncplane* nc, ncblitter_e blit, int begy, int begx, int leny, int lenx);
|
||||
char* ncplane_contents(const struct ncplane* nc, int begy, int begx, int leny, int lenx);
|
||||
void* ncplane_set_userptr(struct ncplane* n, void* opaque);
|
||||
@ -273,6 +274,8 @@ typedef enum {
|
||||
NCSCALE_SCALE,
|
||||
NCSCALE_STRETCH,
|
||||
} ncscale_e;
|
||||
int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode);
|
||||
const char* notcurses_str_scalemode(ncscale_e scalemode);
|
||||
struct ncvisual* ncvisual_from_file(const char* file, nc_err_e* ncerr);
|
||||
struct ncvisual* ncvisual_from_rgba(const void* rgba, int rows, int rowstride, int cols);
|
||||
struct ncvisual* ncvisual_from_bgra(const void* rgba, int rows, int rowstride, int cols);
|
||||
|
@ -499,6 +499,22 @@ const struct blitset notcurses_blitters[] = {
|
||||
.blit = NULL, .name = NULL, .fill = false, },
|
||||
};
|
||||
|
||||
int notcurses_lex_blitter(const char* op, ncblitter_e* blitter){
|
||||
const struct blitset* bset = notcurses_blitters;
|
||||
while(bset->name){
|
||||
if(strcasecmp(bset->name, op) == 0){
|
||||
*blitter = bset->geom;
|
||||
return 0;
|
||||
}
|
||||
++bset;
|
||||
}
|
||||
if(strcasecmp("default", op) == 0){
|
||||
*blitter = NCBLIT_DEFAULT;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* notcurses_str_blitter(ncblitter_e blitter){
|
||||
if(blitter == NCBLIT_DEFAULT){
|
||||
return "default";
|
||||
|
Loading…
x
Reference in New Issue
Block a user