简体   繁体   中英

Possible to use WIA stamp for stamp 2 stream data in vb6 without use file address method?

I use this function for stamp two image and get result as new image file:

Public Sub CaptureFormAndSaveFile(ByVal masterimagefile As String, ByVal fileforappend As String, ByVal masterimagefileoutput As String, ByVal Left As Long, ByVal Top As Long)
On Error Resume Next

Dim Source As WIA.ImageFile
Set Source = New WIA.ImageFile
Source.LoadFile App.Path & "\" & fileforappend
  
Dim ImgF As WIA.ImageFile
Dim ImgP As WIA.ImageProcess
Set ImgF = New WIA.ImageFile
ImgF.LoadFile App.Path & "\" & masterimagefile
Set ImgP = New WIA.ImageProcess
With ImgP
    .Filters.Add .FilterInfos!Stamp.FilterID
    .Filters(1).Properties("ImageFile") = Source
    .Filters(1).Properties("Left") = Left
    .Filters(1).Properties("Top") = Top
    .Filters(1).Properties("FrameIndex") = 0
    Set ImgF = .Apply(ImgF)
End With
ImgF.SaveFile App.Path & "\" & masterimagefileoutput

Kill App.Path & "\" & masterimagefile
Kill App.Path & "\" & fileforappend

End Sub

but now i have a picturebox1.image and a png array stream like as b(), now how can stamp that image on b() and get result as new stream?

i found a class named "cGDIPlusCache" and i used like as below for resolve my question:

Dim myc As New cGDIPlusCache
myc.AddImage "captured", .mypic2.Image ' its a picturebox
myc.DrawImage LayeredCanvas_Form(ParentForm.mylayeredformid).hDC, "captured", ParentForm.capturearea.Left, ParentForm.capturearea.Top
myc.Remove "captured"
Set myc = Nothing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM