private int closestMultiColor(MultiColor mc)
    {
        if (mc.allTransparent())
            return 0;
        else
        {
            int best = -1;
            float bestd = Float.POSITIVE_INFINITY;
            for (int i = 0; i < multiPalette.length; i++)
            {
                if (multiPalette[i] == null)
                    continue;
                float d = mc.diff(multiPalette[i]);
                if (d < bestd || best == -1)
                {
                    best = i;
                    bestd = d;
                }
            }
            return (byte) best;
        }
    }