hi
i would like to make a screenshot of a panel and put it to a imageview
i search a lot but could not find anything that does it
i could make a screen shot but its not capturing only the panel it capture also some of the activity
my panel is not in pos 0 its some where in the activity
this is how i tried
how can i capture only the panel and not from pos 0,0??
thenx
i would like to make a screenshot of a panel and put it to a imageview
i search a lot but could not find anything that does it
i could make a screen shot but its not capturing only the panel it capture also some of the activity
my panel is not in pos 0 its some where in the activity
this is how i tried
B4X:
Sub createsmallimage
screenshot
cardb.Visible = True
cardb2.Visible = False
cardb2.Bitmap = LoadBitmap(File.DirInternal, "small.png")
cardb2.Gravity = Gravity.FILL
End Sub
'screen shot
Sub screenshot
'if file exist the delet first
If File.Exists(File.DirInternal, "small.png") = True Then
File.Delete(File.DirInternal, "small.png")
End If
'test1
Dim jpegPath As Path
jpegPath.Initialize(Panel1.Left,Panel1.Top)
jpegPath.LineTo(Panel1.Left + Panel1.Width,Panel1.Top)
jpegPath.LineTo(Panel1.Left + Panel1.Width,Panel1.Top + Panel1.Height)
jpegPath.LineTo(Panel1.Left,Panel1.Top + Panel1.Height)
jpegPath.LineTo(Panel1.Left,Panel1.Top)
Dim Obj1, Obj2 As Reflector
Dim bmp As Bitmap
Dim c As Canvas
Obj1.Target = Obj1.GetActivityBA
Obj1.Target = Obj1.GetField("vg")
bmp.InitializeMutable(Panel1.Width, Panel1.Height)
c.Initialize2(bmp)
c.ClipPath(jpegPath)
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)
Dim Out As OutputStream
Out = File.OpenOutput(File.DirInternal, "small.png", False)
bmp.WriteToStream(Out, 100, "PNG")
Out.Close
End Sub
how can i capture only the panel and not from pos 0,0??
thenx