Sub Globals
'These global variables will be redeclared each time the activity is created.
Dim myimage As Bitmap
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
myimage.Initialize(File.DirAssets ,"english_n_819575.png")
slice_image(16 ,200,200)
For Each v As View In Activity.GetAllViewsRecursive
If (v Is ImageView) Then
Dim i As ImageView = v
i.Bitmap = LoadBitmap(File.DirInternal ,v.Tag&".png")
End If
Next
End Sub
Sub slice_image(count As Int , width As Int , height As Int )
Dim name As Int=-1
Dim temp_bitmap As Bitmap
For iy = 0 To (count-1)/4
For ix = 0 To (count-1)/4
name=name+1
temp_bitmap=myimage.Crop(ix*width ,iy*height ,width ,height)
Dim Out As OutputStream
Out = File.OpenOutput(File.DirInternal, name&".png", False)
temp_bitmap.WriteToStream(Out, 100, "PNG")
Out.Close
Next
Next
End Sub