diff --git a/data/natasha-blur.png b/data/natasha-blur.png index 182b266de..650c96327 100644 Binary files a/data/natasha-blur.png and b/data/natasha-blur.png differ diff --git a/data/natasha-blur.xcf b/data/natasha-blur.xcf index af43b86d3..094f533ef 100644 Binary files a/data/natasha-blur.xcf and b/data/natasha-blur.xcf differ diff --git a/src/demo/intro.c b/src/demo/intro.c index f194be5e6..c60f8ff84 100644 --- a/src/demo/intro.c +++ b/src/demo/intro.c @@ -29,7 +29,7 @@ fader(struct notcurses* nc, struct ncplane* ncp, void* curry){ } static struct ncplane* -orcashow(struct notcurses* nc){ +orcashow(struct notcurses* nc, int dimy, int dimx){ char* path = find_data("natasha-blur.png"); if(path == NULL){ return NULL; @@ -45,24 +45,28 @@ orcashow(struct notcurses* nc){ }; struct ncplane* n = ncvisual_render(nc, ncv, &vopts); ncvisual_destroy(ncv); + int odimy, odimx, oy, ox; + ncplane_yx(n, &oy, &ox); + ncplane_dim_yx(n, &odimy, &odimx); + if(odimy > dimy - 2){ + ncplane_destroy(n); + return NULL; + } + if(odimx > dimx){ + ncplane_destroy(n); + return NULL; + } + ncplane_move_yx(n, dimy - odimy - 2, dimx - odimx); return n; } static int -orcaride(struct notcurses* nc, struct ncplane* on, int dimy, int dimx, int iteration){ - if(iteration % 2){ - return 0; - } +orcaride(struct notcurses* nc, struct ncplane* on, int dimy, int iteration){ int odimy, odimx, oy, ox; ncplane_yx(on, &oy, &ox); ncplane_dim_yx(on, &odimy, &odimx); - if(iteration % 4 == 0){ - if(oy + odimy + 5 < dimy){ - oy += 5; - } - } - if(ox + odimx + 5 < dimx){ - ox += 5; + if(ox >= odimx / 2){ + ox -= odimx / 2; } if(ncplane_move_yx(on, oy, ox)){ return -1; @@ -191,7 +195,7 @@ int intro(struct notcurses* nc){ } struct ncplane* on = NULL; if(notcurses_check_pixel_support(nc) && notcurses_canopen_images(nc)){ - on = orcashow(nc); + on = orcashow(nc, rows, cols); } struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); @@ -207,7 +211,9 @@ int intro(struct notcurses* nc){ demo_nanosleep(nc, &iter); clock_gettime(CLOCK_MONOTONIC, &now); if(on){ - orcaride(nc, on, rows, cols, flipmode); + if(flipmode % 5 == 0){ + orcaride(nc, on, rows, flipmode); + } } }while(timespec_to_ns(&now) < deadline); ncplane_destroy(on); diff --git a/src/lib/sixel.c b/src/lib/sixel.c index 1afca09c5..d9f69f06d 100644 --- a/src/lib/sixel.c +++ b/src/lib/sixel.c @@ -415,7 +415,7 @@ write_rle(int* printed, int color, FILE* fp, int seenrle, unsigned char crle){ // Emit the sprixel in its entirety, plus enable and disable pixel mode. static int -write_sixel_data(FILE* fp, int lenx, sixeltable* stab, int* parse_start, int* tacache){ +write_sixel_data(FILE* fp, int lenx, int leny, sixeltable* stab, int* parse_start, int* tacache){ *parse_start = fprintf(fp, "\ePq"); // Set Raster Attributes - pan/pad=1 (pixel aspect ratio), Ph=lenx, Pv=leny // using Ph/Pv causes a background to be drawn using color register 0 for all @@ -502,7 +502,7 @@ int sixel_blit_inner(ncplane* nc, int leny, int lenx, sixeltable* stab, free(buf); return -1; } - if(write_sixel_data(fp, lenx, stab, &parse_start, tacache)){ + if(write_sixel_data(fp, lenx, leny, stab, &parse_start, tacache)){ free(tacache); free(buf); return -1;