void () { mySat = new float[myWidth * myHeight]; myHues = new float[myWidth * myHeight]; myAlphas = new int[myWidth * myHeight]; float radius = getRadius(); // blend is used to create a linear alpha gradient of two extra pixels float blend = (radius + 2f) / radius - 1f; // Center of the color wheel circle int cx = myWidth / 2; int cy = myHeight / 2; for (int x = 0; x < myWidth; x++) { int kx = x - cx; // Kartesian coordinates of x int squarekx = kx * kx; // Square of kartesian x for (int y = 0; y < myHeight; y++) { int ky = cy - y; // Kartesian coordinates of y int index = x + y * myWidth; mySat[index] = (float)Math.sqrt(squarekx + ky * ky) / radius; if (mySat[index] <= 1f) { myAlphas[index] = 0xff000000; } else { myAlphas[index] = (int)((blend - Math.min(blend, mySat[index] - 1f)) * 255 / blend) << 24; mySat[index] = 1f; } if (myAlphas[index] != 0) { myHues[index] = (float)(Math.atan2(ky, kx) / Math.PI / 2d); } } } }