Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
Dim bmp As B4XBitmap = xui.LoadBitmap("C:\Users\H\Downloads\mapa.gif", "")
Split(bmp, 7, 14)
End Sub
Sub Split(bmp As B4XBitmap, Rows As Int, Columns As Int)
Dim RowHeight As Int = bmp.Height / Rows
Dim ColumnWidth As Int = bmp.Width / Columns
For r = 0 To Rows - 1
For c = 0 To Columns - 1
Dim b As B4XBitmap = bmp.Crop(ColumnWidth * c, bmp.Height - RowHeight * (r + 1), ColumnWidth, RowHeight)
Dim out As OutputStream = File.OpenOutput("C:\Users\H\Downloads", $"map_${c}x${r}.png"$, False) 'change folder
b.WriteToStream(out, 100, "PNG")
out.Close
Next
Next
End Sub