Skip to content

Instantly share code, notes, and snippets.

@ateliercw
Created February 26, 2016 15:39
Show Gist options
  • Save ateliercw/bec18887475537963cbb to your computer and use it in GitHub Desktop.
Save ateliercw/bec18887475537963cbb to your computer and use it in GitHub Desktop.
func differenceFrom(otherRGBA: UIImage.RGBA) -> Int {
return Int(max(alpha, otherRGBA.alpha) - min(alpha, otherRGBA.alpha)) +
Int(max(red, otherRGBA.red) - min(red, otherRGBA.red)) +
Int(max(green, otherRGBA.green) - min(green, otherRGBA.green)) +
Int(max(blue, otherRGBA.green) - min(blue, otherRGBA.blue))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment