Exemplo n.º 1
0
        public static int GetColorIndex(Color color, Palette palette)
        {
            RomColor[] colors = new RomColor[Palette.ColorCount];

            for (int i = 0; i < colors.Length; i++)
            {
                colors[i] = palette[i];
            }

            return(Utilities.GetColorIndex(color, colors));
        }
Exemplo n.º 2
0
        public static int GetColorIndex(RomColor color, RomColor[] colors)
        {
            int colorIndex = -1;

            for (int i = 0; i < colors.Length; i++)
            {
                if (colors[i] == color)
                {
                    colorIndex = i;
                    break;
                }
            }

            if (colorIndex == -1)
            {
                colorIndex = Utilities.GetClosestColorIndex(color, colors);
            }

            return(colorIndex);
        }