Public Sub Pencil(Optional ByVal Sensitivity As Long = 25) Dim I As Long Dim L As Long Dim M As Long Dim N As Long Dim Col As Long Dim ColNext As Long 'On Error GoTo ErrLine If Not CanPut Then Exit Sub Done = False TimeFilter = timeGetTime For I = 0 To OutPutWid - 1 M = I + 1 For L = 0 To OutPutHei - 1 N = L + 1 Col = ColOut(0, I, L) * 3 + ColOut(1, I, L) * 6 + ColOut(2, I, L) Col = Col \ 10 '当前点的灰度哦。 ColNext = ColOut(0, M, N) * 3 + ColOut(1, M, N) * 6 + ColOut(2, M, N) ColNext = -ColNext / 10 '下一点的灰度哦。 If Col + ColNext > Sensitivity Then '判断灰度变化是否超过设定的阀值 ColOut(0, I, L) = 0 'RGB(0,0,0)表示黑色 ColOut(1, I, L) = 0 ColOut(2, I, L) = 0 Else ColOut(0, I, L) = 255 'RGB(255,255,255)表示白色 ColOut(1, I, L) = 255 ColOut(2, I, L) = 255 End If Next Next Done = True TimeFilter = timeGetTime - TimeFilter Exit Sub ErrLine: MsgBox Err.Description End Sub |