[求助]这段代码是用rle算法压缩黑白图像的,求高手进来查看有什么问题???
Private Sub Command1_Click()Dim h, w As Integer
Dim x, y, bi, wi As Long
Dim cl, i As Long
Dim r, g, b As Integer
Dim fName, str As String
fName = App.Path & "\Compact.txt"
Open fName For Output As 1
h = Picture1.ScaleHeight
w = Picture1.ScaleWidth
For y = 0 To h - 1
For x = 0 To w - 1
cl = Picture1.Point(x, y)
If cl = 0 Then
If wi <> 0 Then
Print #1, wi; ";W"
wi = 0
bi = bi + 1
Else
bi = bi + 1
End If
Else
If bi <> 0 Then
Print #1, bi; ";B"
bi = 0
wi = wi + 1
Else
wi = wi + 1
End If
End If
Next x
Next y
If wi <> 0 Then
Print #1, wi; ";W"
w
End If
If bi <> 0 Then
Print #1, bi; ";B"
End If
Close #1
End Sub