mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
[intro] add natasha orca when we have pixel support #1423
This commit is contained in:
parent
2cf0f06562
commit
3e4709e595
BIN
data/natasha-blur.png
Normal file
BIN
data/natasha-blur.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 KiB |
BIN
data/natasha-blur.xcf
Normal file
BIN
data/natasha-blur.xcf
Normal file
Binary file not shown.
@ -2383,8 +2383,9 @@ API ALLOC struct ncvisual* ncvisual_from_plane(const struct ncplane* n,
|
|||||||
int begy, int begx,
|
int begy, int begx,
|
||||||
int leny, int lenx);
|
int leny, int lenx);
|
||||||
|
|
||||||
#define NCVISUAL_OPTION_NODEGRADE 0x0001ull // fail rather than degrade
|
#define NCVISUAL_OPTION_NODEGRADE 0x0001ull // fail rather than degrade
|
||||||
#define NCVISUAL_OPTION_BLEND 0x0002ull // use CELL_ALPHA_BLEND with visual
|
#define NCVISUAL_OPTION_BLEND 0x0002ull // use CELL_ALPHA_BLEND with visual
|
||||||
|
#define NCVISUAL_OPTION_HORALIGNED 0x0004ull // x is an alignment, not absolute
|
||||||
|
|
||||||
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
|
||||||
@ -2397,7 +2398,8 @@ struct ncvisual_options {
|
|||||||
ncscale_e scaling;
|
ncscale_e scaling;
|
||||||
// if an ncplane is provided, y and x specify where the visual will be
|
// if an ncplane is provided, y and x specify where the visual will be
|
||||||
// rendered on that plane. otherwise, they specify where the created ncplane
|
// rendered on that plane. otherwise, they specify where the created ncplane
|
||||||
// will be placed relative to the standard plane's origin.
|
// will be placed relative to the standard plane's origin. x is an ncalign_e
|
||||||
|
// value if NCVISUAL_OPTION_HORALIGNED is provided.
|
||||||
int y, x;
|
int y, x;
|
||||||
// the section of the visual that ought be rendered. for the entire visual,
|
// the section of the visual that ought be rendered. for the entire visual,
|
||||||
// pass an origin of 0, 0 and a size of 0, 0 (or the true height and width).
|
// pass an origin of 0, 0 and a size of 0, 0 (or the true height and width).
|
||||||
@ -2405,8 +2407,9 @@ struct ncvisual_options {
|
|||||||
// prohibited.
|
// prohibited.
|
||||||
int begy, begx; // origin of rendered section
|
int begy, begx; // origin of rendered section
|
||||||
int leny, lenx; // size of rendered section
|
int leny, lenx; // size of rendered section
|
||||||
// use NCBLIT_DEFAULT if you don't care, to use NCBLIT_2x2 (assuming
|
// use NCBLIT_DEFAULT if you don't care, an appropriate blitter will be
|
||||||
// UTF8) or NCBLIT_1x1 (in an ASCII environment)
|
// chosen for your terminal, given your scaling. NCBLIT_PIXEL is never
|
||||||
|
// chosen for NCBLIT_DEFAULT.
|
||||||
ncblitter_e blitter; // glyph set to use (maps input to output cells)
|
ncblitter_e blitter; // glyph set to use (maps input to output cells)
|
||||||
uint64_t flags; // bitmask over NCVISUAL_OPTION_*
|
uint64_t flags; // bitmask over NCVISUAL_OPTION_*
|
||||||
};
|
};
|
||||||
|
@ -186,32 +186,35 @@ int fallin_demo(struct notcurses* nc){
|
|||||||
struct ncplane* n = NULL;
|
struct ncplane* n = NULL;
|
||||||
#ifndef DFSG_BUILD
|
#ifndef DFSG_BUILD
|
||||||
if(notcurses_canopen_images(nc)){
|
if(notcurses_canopen_images(nc)){
|
||||||
char* path = find_data("lamepatents.jpg");
|
char* path = find_data("lamepatents.jpg");
|
||||||
struct ncvisual* ncv = ncvisual_from_file(path);
|
if(path == NULL){
|
||||||
free(path);
|
goto err;
|
||||||
if(ncv == NULL){
|
}
|
||||||
goto err;
|
struct ncvisual* ncv = ncvisual_from_file(path);
|
||||||
}
|
free(path);
|
||||||
struct ncplane_options nopts = {
|
if(ncv == NULL){
|
||||||
.rows = dimy - 2,
|
goto err;
|
||||||
.cols = dimx,
|
}
|
||||||
.y = 1,
|
struct ncplane_options nopts = {
|
||||||
};
|
.rows = dimy - 2,
|
||||||
n = ncplane_create(stdn, &nopts);
|
.cols = dimx,
|
||||||
if(n == NULL){
|
.y = 1,
|
||||||
goto err;
|
};
|
||||||
}
|
n = ncplane_create(stdn, &nopts);
|
||||||
struct ncvisual_options vopts = {
|
if(n == NULL){
|
||||||
.scaling = NCSCALE_STRETCH,
|
goto err;
|
||||||
//.blitter = NCBLIT_PIXEL,
|
}
|
||||||
.n = n,
|
struct ncvisual_options vopts = {
|
||||||
};
|
.scaling = NCSCALE_STRETCH,
|
||||||
if(ncvisual_render(nc, ncv, &vopts) == NULL){
|
//.blitter = NCBLIT_PIXEL,
|
||||||
|
.n = n,
|
||||||
|
};
|
||||||
|
if(ncvisual_render(nc, ncv, &vopts) == NULL){
|
||||||
|
ncvisual_destroy(ncv);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
assert(ncvisual_decode(ncv) == 1);
|
||||||
ncvisual_destroy(ncv);
|
ncvisual_destroy(ncv);
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
assert(ncvisual_decode(ncv) == 1);
|
|
||||||
ncvisual_destroy(ncv);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int ret = drop_bricks(nc, arr, arrcount);
|
int ret = drop_bricks(nc, arr, arrcount);
|
||||||
|
@ -28,6 +28,31 @@ fader(struct notcurses* nc, struct ncplane* ncp, void* curry){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
orcaride(struct notcurses* nc){
|
||||||
|
char* path = find_data("natasha-blur.png");
|
||||||
|
if(path == NULL){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
struct ncvisual* ncv = ncvisual_from_file(path);
|
||||||
|
free(path);
|
||||||
|
if(ncv == NULL){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
struct ncvisual_options vopts = {
|
||||||
|
.blitter = NCBLIT_PIXEL,
|
||||||
|
.flags = NCVISUAL_OPTION_NODEGRADE,
|
||||||
|
};
|
||||||
|
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
|
||||||
|
if(n == NULL){
|
||||||
|
ncvisual_destroy(ncv);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
DEMO_RENDER(nc);
|
||||||
|
ncvisual_destroy(ncv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int intro(struct notcurses* nc){
|
int intro(struct notcurses* nc){
|
||||||
if(!notcurses_canutf8(nc)){
|
if(!notcurses_canutf8(nc)){
|
||||||
return 0;
|
return 0;
|
||||||
@ -146,6 +171,9 @@ int intro(struct notcurses* nc){
|
|||||||
}
|
}
|
||||||
ncplane_off_styles(ncp, NCSTYLE_BLINK); // heh FIXME replace with pulse
|
ncplane_off_styles(ncp, NCSTYLE_BLINK); // heh FIXME replace with pulse
|
||||||
}
|
}
|
||||||
|
if(notcurses_check_pixel_support(nc) && notcurses_canopen_images(nc)){
|
||||||
|
orcaride(nc);
|
||||||
|
}
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
uint64_t deadline = timespec_to_ns(&now) + timespec_to_ns(&demodelay) * 2;
|
uint64_t deadline = timespec_to_ns(&now) + timespec_to_ns(&demodelay) * 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user