@@ -55,6 +55,33 @@ static bool printImageIterm(FFinstance* instance)
5555 return true;
5656}
5757
58+ static bool printImageKittyDirect (FFinstance * instance )
59+ {
60+ if (instance -> config .logo .width == 0 || instance -> config .logo .height == 0 )
61+ return false;
62+
63+ if (!ffFileExists (instance -> config .logo .source .chars , S_IFREG ))
64+ return false;
65+
66+ if (!ffStrbufEndsWithIgnCaseS (& instance -> config .logo .source , ".png" ))
67+ return false;
68+
69+ ffPrintCharTimes (' ' , instance -> config .logo .paddingLeft );
70+ FFstrbuf base64 = base64Encode (& instance -> config .logo .source );
71+ printf ("\033_Ga=T,f=100,t=f,c=%u,r=%u,C=1;%s\033\\\033[9999999D" ,
72+ (unsigned ) instance -> config .logo .width ,
73+ (unsigned ) instance -> config .logo .height ,
74+ base64 .chars
75+ );
76+
77+ instance -> state .logoWidth = instance -> config .logo .width + instance -> config .logo .paddingLeft + instance -> config .logo .paddingRight ;
78+ instance -> state .logoHeight = instance -> config .logo .height ;
79+
80+ ffStrbufDestroy (& base64 );
81+
82+ return true;
83+ }
84+
5885#if defined(FF_HAVE_IMAGEMAGICK7 ) || defined(FF_HAVE_IMAGEMAGICK6 )
5986
6087#define FF_KITTY_MAX_CHUNK_SIZE 4096
@@ -722,6 +749,8 @@ bool ffLogoPrintImageIfExists(FFinstance* instance, FFLogoType type)
722749{
723750 if (type == FF_LOGO_TYPE_IMAGE_ITERM )
724751 return printImageIterm (instance );
752+ if (type == FF_LOGO_TYPE_IMAGE_KITTY )
753+ return printImageKittyDirect (instance );
725754 return false;
726755}
727756#endif //FF_HAVE_IMAGEMAGICK{6, 7}
0 commit comments