Skip to content

Instantly share code, notes, and snippets.

@7m4mon
Last active December 3, 2016 07:10
Show Gist options
  • Save 7m4mon/4acfc3bb883c8681577276a617016827 to your computer and use it in GitHub Desktop.
Save 7m4mon/4acfc3bb883c8681577276a617016827 to your computer and use it in GitHub Desktop.
Function IndexOfColorArray(colorArray As Color(), pixelColor As Color) As Integer
Dim colorIndex As Integer = -1
For i = 0 To colorArray.Length - 1
If pixelColor.R = colorArray(i).R And
pixelColor.G = colorArray(i).G And
pixelColor.B = colorArray(i).B And
pixelColor.A = colorArray(i).A Then
colorIndex = i
Exit For
End If
Next
Return colorIndex
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment