-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples
28 lines (25 loc) · 861 Bytes
/
examples
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
; hget http://9front.org/img/9bind.png | png -t9 > /tmp/bind
; hget http://9front.org/img/ninefront.bit > /tmp/nine
; pico
# read in images
!r /tmp/nine nine
!r /tmp/bind bind
# combine two images at an offset
bind + (y > 100 ? nine[x,y-100] : 0)
# extract red and alpha channels
z == 3 ? bind : z == 0 ? bind : 0
# halve color intensity
z < 3 ? bind/2 : Z
# set black pixels' alpha to 0
bind[x,y,0] + bind[x,y,1] + bind[x,y,2] == 0 && z == 3 ? 0 : bind
# set black pixels to cyan
bind[x,y,0] + bind[x,y,1] + bind[x,y,2] == 0 ? z == 0 ? 0 : z == 1 ? Z : z == 2 ? Z : bind : bind
# doug demo
; pico
!r /tmp/bind bind
# set default size to that of bind
!s 598 879
lerp = z != 3 ? (x < X/3 ? 0 : x > 2*X/3 ? 255 : (x-X/3)*Z/(X/3)) : Z
rbind = bind[X-x] # same as bind[X-x,y,z]
z != 3 ? (bind*lerp+rbind*(Z-lerp))/Z : Z
z != 3 ? (rbind*lerp+bind*(Z-lerp))/Z : Z