textplay: expose more of the source material

pull/1647/head
nick black 3 years ago
parent d441dd4d0d
commit d80df651b3
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -570,7 +570,7 @@ ncvisual* ncvisual_from_bgra(const void* bgra, int rows, int rowstride, int cols
// by the end, disprows/dispcols refer to the number of source rows/cols (in // by the end, disprows/dispcols refer to the number of source rows/cols (in
// pixels), which will be mapped to a region of cells scaled by the encodings). // pixels), which will be mapped to a region of cells scaled by the encodings).
// the blit will begin at placey/placex (in terms of cells). begy/begx define // the blit will begin at placey/placex (in terms of cells). begy/begx define
// the origin of the source region to draw (in pixels). leny/lenx defined the // the origin of the source region to draw (in pixels). leny/lenx define the
// geometry of the source region to draw, again in pixels. ncv->pixy and // geometry of the source region to draw, again in pixels. ncv->pixy and
// ncv->pixx define the source geometry in pixels. // ncv->pixx define the source geometry in pixels.
ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitset* bset, ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitset* bset,
@ -749,7 +749,7 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
//fprintf(stderr, "INPUT N: %p rows: %d cols: %d 0x%016lx\n", n ? n : NULL, disppixy, disppixx, flags); //fprintf(stderr, "INPUT N: %p rows: %d cols: %d 0x%016lx\n", n ? n : NULL, disppixy, disppixx, flags);
if(n == NULL || (flags & NCVISUAL_OPTION_CHILDPLANE)){ // create plane if(n == NULL || (flags & NCVISUAL_OPTION_CHILDPLANE)){ // create plane
if(n == NULL){ if(n == NULL){
n = notcurses_stdplane(nc); // FIXME ought allow arbitrary plane n = notcurses_stdplane(nc);
} }
if((createdn = make_sprixel_plane(nc, n, ncv, scaling, &disppixy, &disppixx, if((createdn = make_sprixel_plane(nc, n, ncv, scaling, &disppixy, &disppixx,
flags, &outy, &placey, &placex)) == NULL){ flags, &outy, &placey, &placex)) == NULL){

@ -4,15 +4,15 @@
static const uint32_t LOWCOLOR = 0x004080; static const uint32_t LOWCOLOR = 0x004080;
static const uint32_t HICOLOR = 0xddffdd; static const uint32_t HICOLOR = 0xddffdd;
static const uint32_t NANOSEC = 1000000000ull / 60; // 60 cps static const uint32_t NANOSEC = 1000000000ull / 60; // 60 cps
#define MARGIN 4 #define MARGIN 2
static struct notcurses* static struct notcurses*
init(void){ init(void){
struct notcurses_options opts = { struct notcurses_options opts = {
//.loglevel = NCLOGLEVEL_DEBUG, //.loglevel = NCLOGLEVEL_DEBUG,
.margin_t = MARGIN, .margin_t = MARGIN / 2,
.margin_r = MARGIN, .margin_r = MARGIN,
.margin_b = MARGIN, .margin_b = MARGIN / 2,
.margin_l = MARGIN, .margin_l = MARGIN,
}; };
struct notcurses* nc = notcurses_init(&opts, stdout); struct notcurses* nc = notcurses_init(&opts, stdout);
@ -108,7 +108,7 @@ textplay(struct notcurses* nc, struct ncplane* tplane, struct ncvisual* ncv){
if(!ncv){ if(!ncv){
clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL); clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);
}else{ }else{
for(int i = 0 ; i < 3 ; ++i){ for(int i = 0 ; i < 2 ; ++i){
ncvisual_decode(ncv); ncvisual_decode(ncv);
} }
} }
@ -127,10 +127,10 @@ textplane(struct notcurses* nc){
int dimy, dimx; int dimy, dimx;
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx); struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
struct ncplane_options nopts = { struct ncplane_options nopts = {
.y = MARGIN, .y = MARGIN * 2 + 2,
.x = MARGIN * 2, .x = MARGIN * 4 + 2,
.rows = dimy - MARGIN * 2, .rows = dimy - MARGIN * 4,
.cols = dimx - MARGIN * 4, .cols = dimx - MARGIN * 8,
.name = "text", .name = "text",
}; };
struct ncplane* n = ncplane_create(stdn, &nopts); struct ncplane* n = ncplane_create(stdn, &nopts);

Loading…
Cancel
Save