master ohmu/fastfetch-openbsd / src / 3rdparty / sixel / output.h
ohmu  ·  2026-10-15
 1/*
 2 * Copyright (c) 2014-2016 Hayaki Saito
 3 *
 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 5 * this software and associated documentation files (the "Software"), to deal in
 6 * the Software without restriction, including without limitation the rights to
 7 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 8 * the Software, and to permit persons to whom the Software is furnished to do so,
 9 * subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 */
21
22#ifndef LIBSIXEL_OUTPUT_H
23#define LIBSIXEL_OUTPUT_H
24
25typedef struct sixel_node {
26    struct sixel_node *next;
27    int pal;
28    int sx;
29    int mx;
30    char *map;
31} sixel_node_t;
32
33struct sixel_output {
34
35    int ref;
36    sixel_allocator_t *allocator;
37
38    /* compatiblity flags */
39
40    /* 0: 7bit terminal,
41     * 1: 8bit terminal */
42    unsigned char has_8bit_control;
43
44    /* 0: the terminal has sixel scrolling
45     * 1: the terminal does not have sixel scrolling */
46    unsigned char has_sixel_scrolling;
47
48    /* 1: the argument of repeat introducer(DECGRI) is not limitted
49       0: the argument of repeat introducer(DECGRI) is limitted 255 */
50    unsigned char has_gri_arg_limit;
51
52    /* 0: DECSDM set (CSI ? 80 h) enables sixel scrolling
53       1: DECSDM set (CSI ? 80 h) disables sixel scrolling */
54    unsigned char has_sdm_glitch;
55
56    /* 0: do not skip DCS envelope
57     * 1: skip DCS envelope */
58    unsigned char skip_dcs_envelope;
59
60    /* PALETTETYPE_AUTO: select palette type automatically
61     * PALETTETYPE_HLS : HLS color space
62     * PALETTETYPE_RGB : RGB color space */
63    unsigned char palette_type;
64
65    sixel_write_function fn_write;
66
67    int save_pixel;
68    int save_count;
69    int active_palette;
70
71    sixel_node_t *node_top;
72    sixel_node_t *node_free;
73
74    int penetrate_multiplexer;
75    int encode_policy;
76
77    void *priv;
78    int pos;
79    unsigned char buffer[1];
80};
81
82#endif /* LIBSIXEL_OUTPUT_H */
83
84/* emacs Local Variables:      */
85/* emacs mode: c               */
86/* emacs tab-width: 4          */
87/* emacs indent-tabs-mode: nil */
88/* emacs c-basic-offset: 4     */
89/* emacs End:                  */
90/* vim: set expandtab ts=4 sts=4 sw=4 : */
91/* EOF */