保存图象:PictureBox.SavePicture FileName 图像透明合并的方法:(PictureBox1,PictureBox2,Command1) ============================================================Private Const SRCCOPY = &HCC0020 Private Const SRCINVERT = &H660046 Private Const SRCAND = &H8800C6Private Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long Private Declare Function GetBkColor Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function GetTextColor Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Function TransBitBlt(ByVal hDCD As Long, ByVal x As Long, ByVal y As Long, ByVal DX As Long, ByVal DY As Long, ByVal hDCS As Long, ByVal X0 As Long, ByVal Y0 As Long, ByVal TransColor As Long) As Boolean Dim RGBBK As Long Dim RetL As Long Dim RetI As Long Dim RGBBKS As Long Dim RGBFG As Long Dim HbmMask As Long Dim HbmT As Long Dim hDCMask As Long
TransBitBlt = True End Function Private Sub Command1_Click() TransBitBlt Picture2.hdc, 0, 0, 50, 50, Picture1.hdc, 0, 0, RGB(192, 192, 192) Picture2.Refresh End Sub
http://www.applevb.com/sourcecode/smooth%20animation.zip非常Cool的图像处理程序,包含:图像的柔化、锐化。图像的半透明叠加。动态实现精灵(就是小的图片在大图片上翻转):
http://www.applevb.com/sourcecode/adv%20graphics.zip
图像透明合并的方法:(PictureBox1,PictureBox2,Command1)
============================================================Private Const SRCCOPY = &HCC0020
Private Const SRCINVERT = &H660046
Private Const SRCAND = &H8800C6Private Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Private Declare Function GetBkColor Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetTextColor Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Function TransBitBlt(ByVal hDCD As Long, ByVal x As Long, ByVal y As Long, ByVal DX As Long, ByVal DY As Long, ByVal hDCS As Long, ByVal X0 As Long, ByVal Y0 As Long, ByVal TransColor As Long) As Boolean
Dim RGBBK As Long
Dim RetL As Long
Dim RetI As Long
Dim RGBBKS As Long
Dim RGBFG As Long
Dim HbmMask As Long
Dim HbmT As Long
Dim hDCMask As Long
RetL = SetBkColor(hDCD, TransColor)
RGBBK = GetBkColor(hDCD)
RGBFG = GetTextColor(hDCD)
RGBBKS = GetBkColor(hDCS)
RetL = SetTextColor(hDCD, RGB(0, 0, 0))
hDCMask = CreateCompatibleDC(hDCS)
If IsNull(hDCMask) Then
Exit Function
End If
HbmMask = CreateBitmap(DX, DY, 1, 1, ByVal 0&)
If IsNull(HbmMask) Then
RetI = DeleteDC(hDCMask)
Exit Function
End If
HbmT = SelectObject(hDCMask, HbmMask)
RetL = SetBkColor(hDCS, RGBBK)
RetI = BitBlt(hDCMask, 0, 0, DX, DY, hDCS, X0, Y0, SRCCOPY)
RetL = SetBkColor(hDCD, RGB(255, 255, 255))
RetI = BitBlt(hDCD, x, y, DX, DY, hDCS, X0, Y0, SRCINVERT)
RetI = BitBlt(hDCD, x, y, DX, DY, hDCMask, 0, 0, SRCAND)
RetI = BitBlt(hDCD, x, y, DX, DY, hDCS, X0, Y0, SRCINVERT)
RetI = SelectObject(hDCMask, HbmT)
RetI = DeleteObject(HbmMask)
RetI = DeleteDC(hDCMask)
RetL = SetBkColor(hDCD, RGBBK)
RetL = SetTextColor(hDCD, RGBFG)
RetL = SetBkColor(hDCS, RGBBKS)
TransBitBlt = True
End Function
Private Sub Command1_Click()
TransBitBlt Picture2.hdc, 0, 0, 50, 50, Picture1.hdc, 0, 0, RGB(192, 192, 192)
Picture2.Refresh
End Sub
纯用VB写的图像处理程序,速度很快下载:
http://zyl910vb.51.net/vb/map/ZDIBop.htm
用FlashGet或IE自身的下载功能(右键,目标另存为)
下载后注意把*.rar.jpg改名成*.rar如果还是不能下载的话
用这个地址:http://nomey.myetang.com/zdibop.rar
-----------------------------------------------------------------------------
http://expert.csdn.net/Expert/topic/1104/1104910.xml?temp=.6940882
图像淡入淡出演示程序,能达到与系统API函数统级别的速度下载:
http://www.dapha.net/vb/list.asp?id=1925
就参考junwhj(junwhj.myrice.com)的注意:
PictureBox的AutoReDraw设为True
保存图片:SavePicture Picture1.Image, 文件名