                 let smoothedDistanceToNextIteration = smoothedDistancesToNextIterationPerPixel[pixelY * imageWidth + pixelX]  // 0 .. <1.0
                 let posInGradient = colorOfPreviousIter + smoothedDistanceToNextIteration * (colorOfCurrentIter - colorOfPreviousIter)
 
-                let _ = colorFromGradient(gradient, posInGradient, &r, &g, &b)
+                (r, g, b) = colorFromGradient(gradient, posInGradient)
             }
 
             imageData[3 * (pixelY * imageWidth + pixelX) + 0] = UInt8(255.0 * r)


            histogram[iter] += 1
            iterationsPerPixel[pixelY * imageWidth + pixelX] = iter  // 1 .. max_iterations

        }
    }
}

        right = gradient.colors[i]

        if pos >= left.pos && pos <= right.pos {
            return colorFromGradientRange(left, right, pos)
        }

        left = right
    }

    return (0.0, 0.0, 0.0)
}

func mandelbrotCalc(_ imageWidth: Int, _ imageHeight: Int, _ maxIterations: Int, _ centerX: Double, _ centerY: Double, _ height: Double, _ histogram: inout [Int], _ iterationsPerPixel: inout [Int], _ smoothedDistancesToNextIterationPerPixel: inout [Double]) {
