5static atomic_uint_fast32_t sprixelid_nonce;
8 fprintf(out,
"sprixel %d (%p) %" PRIu64
"B %dx%d (%dx%d) @%d/%d state: %d\n",
14 for(
unsigned y = 0 ;
y < s->
dimy ; ++
y){
15 for(
unsigned x = 0 ;
x < s->
dimx ; ++
x){
22 for(
unsigned y = 0 ;
y < s->
dimy ; ++
y){
23 for(
unsigned x = 0 ;
x < s->
dimx ; ++
x){
28 fprintf(out,
"%03d] missing!\n",
idx);
56 int dimy = hides->
dimy;
57 int dimx = hides->
dimx;
62 n->sprite->smap =
NULL;
84 if(ncplane_pile(s->
n) ==
NULL){
90 loginfo(
"marking sprixel %u hidden", s->
id);
106 int localy =
y - s->
n->
absy;
107 int localx =
x - s->
n->
absx;
122 memset(ret, 0,
sizeof(*ret));
123 if(fbuf_init(&ret->
glyph)){
130 ret->
id = ++sprixelid_nonce;
132 if(ret->
id >= 0x1000000){
137 if(ncplane_pile(ret->
n)){
138 ncpile* np = ncplane_pile(ret->
n);
157 if(&spx->
glyph != f){
158 fbuf_free(&spx->
glyph);
159 memcpy(&spx->
glyph, f,
sizeof(*f));
172 int idx = s->
dimx * ycell + xcell;
216 gettimeofday(&tv,
NULL);
217 int stir = (tv.tv_sec >> 3) ^ tv.tv_usec;
218 sprixelid_nonce = (rand() ^ stir) % 0xffffffu;
227 loginfo(
"rescaling -> %ux%u", ncellpxy, ncellpxx);
229 int nrows = (spx->
pixy + (ncellpxy - 1)) / ncellpxy;
230 int ncols = (spx->
pixx + (ncellpxx - 1)) / ncellpxx;
231 tament* ntam = create_tam(nrows, ncols);
235 for(
unsigned y = 0 ;
y < spx->
dimy ; ++
y){
236 for(
unsigned x = 0 ;
x < spx->
dimx ; ++
x){
243 ncplane_resize_simple(spx->
n, nrows, ncols);
void sixelmap_free(struct sixelmap *s)
#define logdebug(fmt,...)
int ncplane_abs_x(const ncplane *n)
int ncplane_abs_y(const ncplane *n)
const notcurses * ncplane_notcurses_const(const ncplane *n)
notcurses * ncplane_notcurses(const ncplane *n)
sprixel * sprixel_recycle(ncplane *n)
void sprixel_movefrom(sprixel *s, int y, int x)
void sprixel_hide(sprixel *s)
int sprixel_load(sprixel *spx, fbuf *f, unsigned pixy, unsigned pixx, int parse_start, sprixel_e state)
int sprite_wipe(const notcurses *nc, sprixel *s, int ycell, int xcell)
void sprixel_invalidate(sprixel *s, int y, int x)
int sprite_init(tinfo *t, int fd)
int sprixel_rescale(sprixel *spx, unsigned ncellpxy, unsigned ncellpxx)
void sprixel_free(sprixel *s)
int sprite_clear_all(const tinfo *t, fbuf *f)
void sprixel_debug(const sprixel *s, FILE *out)
sprixel * sprixel_alloc(ncplane *n, int dimy, int dimx)
@ SPRIXCELL_ANNIHILATED_TRANS
unsigned char * needs_refresh
ncpixelimpl_e pixel_implementation
int(* pixel_init)(struct tinfo *ti, int fd)
int(* pixel_wipe)(struct sprixel *s, int y, int x)
uint8_t *(* pixel_trans_auxvec)(const struct ncpile *p)
int(* pixel_clear_all)(fbuf *f)