很簡單,使用GDI的AlphaBlend函式就可以。可以設定全域性Alpha混合係數(0到255),也可以混合帶有Alpha通道的32位BMP。
如果要做稍複雜的處理,可以使用GDI+,裡面的所有繪圖手段都支援Alpha通道。
附AlphaBlend函式在VB中的宣告:
Public Type t_BLENDFUNCTION
BlendOp As Byte
BlendFlags As Byte
SourceConstantAlpha As Byte
AlphaFormat As Byte
End Type
Public Declare Function AlphaBlend Lib "msimg32" (ByVal hDestDC As Long, _
ByVal xDest As Long, _
ByVal yDest As Long, _
ByVal nWidthDest As Long, _
ByVal nHeightDest As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal nWidthSrc As Long, _
ByVal nHeightSRC As Long, _
ByVal BLENDFUNCTION As Long) As Long
很簡單,使用GDI的AlphaBlend函式就可以。可以設定全域性Alpha混合係數(0到255),也可以混合帶有Alpha通道的32位BMP。
如果要做稍複雜的處理,可以使用GDI+,裡面的所有繪圖手段都支援Alpha通道。
附AlphaBlend函式在VB中的宣告:
Public Type t_BLENDFUNCTION
BlendOp As Byte
BlendFlags As Byte
SourceConstantAlpha As Byte
AlphaFormat As Byte
End Type
Public Declare Function AlphaBlend Lib "msimg32" (ByVal hDestDC As Long, _
ByVal xDest As Long, _
ByVal yDest As Long, _
ByVal nWidthDest As Long, _
ByVal nHeightDest As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal nWidthSrc As Long, _
ByVal nHeightSRC As Long, _
ByVal BLENDFUNCTION As Long) As Long