这是LED显示屏的处理图形的部分代码 Dim i, j As Integer
Dim d As Byte
Dim DataBuf(65536) As Byte
Dim ppoint As Long
Dim dot0 As Long
Dim pp As Byte
Dim rr, gg As Long
Dim W As Integer, h As Integer
W = 544: h = 48
' If Not SendHead(&H50, frm, True) Then
' Exit Function
' End If
TimeDelay (100)
' Me.Show
For i = 0 To h - 1
pp = 0
d = 1
For j = 0 To W - 1
ppoint = Picture1.point(j, i) '&hBBGGRR
ppoint = ppoint And &HFFFFFF
dot0 = ppoint Xor &HFFFFFF
Picture1.PSet (j, i), dot0
rr = ppoint And &HFF
gg = ppoint And &HFF00
If gg = 0 Then
pp = pp Xor d
End If
d = d * 2
If rr <= &H80 Then
pp = pp Xor d
End If If d < 128 Then
d = d * 2
Else
DataBuf((W * i) \ 4 + j \ 4) = pp
pp = 0
d = 1
End If
Next j
Next i
谁能解释下红字的部分,特别是rr <= &H80 这句为什么要判断这个条件
Dim d As Byte
Dim DataBuf(65536) As Byte
Dim ppoint As Long
Dim dot0 As Long
Dim pp As Byte
Dim rr, gg As Long
Dim W As Integer, h As Integer
W = 544: h = 48
' If Not SendHead(&H50, frm, True) Then
' Exit Function
' End If
TimeDelay (100)
' Me.Show
For i = 0 To h - 1
pp = 0
d = 1
For j = 0 To W - 1
ppoint = Picture1.point(j, i) '&hBBGGRR
ppoint = ppoint And &HFFFFFF
dot0 = ppoint Xor &HFFFFFF
Picture1.PSet (j, i), dot0
rr = ppoint And &HFF
gg = ppoint And &HFF00
If gg = 0 Then
pp = pp Xor d
End If
d = d * 2
If rr <= &H80 Then
pp = pp Xor d
End If If d < 128 Then
d = d * 2
Else
DataBuf((W * i) \ 4 + j \ 4) = pp
pp = 0
d = 1
End If
Next j
Next i
谁能解释下红字的部分,特别是rr <= &H80 这句为什么要判断这个条件
很显然,LED 对于三种颜色的色度值都只有 0 和 1。例如,对于红色,只存在有色和无色,或者说亮或者灭。但你的图上,每种颜色都有是 256 个色阶。他就以 128 为界,判定有无这种颜色。