-
Notifications
You must be signed in to change notification settings - Fork 5
/
p2effect.sh
executable file
·79 lines (60 loc) · 2.1 KB
/
p2effect.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# What effect does setting P2 of the Sixel DCS to 0 (opaque) instead
# of 1 (bg color is transparent) have on graphics already on the screen?
# With RA (raster attributes) set, the answer is given in the manual:
# the width and height are used to clear a background rectangle.
# But what about sixel images which lack RA? How can it choose how
# much to overlay if there are no transparent pixels?
# Answer: it doesn't. On the VT340 using P2=0 clears the screen from
# the cursor to the bottom right corner, so there is no overlaying such images.
blue100=$'\eP9;1;0q#2!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100~-!100N\e\\'
# No Raster Attributes
opaqueredstripe20=$'\eP9;0;0q#1!20i-!20i-!20i-!20A\e\\'
transredstripe20=$'\eP9;1;0q#1!20i-!20i-!20i-!20A\e\\'
# Set RA to 60x60 even though the image is 20x20 to make effect clear.
opaqueredstripe20ra=$'\eP9;0;0q"1;1;60;60#1!20i-!20i-!20i-!20A\e\\'
transredstripe20ra=$'\eP9;1;0q"1;1;60;60#1!20i-!20i-!20i-!20A\e\\'
echo -n $'\e+>' # DEC Technical charset
uparrow=$'\e[B\eO|' # up arrow
box=$'\eP9;1;0q"1;1;10;20 #7~!8@~- #7~!8?~- #7~!8?~- #7B!8AB \e\\'
cursor=$box$uparrow$'\e[1D\e[1Bcursor'
clear
echo " A 20x20 blue, striped square overlayed on a 100x100 red square"
row=3
tput cup $row 0
COLUMNS=${COLUMNS:-80}
yes E | tr -d '\n' | dd status=none bs=$((9*$COLUMNS)) count=1
tput cup $row 0
echo $blue100
tput cup $((row+1)) 2
echo -n $transredstripe20ra
echo -n "$cursor"
tput cup $((row-1)) 0
echo -n P2=1 RA=60x60
tput cup $row 40
echo $blue100
tput cup $((row+1)) 42
echo -n $opaqueredstripe20ra
echo -n "$cursor"
tput cup $((row-1)) 40
echo -n P2=0 RA=60x60
######################################################################
row=14
tput cup $row 0
yes E | tr -d '\n' | dd status=none bs=$((9*COLUMNS)) count=1
tput cup $row 0
echo $blue100
tput cup $((row+1)) 2
echo -n $transredstripe20
echo -n "$cursor"
tput cup $((row-1)) 0
tput el
echo -n P2=1 no RA
tput cup $row 40
echo $blue100
tput cup $((row+1)) 42
echo -n $opaqueredstripe20
echo -n "$cursor"
tput cup $((row-1)) 40
echo -n P2=0 no RA
tput cup 24 0