1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // Multi-Phasic Applications: SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
11 * Generates 4-bit alpha table.
15 public class AlphaTable
20 * @param __args Ignored.
23 public static void main(String
... __args
)
25 for (int ah
= 0x00; ah
< 0x100; ah
+= 0x10)
28 int dX
= ah
| (ah
>>> 4);
30 for (int bh
= 0x00; bh
< 0x100; bh
+= 0x10)
33 int sX
= bh
| (bh
>>> 4);
35 // Convert alpha to float
36 double dD
= (dX
/ 255.0);
37 double sD
= (sX
/ 255.0);
39 double mD
= sD
+ dD
- (sD
* dD
);
41 System
.out
.printf("");
43 int iD
= Math
.max(0, Math
.min(255,
44 (int)Math
.round(mD
* 255.0)));
46 System
.out
.printf("%02");
48 /*int da = ca = sa + da - sjme_fixed_mul(sa, da);*/