Hi guys
i made a little code with lot of help from LucaMs (Thanks LucaMs )
Subname: Panel Capture
Description: in this code you can capture a Panel with all his views to a imageview without saving the image and load again
Dependencies: Reflection Lib v2.40
Tags: Panel capture
i made a little code with lot of help from LucaMs (Thanks LucaMs )
Subname: Panel Capture
Description: in this code you can capture a Panel with all his views to a imageview without saving the image and load again
Dependencies: Reflection Lib v2.40
Tags: Panel capture
B4X:
Sub Button1_Click
'capture panel to imageview
PanelCapture(Panel1,cardb2)
End Sub
'Capture Panel to imageview
Sub PanelCapture(pnl As Panel, Img2 As ImageView)
Dim Obj1, Obj2 As Reflector
Dim bmp As Bitmap
Dim c As Canvas
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) As String
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
Last edited: