Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Dim xx, yy, mycoloer As Long
private sub command1_click()
for xx = 0 to pic1.width
for yy = 0 to pic1.height
mycolor1 = getpixel(pic1.hdc,xx,yy)
mycolor2 = getpixel(pic1.hdc,xx,yy + 2)
if mycolor1 <> mycolor2 then'如果两个颜色值不相等,就作图到pic2
setpixel pic2.hdc,xx,yy,RGB(0,0,0)
end if
next
next
end sub
要是图片的颜色不统一,就麻烦了,得提取RGB中的各个分值进行对比:
R1 = mycolor1 Mod 65536 Mod 256 '提取红色占去的值
G1 = mycolor1 mod 65536 / 256
B1 = mycolor1 / 65536
R2 = mycolor2 Mod 65536 Mod 256
G2...B2...(类同于上)
然后进行详细的对比,就这么简单,别忘了给我加分哦!!