This basic code works until I try to add gradientColors
:
let noise = GKNoise(src)
noise.gradientColors = [ 0.0: NSColor.blue, 0.5: NSColor.green, 0.75: NSColor.white]
let map = GKNoiseMap(noise,
size: vector_double2(x: inParams.noiseSize, y: inParams.noiseSize),
origin: vector_double2(x:0, y:0),
sampleCount: vector_int2(x: Int32(inParams.size), y:Int32(inParams.size)),
seamless: true)
let tex = SKTexture(noiseMap: map)
At which point I get the following in the Xcode console, upon creating the SKTexture
:
*** -getRed:green:blue:alpha: not valid for the NSColor Generic Gray Gamma 2.2 Profile colorspace 1 1; need to first convert colorspace.
Other people seem to be able to do this, so I’m not sure what I’m doing differently. I can’t figure out where I might set the color space.
macOS 11.3, Xcode 12.5, SwiftUI app.