指定透明色用bitblt来copy然后savepicture

解决方案 »

  1.   

    看一看bitblt这个函数的最后一个参数,可以有多种合并方式,好好看一看!合并后将其保存为图片.
      

  2.   

     平均混合两张图片
    http://210.75.132.33/lakes/detail.asp?id=261(要保存用图片框的SavePicture方法就可以了。)  用PSet和Point方法平均混合两张图片,速度比较慢,主要用来学习象素点混合的概念。 With this little program you can combine two images using no API calls. This is not a great code, but, I only want to show how to use the pset and point functions of a picture box. Good look. Any comments at: "[email protected]." Also, visit my homepage "http://www.cyberlatino.com.mx"CODE:Private Sub Command1_Click()
      Picture3.Cls
      Picture3.Height = Picture1.Height
      Picture3.Width = Picture1.Width
      Dim X As Long
      Dim Y As Long
      
      For X = 0 To Picture1.ScaleWidth
        DoEvents
        For Y = 0 To Picture1.ScaleHeight
          Picture3.PSet (X, Y), COMBINAR(Picture1.Point(X, Y), Picture2.Point(X, Y))
        Next Y
      Next XEnd SubPrivate Function COMBINAR(COLOR1 As Long, COLOR2 As Long) As Long
      Dim R1 As Integer, G1 As Integer, B1 As Integer, R2 As Integer, G2 As Integer, B2 As Integer
      GetRgb COLOR1, R1, G1, B1
      GetRgb COLOR2, R2, G2, B2
      COMBINAR = RGB((R1 + R2) / 2, (G2 + G1) / 2, (B2 + B1) / 2)
    End FunctionPrivate Sub GetRgb(ByVal color As Long, ByRef red As Integer, ByRef green As Integer, ByRef blue As Integer)
      Dim Temp As Long
      
      Temp = (color And 255)
      red = Temp And 255
      
      Temp = Int(color / 256)
      green = Temp And 255
      
      Temp = Int(color / 65536)
      blue = Temp And 255
        
    End Sub