972 {
974 if(init_sprixel_animation(s)){
975 return -1;
976 }
978 const int cellpxy = ncplane_pile(s->
n)->cellpxy;
979 const int cellpxx = ncplane_pile(s->
n)->cellpxx;
980 const int ystart = ycell * cellpxy;
981 const int xstart = xcell * cellpxx;
982 const int xlen = xstart + cellpxx > s->
pixx ? s->
pixx - xstart : cellpxx;
983 const int ylen = ystart + cellpxy > s->
pixy ? s->
pixy - ystart : cellpxy;
984 const int linesize =
xlen * 4;
986 const int tyx = xcell + ycell * s->
dimx;
988 int totalout = 0;
991 int targetout = 0;
992
993
994 logdebug(
"placing %d/%d at %d/%d",
ylen,
xlen, ycell * cellpxy, xcell * cellpxx);
995 while(chunks--){
996 if(totalout == 0){
997 const int c = kitty_anim_auxvec_blitsource_p(s, auxvec) ? 2 : 1;
998 const int r = kitty_anim_auxvec_blitsource_p(s, auxvec) ? 1 : 2;
999 if(fbuf_printf(f, "\e_Ga=f,x=%d,y=%d,s=%d,v=%d,i=%d,X=1,c=%d,r=%d,%s;",
1000 xcell * cellpxx, ycell * cellpxy,
xlen,
ylen,
1001 s->
id,
c,
r, chunks ?
"m=1" :
"q=2") < 0){
1002 return -1;
1003 }
1004 }else{
1005 if(fbuf_putn(f, "\x1b_G", 3) < 0){
1006 return -1;
1007 }
1008 if(!chunks){
1009 if(fbuf_putn(f, "q=2,", 4) < 0){
1010 return -1;
1011 }
1012 }
1013 if(fbuf_putn(f, "m=", 2) < 0){
1014 return -1;
1015 }
1016 if(fbuf_putint(f, chunks ? 1 : 0) < 0){
1017 return -1;
1018 }
1019 if(fbuf_putc(f, ';') != 1){
1020 return -1;
1021 }
1022 }
1024 targetout = total;
1025 }
1026 while(totalout < targetout){
1027 int encodeable = targetout - totalout;
1028 if(encodeable > 3){
1029 encodeable = 3;
1030 }
1031 uint32_t source[3];
1032 bool wipe[3];
1033 for(
int e = 0 ;
e < encodeable ; ++
e){
1037 }
1038 const uint32_t* line = (
const uint32_t*)(auxvec + linesize *
y);
1039 source[
e] = line[
x];
1040
1041
1043 if(rgba_trans_p(source[
e], 0)){
1044 if(
x % cellpxx == 0 &&
y % cellpxy == 0){
1048 }
1049 }else{
1050 if(
x % cellpxx == 0 &&
y % cellpxy == 0){
1054 }
1055 }
1057 }
1058 totalout += encodeable;
1059 char out[17];
1060 base64_rgba3(source, encodeable, out, wipe, 0);
1061 if(fbuf_puts(f, out) < 0){
1062 return -1;
1063 }
1064 }
1065 if(fbuf_putn(f, "\x1b\\", 2) < 0){
1066 return -1;
1067 }
1068 }
1069
1071 return 0;
1072}
API int API int API int uint64_t uint64_t uint64_t uint64_t unsigned unsigned xlen
API int API int API int uint64_t uint64_t uint64_t uint64_t unsigned ylen