ho provato ma senza successo, la foto viene creata ma non contiene nulla
il pannello della fotocamera si chiama panel1 cosi dichiarato
B4X:
Private Panel1 As Panel
la label sopra il panel1 si chiama LblProva cosi dichiarata
B4X:
Dim LblProva As Label
su click del pulsante BtnSnapshot eseguo
B4X:
Private Sub BtnSnapshot_Click
Dim bmp As B4XBitmap = Crop_Image(Panel1, Panel1.left, Panel1.top, Panel1.width, Panel1.height )
Dim bmp As B4XBitmap = Crop_Image(Panel1, 0, 0, Panel1.width, Panel1.height )
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal & "/foto", "1.png", False)
bmp.WriteToStream(out, 100, "PNG")
out.Close
End Sub
B4X:
Sub Crop_Image(V As B4XView, left As Int, top As Int, width As Int, height As Int) As Bitmap
Return V.Snapshot.Crop(left, top, width, height)
End Sub
Nell'immagine, il Parent di Label1 è Panel1, ovvero Label1 è contenuta in Panel1. Se fosse Activity, magari vedresti (sempre nel Designer) Label1 sopra Panel1 ma non sarebbe contenuto in esso.
Non penso che il messaggio d'errore si riferisca a quella riga, l'inizializzazione della camera. Comunque, verifica di aver dichiarato Panel1 proprio come Panel.
Nell'immagine, il Parent di Label1 è Panel1, ovvero Label1 è contenuta in Panel1. Se fosse Activity, magari vedresti (sempre nel Designer) Label1 sopra Panel1 ma non sarebbe contenuto in esso.
L'errore non può essere là, visto che il messaggio si riferisce a una TextView (il che non significa necessariamente una EditText ma di certo non un Panel).
In the code in post #4, see the comments in second line
B4X:
Private Sub BtnSnapshot_Click
Dim bmp As B4XBitmap = Crop_Image(Panel1, Panel1.left, Panel1.top, Panel1.width, Panel1.height )
Dim bmp As B4XBitmap = Crop_Image(Panel1, 0, 0, Panel1.width, Panel1.height ) '<--- again bmp? Shouldn't be bmp2? And Panel1, I think it should be Label1
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal & "/foto", "1.png", False)
bmp.WriteToStream(out, 100, "PNG")
out.Close
End Sub
You get a snapshot from the camera panel, another one of the label, then you create a new bmp with the two overlaid images.