Made ternary map work again.

Fix ternary map.
Rather than byte, just use an int between 0 and 255. Or just keep the occupied and free colors and create them using Color.argb