private float MaskGamma() { int count = 0; float total = 0; for (int c = 0; c < 3; c++) { if (mask [c]) { total += Levels.GetGamma (c); count++; } } if (count > 0) { return total / count; } else { return 1; } }