Created
October 17, 2014 20:25
-
-
Save sweenzor/60f6e5b688446c136819 to your computer and use it in GitHub Desktop.
Kindle eink art example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
###################################### | |
## tangle - triangle fun for the K3 ## | |
## version 1.0 by geekmaster ## | |
##----------------------------------## | |
## WARNING: K3 eips '' very slow... ## | |
## so use eips only in OUTER loops! ## | |
###################################### | |
#================================= | |
# initvar - initialize global vars | |
#--------------------------------- | |
initvar() { | |
B=$(echo -e '\xff');B=$B$B$B$B$B;B=$B$B$B$B$B;B=$B$B$B$B;B=$B$B$B | |
DZ=/dev/zero DN=/dev/null DF=/dev/fb0 VX=300 | |
} | |
#======================== | |
# bangle - black triangle | |
# usage: bangle x y h | |
#------------------------ | |
bangle() { | |
local x=$1 y=$2 h=$3 | |
for i in $(seq 0 1 $h); do | |
echo -e $B|dd of=$DF bs=1 count=$i seek=$(((y+i)*VX-i/2+x)) 2>$DN | |
done; eips '' | |
} | |
#======================== | |
# wangle - white triangle | |
# usage: wangle x y h | |
#------------------------ | |
wangle() { | |
local x=$1 y=$2 h=$3 | |
for i in $(seq 0 1 $h); do | |
dd if=$DZ of=$DF bs=1 count=$i seek=$(((y+i)*VX-i/2+x)) 2>$DN | |
done; eips '' | |
} | |
#================================= | |
# tangle - triangle fun for the K3 | |
#--------------------------------- | |
tangle() { | |
bangle 150 250 284 | |
wangle 150 275 242 | |
bangle 150 300 100 | |
bangle 100 400 100 | |
bangle 200 400 100 | |
wangle 150 320 66 | |
wangle 100 420 66 | |
wangle 200 420 66 | |
bangle 150 400 50 | |
bangle 125 400 25 | |
bangle 175 400 25 | |
bangle 150 450 25 | |
wangle 150 416 25 | |
bangle 150 335 42 | |
bangle 100 435 42 | |
bangle 200 435 42 | |
eips 19 28 "Tangle 1.0" | |
eips 18 30 "by Geekmaster" | |
} | |
eips -c # clear screen | |
initvar # init vars | |
tangle # triangle fun for the K3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment