反SPAM新思路—换Z-BLOG的验证码!(6)
End If
' 随机生成杂点
If Rnd * 99 + 1 < cOdds Then flag = 1 - flag
Response.BinaryWrite vColorData(1-flag)
Next
Next
For ii = 0 To ImgYuWidth-1
Response.BinaryWrite vColorData(1)
Next
Next
End Sub
Rem 获取单元的点(考虑位移)
Function getUnitDot(ByRef posAry,ByRef vCode,i,ByVal x,ByVal y,UnitWidth,UnitHeight)
getUnitDot = "1"
If i < 0 Or i > UBound(vCode) Then Exit Function
x = x - posAry(0,i)
If x < 0 Or x >= UnitWidth Then Exit Function
y = y - posAry(1,i)
If y < 0 Or y >= UnitHeight Then Exit Function
getUnitDot = Mid(vCode(i),y*UnitWidth+x+1,1)
End Function
Rem 生成干扰线
Sub makeNoise(ByRef nl,imgW,UnitHeight)
Dim i,l,x1,y1,x2,y2,dx,dy,deltaT
x1 = Int(Rnd*imgW)
y1 = Int(Rnd*UnitHeight)
x2 = Int(Rnd*imgW)
y2 = Int(Rnd*UnitHeight)
dx = X2 - X1
dy = Y2 - Y1
If Abs(dx) > Abs(dy) Then deltaT = Abs(dx) Else deltaT = Abs(dy)
If deltaT = 0 Then Exit Sub
l = UBound(nl,2)
ReDim Preserve nl(1,l+deltaT+1)
l = l + 1
For i = 0 To deltaT
nl(0,l+i) = x1 + dx * i \ deltaT
nl(1,l+i) = y1 + dy * i \ deltaT
内容版权声明:除非注明,否则皆为本站原创文章。