I've got my RGB data of the CGImage. but the processing to get avrage color is so slow. any idea? apreciated.
let screenShot:CGImage = CGDisplayCreateImage(activeDisplays[Int(index)],rect: myrect)!
let dp: UnsafePointer<UInt8> = CFDataGetBytePtr(screenShot.dataProvider?.data)
var bsum:Int = 0
var rsum:Int = 0
var gsum:Int = 0
for j in 0..<(oneH*oneW){
rsum += Int(dp[j*4])
gsum += Int(dp[j*4+1])
bsum += Int(dp[j*4+2])
}
rsum/=onepack
gsum/=onepack
bsum/=onepack