-
Notifications
You must be signed in to change notification settings - Fork 5
/
raster_dimensions.sh
executable file
·41 lines (32 loc) · 1.12 KB
/
raster_dimensions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Test of the effect of raster attribute dimensions on a Sixel image.
CSI=$'\e[' # Control Sequence Introducer
DCS=$'\eP' # Device Control String
ST=$'\e\\' # String Terminator
echo -n ${CSI}'!p'
echo -n ${CSI}'H'
echo -n ${CSI}'J'
echo -n ${CSI}'?7h'
yes E | tr -d '\n' | head -c 1920
set_cursor_pos() {
echo -n ${CSI}${1}';'${2}'H'
}
raster_test() {
local row=${1}
local col=${2}
local macro_param=${3}
local raster_attributes=${4}
local test_pattern=${5}
local suffix=${6}
set_cursor_pos ${row} ${col}
echo ${DCS}${macro_param}'q"'${raster_attributes}
echo ${test_pattern}
echo ${ST}${suffix}
}
raster_test 4 8 1 '2;1;120;120' '#1?----!48?!24~-!48?!24~'
raster_test 4 26 1 '2;1;60;120' '#1!12?!108~-!24?!96~-!36?!84~-!48?!72~-!60?!60~' '.'
raster_test 4 44 1 '2;1;120;60' '#1!12~-!24~-!36~-!48~-!60~-!60~-!60~-!60~-!60~-!60~'
raster_test 1 62 1 '2;1;60;120' '#1-----!12?!108~-!24?!96~-!36?!84~-!48?!72~-!60?!60~'
raster_test 16 7 2 '5;1;245;90' '#1!245~#0!35~-#1!30~-!30~-#0!30~'
raster_test 13 41 2 '5;1;;0' '#1?--!60?!280~-!60?!280~-!60?!280~-!60?!280~'
set_cursor_pos 11 1