concept/mproof: Fixed an old minor bug in the concept.
[neuro.git] / src / extlib / gen_alpha.tcl
blob51bd71d4fe31a4318d8b7e834e424c3bcc33b919
1 #!/bin/bash
3 # we start by the independant and invert alpha
4 # iR * (1 - (alpha / 255))
6 set Color 0
7 set Alpha 0
8 set answer 0
10 set fd [open "alpha.inc" "w"]
12 puts $fd ""
13 puts $fd "static double HCD_IAlpha\[255\]\[255\] = \{"
17 while {$Color < 255} {
18 set Alpha 0
20 while {$Alpha < 255} {
21 set answer [expr "[double $Color] * (1 - ([double $Alpha] / 255))"]
23 if {$Color == 254 && $Alpha == 254} {
24 puts $fd " $answer\}"
25 } else {
26 if {$Alpha == 0} {
27 puts -nonewline $fd " \{$answer,"
28 } else {
30 if {$Alpha == 254} {
31 puts $fd " $answer\},"
32 } else {
33 puts -nonewline $fd " $answer,"
38 incr Alpha
41 incr Color
44 puts $fd "\};"
47 # now we do the dependant normal alpha
48 # aR * (alpha / 255)
50 puts $fd ""
51 puts $fd ""
53 set Color 0
54 set Alpha 0
55 set answer 0
57 puts $fd "static double HCD_Alpha\[255\]\[255\] = \{"
60 while {$Color < 255} {
61 set Alpha 0
63 while {$Alpha < 255} {
64 set answer [expr "[double $Color] * ([double $Alpha] / 255)"]
66 if {$Color == 254 && $Alpha == 254} {
67 puts $fd " $answer\}"
68 } else {
69 if {$Alpha == 0} {
70 puts -nonewline $fd " \{$answer,"
71 } else {
73 if {$Alpha == 254} {
74 puts $fd " $answer\},"
75 } else {
76 puts -nonewline $fd " $answer,"
81 incr Alpha
84 incr Color
87 puts $fd "\};"
89 close $fd