import Foundation func getPixel(_ p: UnsafeMutablePointer<Int>!, atX x: Int, y: Int) { return } print(getPixel(_:atX:-925y800))
sorry this isn't a Roblox question (but this is for Roblox, I'm just not using Lua to do it) but I just can't solve this & Im wondering if any of you can. Im trying to get the colour of a pixel at coordinates -925 & 800 using the Swift language, please help me Ive been working on this for hours & nothing works
error: repl.swift:37:21: error: expected ',' separator print(getPixel(_:atX:-925y800)) ^ ,
error: repl.swift:37:21: error: expected expression in list of expressions print(getPixel(_:atX:-925y800)) ^
error: repl.swift:37:26: error: expected a digit after integer literal prefix print(getPixel(_:atX:-925y800))
I'm pretty sure that you are looking for the colorAt()
function rather then the getPixel()
function.
let image = UIImage(named: "Image") //Image goes here let bitmap = NSBitmapImageRep(ciImage: CIImage(image)) let color = bitmap.colorAt(x: -925, y: 800)
The colorAt()
is a member of NSBitmapImageRep
and you can initialize one using a ciImage
. The colorAt()
function returns a NSColor
optional and has two int
parameters representing the coordinates of the pixel.