add NCSCALE_INFLATE

pull/1660/head
nick black 3 years ago
parent 9ce8222d36
commit 8bd73378cf
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1,6 +1,9 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.3.1 (not yet released)
* Add `NCSCALE_INFLATE`.
* 2.3.0 (2021-05-09) **"Triumph"**
* No user-visible changes.

@ -3203,9 +3203,13 @@ typedef enum {
NCSCALE_NONE,
NCSCALE_SCALE,
NCSCALE_STRETCH,
NCSCALE_SCALE_HIRES,
NCSCALE_NONE_HIRES,
NCSCALE_INFLATE,
} ncscale_e;
// Lex a scaling mode (one of "none", "stretch", "scale", "hires", or "scalehi").
// Lex a scaling mode (one of "none", "stretch", "scale", "hires",
// "inflate", or "scalehi").
int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode);
// Get the name of a scaling mode.

@ -16,6 +16,7 @@ typedef enum {
NCSCALE_STRETCH,
NCSCALE_NONE_HIRES,
NCSCALE_SCALE_HIRES,
NCSCALE_INFLATE,
} ncscale_e;
typedef enum {
@ -225,8 +226,8 @@ instance **NCSCALE_SCALE_HIRES** and a large image), more rows and columns will
result in more effective resolution.
A string can be transformed to a scaling mode with **notcurses_lex_scalemode**,
recognizing **stretch**, **scalehi**, **hires**, **scale**, and **none**.
Conversion in the opposite direction is performed with
recognizing **stretch**, **scalehi**, **hires**, **scale**, **inflate**, and
**none**. Conversion in the opposite direction is performed with
**notcurses_str_scalemode**.
Assuming a cell is twice as tall as it is wide, **NCBLIT_1x1** (and indeed

@ -86,16 +86,18 @@ typedef enum {
// How to scale an ncvisual during rendering. NCSCALE_NONE will apply no
// scaling. NCSCALE_SCALE scales a visual to the plane's size, maintaining
// aspect ratio. NCSCALE_STRETCH stretches and scales the image in an
// attempt to fill the entirety of the plane. NCSCALE_NONE_HIRES and
// NCSCALE_SCALE_HIRES behave like their counterparts, but admit blitters
// which don't preserve aspect ratio.
// aspect ratio. NCSCALE_INFLATE does the same, but without interpolation.
// NCSCALE_STRETCH stretches and scales the image in an attempt to fill the
// entirety of the plane. NCSCALE_NONE_HIRES and NCSCALE_SCALE_HIRES behave
// like their counterparts, but admit blitters which don't preserve aspect
// ratio.
typedef enum {
NCSCALE_NONE,
NCSCALE_SCALE,
NCSCALE_STRETCH,
NCSCALE_NONE_HIRES,
NCSCALE_SCALE_HIRES,
NCSCALE_INFLATE,
} ncscale_e;
// Returns the number of columns occupied by a multibyte (UTF-8) string, or
@ -905,7 +907,8 @@ 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 scaling mode (one of "none", "stretch", "scale", "hires", or "scalehi").
// Lex a scaling mode (one of "none", "stretch", "scale", "hires",
// "scalehi", or "inflate").
API int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode);
// Get the name of a scaling mode.

@ -2533,6 +2533,8 @@ lex_long(const char* op, int* i, char** endptr){
int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode){
if(strcasecmp(op, "stretch") == 0){
*scalemode = NCSCALE_STRETCH;
}else if(strcasecmp(op, "inflate") == 0){
*scalemode = NCSCALE_INFLATE;
}else if(strcasecmp(op, "scalehi") == 0){
*scalemode = NCSCALE_SCALE_HIRES;
}else if(strcasecmp(op, "hires") == 0){
@ -2550,6 +2552,8 @@ int notcurses_lex_scalemode(const char* op, ncscale_e* scalemode){
const char* notcurses_str_scalemode(ncscale_e scalemode){
if(scalemode == NCSCALE_STRETCH){
return "stretch";
}else if(scalemode == NCSCALE_INFLATE){
return "inflate";
}else if(scalemode == NCSCALE_SCALE){
return "scale";
}else if(scalemode == NCSCALE_NONE){

Loading…
Cancel
Save