Created
February 26, 2016 15:41
-
-
Save ateliercw/b7265bed9cfd118b6597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func differenceFrom(otherRGBA: UIImage.RGBA) -> Int { | |
let aDiff = Int(max(alpha, otherRGBA.alpha) - min(alpha, otherRGBA.alpha)) | |
let rDiff = Int(max(red, otherRGBA.red) - min(red, otherRGBA.red)) | |
let gDiff = Int(max(green, otherRGBA.green) - min(green, otherRGBA.green)) | |
let bDiff = Int(max(blue, otherRGBA.green) - min(blue, otherRGBA.blue)) | |
return aDiff + rDiff + gDiff + bDiff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment