Hi,
the follow Sub capture panel to image in B4A
What is the appropriate procedure in B4i? Thank for your helps!!!!
the follow Sub capture panel to image in B4A
B4X:
'Capture Panel to imageview
Sub PanelCapture(pnl AsPanel, Img2 AsImageView)
Dim Obj1, Obj2 AsReflector
Dim bmp AsBitmap
Dim c AsCanvas
Obj1.Target = Obj1.GetActivityBA
Obj1.Target = Obj1.GetField("vg")
bmp.InitializeMutable(pnl.left + pnl.Width, pnl.Top + pnl.Height)
c.Initialize2(bmp)
Dim args(1) As Object
Dim types(1) AsString
Obj2.Target = c
Obj2.Target = Obj2.GetField("canvas")
args(0) = Obj2.Target
types(0) = "android.graphics.Canvas"
Obj1.RunMethod4("draw", args, types)'draw from image to canavas
Dim canvas1 As Canvas
canvas1.Initialize(Img2)
Dim scrt As Rect
scrt.Initialize(pnl.left, pnl.top, pnl.left + pnl.Width, pnl.Top + pnl.Height)
Dim rectPanel1 As Rect
rectPanel1.Initialize(0, 0,Img2.Width, Img2.Height)
canvas1.DrawBitmap(bmp, scrt , rectPanel1)
Img2.Invalidate
End Sub
What is the appropriate procedure in B4i? Thank for your helps!!!!