@ -161,8 +161,12 @@ write_rle(FILE* fp, int seenrle, unsigned char crle){
// Emit the sprixel in its entirety, plus enable and disable pixel mode.
// Emit the sprixel in its entirety, plus enable and disable pixel mode.
static int
static int
write_sixel_data ( FILE * fp , int len x, sixeltable * stab ) {
write_sixel_data ( FILE * fp , int len y, int len x, sixeltable * stab ) {
fprintf ( fp , " \ e[?80h \ ePq " ) ; // FIXME pixelon
fprintf ( fp , " \ e[?80h \ ePq " ) ; // FIXME pixelon
// Set Raster Attributes - pan/pad=1 (pixel aspect ratio), Ph=lenx, Pv=leny
fprintf ( fp , " \" 1;1;%d;%d " , lenx , leny ) ;
for ( int i = 0 ; i < stab - > ctab - > colors ; + + i ) {
for ( int i = 0 ; i < stab - > ctab - > colors ; + + i ) {
const unsigned char * rgb = stab - > ctab - > table + i * 5 ;
const unsigned char * rgb = stab - > ctab - > table + i * 5 ;
fprintf ( fp , " #%d;2;%u;%u;%u " , i , rgb [ 0 ] , rgb [ 1 ] , rgb [ 2 ] ) ;
fprintf ( fp , " #%d;2;%u;%u;%u " , i , rgb [ 0 ] , rgb [ 1 ] , rgb [ 2 ] ) ;
@ -212,7 +216,7 @@ write_sixel_data(FILE* fp, int lenx, sixeltable* stab){
// are programmed as a set of registers, which are then referenced by the
// are programmed as a set of registers, which are then referenced by the
// stacks. There is also a RLE component, handled in rasterization.
// stacks. There is also a RLE component, handled in rasterization.
// A pixel block is indicated by setting cell_pixels_p().
// A pixel block is indicated by setting cell_pixels_p().
int sixel_blit_inner ( ncplane * nc , int placey , int placex , int len x,
int sixel_blit_inner ( ncplane * nc , int placey , int placex , int len y, int len x,
sixeltable * stab , unsigned cellpixx ) {
sixeltable * stab , unsigned cellpixx ) {
char * buf = NULL ;
char * buf = NULL ;
size_t size = 0 ;
size_t size = 0 ;
@ -220,7 +224,7 @@ int sixel_blit_inner(ncplane* nc, int placey, int placex, int lenx,
if ( fp = = NULL ) {
if ( fp = = NULL ) {
return - 1 ;
return - 1 ;
}
}
if ( write_sixel_data ( fp , len x, stab ) ) {
if ( write_sixel_data ( fp , len y, len x, stab ) ) {
fclose ( fp ) ;
fclose ( fp ) ;
free ( buf ) ;
free ( buf ) ;
return - 1 ;
return - 1 ;
@ -257,7 +261,7 @@ int sixel_blit(ncplane* nc, int placey, int placex, int linesize,
free ( stable . data ) ;
free ( stable . data ) ;
return - 1 ;
return - 1 ;
}
}
int r = sixel_blit_inner ( nc , placey , placex , len x, & stable , cellpixx ) ;
int r = sixel_blit_inner ( nc , placey , placex , len y, len x, & stable , cellpixx ) ;
free ( stable . data ) ;
free ( stable . data ) ;
free ( ctab ) ;
free ( ctab ) ;
return r ;
return r ;