st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

sixel.h (1869B)


      1 #ifndef SIXEL_H
      2 #define SIXEL_H
      3 
      4 #define DECSIXEL_PARAMS_MAX 16
      5 #define DECSIXEL_PALETTE_MAX 1024
      6 #define DECSIXEL_PARAMVALUE_MAX 65535
      7 #define DECSIXEL_WIDTH_MAX 4096
      8 #define DECSIXEL_HEIGHT_MAX 4096
      9 
     10 typedef unsigned short sixel_color_no_t;
     11 typedef unsigned int sixel_color_t;
     12 
     13 typedef struct sixel_image_buffer {
     14 	sixel_color_no_t *data;
     15 	int width;
     16 	int height;
     17 	sixel_color_t palette[DECSIXEL_PALETTE_MAX];
     18 	sixel_color_no_t ncolors;
     19 	int palette_modified;
     20 	int use_private_register;
     21 } sixel_image_t;
     22 
     23 typedef enum parse_state {
     24 	PS_ESC        = 1,  /* ESC */
     25 	PS_DECSIXEL   = 2,  /* DECSIXEL body part ", $, -, ? ... ~ */
     26 	PS_DECGRA     = 3,  /* DECGRA Set Raster Attributes " Pan; Pad; Ph; Pv */
     27 	PS_DECGRI     = 4,  /* DECGRI Graphics Repeat Introducer ! Pn Ch */
     28 	PS_DECGCI     = 5,  /* DECGCI Graphics Color Introducer # Pc; Pu; Px; Py; Pz */
     29 	PS_ERROR      = 6,
     30 } parse_state_t;
     31 
     32 typedef struct parser_context {
     33 	parse_state_t state;
     34 	int pos_x;
     35 	int pos_y;
     36 	int max_x;
     37 	int max_y;
     38 	int attributed_pan;
     39 	int attributed_pad;
     40 	int attributed_ph;
     41 	int attributed_pv;
     42 	int transparent;
     43 	int repeat_count;
     44 	int color_index;
     45 	int bgindex;
     46 	int grid_width;
     47 	int grid_height;
     48 	int param;
     49 	int nparams;
     50 	int params[DECSIXEL_PARAMS_MAX];
     51 	sixel_image_t image;
     52 } sixel_state_t;
     53 
     54 void scroll_images(int n);
     55 void delete_image(ImageList *im);
     56 int sixel_parser_init(sixel_state_t *st, int transparent, sixel_color_t fgcolor, sixel_color_t bgcolor, unsigned char use_private_register, int cell_width, int cell_height);
     57 int sixel_parser_parse(sixel_state_t *st, const unsigned char *p, size_t len);
     58 int sixel_parser_set_default_color(sixel_state_t *st);
     59 int sixel_parser_finalize(sixel_state_t *st, ImageList **newimages, int cx, int cy, int cw, int ch);
     60 void sixel_parser_deinit(sixel_state_t *st);
     61 Pixmap sixel_create_clipmask(char *pixels, int width, int height);
     62 
     63 #endif