YoungBuck
Feb 20th, 2001, 09:41 PM
OK here is a function I've written to create a mask of any image that is currently stored in a Device Context and it works wonderfully besides being slow as hell....
Public Sub MaskTo(ByVal phDC As Long, pTranspColor As Long)
Dim lX As Long, lY As Long
For lX = 0 To lngWdth
For lY = 0 To lngHgt
If GetPixel(lngDC, lX, lY) = pTranspColor Then
SetPixelV phDC, lX, lY, vbBlack
Else
SetPixelV phDC, lX, lY, vbWhite
End If
Next lY
Next lX
End Sub
What I'm wondering is if there is a better way of doing this as this method is slow and tedious, it seems I've seen this done a more efficient ways but I cannot seem to find the examples anywhere, so if anybody can get me on the right track it would be much appreciated. Thanks in advance!
Public Sub MaskTo(ByVal phDC As Long, pTranspColor As Long)
Dim lX As Long, lY As Long
For lX = 0 To lngWdth
For lY = 0 To lngHgt
If GetPixel(lngDC, lX, lY) = pTranspColor Then
SetPixelV phDC, lX, lY, vbBlack
Else
SetPixelV phDC, lX, lY, vbWhite
End If
Next lY
Next lX
End Sub
What I'm wondering is if there is a better way of doing this as this method is slow and tedious, it seems I've seen this done a more efficient ways but I cannot seem to find the examples anywhere, so if anybody can get me on the right track it would be much appreciated. Thanks in advance!