public void Añadir(Color key, Color value)
        {
            int keyArgb = key.ToArgb();

            if (!diccionario.ContainsKey(keyArgb))
            {
                diccionario.Add(keyArgb, new List <byte[]>());
            }
            diccionario[keyArgb].Value.Add(Serializar.GetBytes(value.ToArgb()));
        }
        public Color?ObtenerPrimero(int key)
        {
            Color?value;

            if (diccionario.ContainsKey(key))
            {
                value = Color.FromArgb(Serializar.ToInt(diccionario[key].Value[0]));
            }
            else
            {
                value = new Color?();
            }
            return(value);
        }
        public Color?[] ObtenerTodos(Color key)
        {
            List <Color?> colores = new List <Color?>();
            int           keyArgb = key.ToArgb();
            List <byte[]> coloresList;

            if (diccionario.ContainsKey(keyArgb))
            {
                coloresList = diccionario.GetValue(keyArgb);
                for (int i = 0; i < coloresList.Count; i++)
                {
                    colores.Add(Color.FromArgb(Serializar.ToInt(coloresList[i])));
                }
            }
            return(colores.ToArray());
        }
        /*   public byte[] ObtenerPrimero(byte[] key)
         * {
         *     byte[] byteColor=null;
         *     Color? color=ObtenerPrimero(Color.FromArgb(Serializar.ToInt(key)));
         *     if (color != null)
         *         byteColor = Serializar.GetBytes(color.Value.ToArgb());
         *     return byteColor;
         * }*/
        public byte[] ObtenerPrimero(byte[] key)
        {
            int           keyArgb = Serializar.ToInt(key);
            List <byte[]> coloresList;

            byte[] color = null;
            if (diccionario.ContainsKey(keyArgb))
            {
                coloresList = diccionario.GetValue(keyArgb);
                if (coloresList != null && coloresList.Count > 0)
                {
                    color = coloresList[0];
                }
            }
            return(color);
        }
        public Point GetPoint(int colorInt)
        {
            const int ARGB = 4;

            int posicion;

            byte[] bytesColor;
            Point  location   = default(Point);
            bool   encontrado = false;

            if (pointLocatedByColorList.ContainsKey(colorInt))
            {
                location = pointLocatedByColorList[colorInt].Value;
            }
            else
            {
                bytesColor = Serializar.GetBytes(colorInt);
                for (int y = 0, yFin = Convert.ToInt32(imagen.Height), xFin = Convert.ToInt32(imagen.Width) * ARGB; y < yFin && !encontrado; y++)
                {
                    for (int x = 0; x < xFin && !encontrado; x += ARGB)
                    {
                        posicion   = x + (y * xFin);
                        encontrado = bytesImg[posicion] == bytesColor[0] && bytesImg[posicion + 1] == bytesColor[1] && bytesImg[posicion + 2] == bytesColor[2] && bytesImg[posicion + 3] == bytesColor[3];
                        if (encontrado)
                        {
                            location = new Point(x, y);
                        }
                    }
                }
                if (!encontrado)
                {
                    throw new ArgumentOutOfRangeException("El color no esta dentro de la imagen!");
                }
                else
                {
                    pointLocatedByColorList.Add(colorInt, location);
                    if (!colorLocatedByPointerList.ContainsKey(new PointZ(location.X, location.Y, 0)))
                    {
                        colorLocatedByPointerList.Add(new PointZ(location.X, location.Y, 0), System.Drawing.Color.FromArgb(colorInt));
                    }
                }
            }
            return(location);
        }