3 # we start by the independant and invert alpha
4 # iR * (1 - (alpha / 255))
10 set fd
[open
"alpha.inc" "w"]
13 puts
$fd "static double HCD_IAlpha\[255\]\[255\] = \{"
17 while {$Color < 255} {
20 while {$Alpha < 255} {
21 set answer
[expr "[double $Color] * (1 - ([double $Alpha] / 255))"]
23 if {$Color == 254 && $Alpha == 254} {
27 puts
-nonewline $fd " \{$answer,"
31 puts
$fd " $answer\},"
33 puts
-nonewline $fd " $answer,"
47 # now we do the dependant normal alpha
57 puts
$fd "static double HCD_Alpha\[255\]\[255\] = \{"
60 while {$Color < 255} {
63 while {$Alpha < 255} {
64 set answer
[expr "[double $Color] * ([double $Alpha] / 255)"]
66 if {$Color == 254 && $Alpha == 254} {
70 puts
-nonewline $fd " \{$answer,"
74 puts
$fd " $answer\},"
76 puts
-nonewline $fd " $answer,"