textplay: expose more of the source material

This commit is contained in:
nick black 2021-05-10 01:20:59 -04:00
parent d441dd4d0d
commit d80df651b3
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 10 additions and 10 deletions

View File

@ -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
// 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 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
// ncv->pixx define the source geometry in pixels.
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);
if(n == NULL || (flags & NCVISUAL_OPTION_CHILDPLANE)){ // create plane
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,
flags, &outy, &placey, &placex)) == NULL){

View File

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