first pass at ncdirecf_geom() #1659

pull/1663/head
nick black 3 years ago committed by Nick Black
parent c42fab1564
commit 646f57312e

@ -1214,4 +1214,22 @@ ncdirectv* ncdirectf_render(ncdirect* n, ncdirectf* frame,
int ncdirectf_geom(ncdirect* n, ncdirectf* frame,
ncblitter_e* blitter, ncscale_e scale,
int maxy, int maxx, ncvgeom* geom){
struct ncvisual_options vopts = {
.blitter = blitter ? *blitter : NCBLIT_DEFAULT,
.scaling = scale,
.leny = maxy,
.lenx = maxx,
};
geom->cdimy = n->tcache.cellpixy;
geom->cdimx = n->tcache.cellpixx;
geom->maxpixely = n->tcache.sixel_maxy;
geom->maxpixelx = n->tcache.sixel_maxx;
const struct blitset* bset;
int r = ncvisual_blitset_geom(NULL, frame, &vopts, &geom->pixy, &geom->pixx,
&geom->scaley, &geom->scalex,
&geom->rpixy, &geom->rpixx, &bset);
if(r == 0 && blitter){
*blitter = bset->geom;
}
return r;
}

@ -661,6 +661,11 @@ struct blitset {
#include "blitset.h"
int ncvisual_blitset_geom(const notcurses* nc, const struct ncvisual* n,
const struct ncvisual_options* vopts,
int* y, int* x, int* scaley, int* scalex,
int* leny, int* lenx, const struct blitset** blitter);
static inline int
ncfputs(const char* ext, FILE* out){
int r;

@ -78,11 +78,10 @@ ncvisual_origin(const struct ncvisual_options* vopts, int* restrict begy, int* r
// FIXME we ought also do the output calculations here (how many rows x cols,
// given the input plane vopts->n and scaling vopts->scaling)--but do not
// perform any actual scaling, nor create any planes!
static int
ncvisual_blitset_geom(const notcurses* nc, const ncvisual* n,
const struct ncvisual_options* vopts,
int* y, int* x, int* scaley, int* scalex,
int* leny, int* lenx, const struct blitset** blitter){
int ncvisual_blitset_geom(const notcurses* nc, const ncvisual* n,
const struct ncvisual_options* vopts,
int* y, int* x, int* scaley, int* scalex,
int* leny, int* lenx, const struct blitset** blitter){
int fakeleny, fakelenx;
if(leny == NULL){
leny = &fakeleny;

Loading…
Cancel
Save