Dim lorenilla As Bitmap = LoadBitmap(File.DirAssets,"lorenilla.jpg")
Dim freddie As Bitmap = LoadBitmapResize(File.DirAssets,"freddie.png",150,150,True)
' COLOCAR UNA IMAGEN SOBRE OTRA UTILIZANDO UN CANVAS
Dim imageview As ImageView
imageview.Initialize("iv")
Activity.AddView(imageview,0%x,-10%y,DipToCurrent(lorenilla.Width),DipToCurrent( lorenilla.Height))
imageview.Bitmap = lorenilla
imageview.Gravity = Gravity.CENTER
Dim canvas As Canvas
canvas.Initialize(imageview)
Dim destination As Rect
destination.Initialize(40,350,40+150,350+150) ' para que freddie aparezca en la ventana
canvas.DrawBitmap(freddie, Null, destination)
' save canvas.bitmap
saveCanvas( canvas.Bitmap, "lorenilla1.jpg")
' AHORA CON 2 IMAGENES SOBRE UN SOLO IMAGEVIEW
Dim panel As Panel
panel.Initialize("pnl")
Activity.AddView(panel,0%x,50%y,100%x,50%y)
panel.Color = Colors.Yellow
Dim imageview2 As ImageView
imageview2.Initialize("iv")
panel.AddView(imageview2,0%x,0%y,DipToCurrent(lorenilla.Width),DipToCurrent( lorenilla.Height))
imageview2.Bitmap = lorenilla
imageview2.Gravity = Gravity.CENTER
Dim imageview3 As ImageView
imageview3.Initialize("iv")
panel.AddView(imageview3,30,225,30+150,225+150)
imageview3.Bitmap = freddie
imageview3.Gravity = Gravity.CENTER
Dim v As B4XView = panel
Dim bmp As Bitmap = v.Snapshot
saveCanvas(bmp, "lorenilla2.jpg")
End Sub
Sub saveCanvas( bmp As Bitmap, fname As String )
Dim rp As RuntimePermissions
Dim Out As OutputStream = File.OpenOutput(rp.GetSafeDirDefaultExternal(""),fname, False)
bmp.WriteToStream(Out, 100, "JPEG")
Out.Close
End Sub