What is the fastest way to create the mask of picture?

Here's the code I wrote:

Code:
Public Function Mask(Color As Long) As Boolean
    Dim i As Long
    Dim j As Long
    
    Mask=false

    If bValidSprite Then
        For i = 0 To lSpriteWidth - 1
            For j = 0 To lSpriteHeight - 1
                If GetPixel(DCSprite, i, j) = Color Then
                    Call SetPixel(DCMask, i, j, vbWhite)
                Else
                    Call SetPixel(DCMask, i, j, vbBlack)
                End If
            Next j
        Next i
        bValidMask = True
        Mask=true

    End If

End Function

Thanks Xmas.