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

112 Views Asked by At

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?

1

There are 1 best solutions below

0
On

I found a class named cGDIPlusCache and I used is as below to 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