Private Sub Command1_Click()
Dim r2, g2, b2 As Integer
Dim r1, g1, b1 As Integer
Dim c1 As Long
Dim c2 As Long
Dim x0 As Integer
Dim y0 As Integer
Screen.MousePointer = 11 'mouse呈沙漏形状
For x0 = 1 To Picture1.Width - 2
For y0 = 1 To Picture2.Height - 2
c1 = Picture1.Point(x0, y0)
r1 = (c1 And &HFF)
g1 = (c1 And 62580) / 256
b1 = (c1 And &HFF0000) / 65536
'获得Picture1中指定点(x0,y0)的R、G、B分量值
c2 = Picture1.Point(x0 + 1, y0 + 1)
r2 = (c2 And &HFF)
g2 = (c2 And 62580) / 256
b2 = (c2 And &HFF0000) / 65536
'获得Picture1中与(x0,y0)点相邻的点的R、G、B分量值
r1 = Abs(r1 - r2 + 128)
g1 = Abs(g1 - g2 + 128)
b1 = Abs(b1 - b2 + 128)
If r1 > 255 Then r1 = 255
If r1 < 0 Then r1 = 0
If b1 > 255 Then b1 = 255
If b1 < 0 Then b1 = 0
If g1 > 255 Then g1 = 255
If g1 < 0 Then g1 = 0
'计算浮雕处理后的R、G、B分量值
Picture2.PSet (x0, y0), RGB(r1, g1, b1)
'画出浮雕处理后的(x0,y0)
DoEvents
Next
Next
Screen.MousePointer = 0 '恢复mouse正常情况End Sub
Private Sub Form_Load()
Picture1.Picture = LoadPicture(App.Path + "/鸟.bmp")
End Sub
VB6浮雕效果源代码
原创
©著作权归作者所有:来自51CTO博客作者jwsoft007的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Vb6 Modbus TCP通讯示例源代码
MODBUS TCP读卡器介绍:https://item.taobao.com/item.htm?spm=a1z10.5-c.w4002-17663462238.13.2a205b43dVtabq
vb6 tcp通讯 vb6 Socket Modbus tcp vb6套接字编程 h5 -
VB6 转换 Unix 和 DOS 文本格式源代码
因为昨天用到这个功能,所以改写了下以前的一个函数,测试效果不错,
unix dos vb integer function -
vb6面向对象
对象可以看作是具有特殊属性和行为的一个可视化实体,每个对象都有自己的
数据 if语句 设计语言 -
vb6 Implements
Implements [InterfaceName | Class] 所需的 InterfaceName 或 Class 是类型库中的接口或类的名称,该类型库中的方法将用与 Visual Basic 类中
vb6 Implements Public Visual 类继承