private Color mandlebrotColor(int x, int y)
        {
            final double cA = left + x * horizontalIncrement; //real component of c
            final double cB = top + y * verticalIncrement;    //imaginary component of c

            double zA = cA; //real component of z
            double zB = cB; //imaginary component of z
            for(int i = 0; i < itr; i++)
            {
                double zATemp = (zA * zA - zB * zB) + cA; //z = z^2 + c
                zB = (2 * zA * zB) + cB;
                zA = zATemp;
                if(zA * zA + zB * zB > 4.0)//if escaped
                {
//                    return new Color(4004*i); //bands of color

                    //smooth coloring
                    //these two more iterations reduce the size
                    //of the error term
                    zATemp = (zA * zA - zB * zB) + cA; //z = z^2 + c
                    zB = (2 * zA * zB) + cB;
                    zA = zATemp;
                    zATemp = (zA * zA - zB * zB) + cA; //z = z^2 + c
                    zB = (2 * zA * zB) + cB;
                    zA = zATemp;

                    double magnitude = Math.sqrt(zA * zA + zB * zB);
                    float fraction = (float) (i
                        - (Math.log10(Math.log10(magnitude))) / Math.log10(2.0))
                        / itr;

                    return Color.getHSBColor(.6f + 10f * fraction, .6f, 1);
                }
            }
            return Color.black; //if not escaped
        }