Android Question Canvasview: how to save changes when size is more than100%

Vellad

Member
Licensed User
Longtime User
I am 60 years old retired person. I am interested to make apps for android. Somehow I made a few simple apps and now I stuck with an app intended to make simple instant drawings using Canvasview. I was not able to save the changes made on the Horse image. I can increase the Horse size from 0 to 200% by seekbar slide. But program crashes on pressing BtnAdd when horse is more than 100% size. How can I get help for this?

The code goes like this:

Sub Globals
Dim cv1 As CanvasView
Dim b As Bitmap
Dim skBar As SeekBar
Dim A As Int
Dim btnAdd,btnErase,btnDraw,btnUndo,btnRedo As Button
Dim spnrTools, spnrColor,pnrLineWidth As Spinner
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
If FirstTime And File.Exists(PadDir, "*.*") = False Then
File.MakeDir(File.DirRootExternal, "Draw4")
End If

spnrTools.Color= Colors.RGB(150,100,100)
spnrColor.Color= Colors.RGB(100,150,100)
spnrLineWidth.Color= Colors.RGB(100,100,150)
b.Initialize(File.DirAssets,"horse.png")
A = skBar.Value
'Initial value of A is set at 50
cv1.Width=98%x*A*0.02
cv1.Height=73%y*A*0.02
'To get picture size about 100% of available screen size
cv1.drawBitmap(b)
spnrTools.AddAll(Array As String("Tools PEN", "LINE", "RECTANGLE", "CIRCLE", "ELLIPSE"))
spnrColor.AddAll(Array As String("Color Red", "Yellow", "Green", "Blue", "Magenta", "Cyan", "Black"))
spnrLineWidth.AddAll(Array As Int( 1, 2, 3, 4, 5, 10, 15, 20, 25, 30, 35))
cv1.PaintStrokeColor = Colors.Red
End Sub

Sub skbar_ValueChanged(Value As Int, UserChanged As Boolean)
A = skBar.Value
'A varies from 0 to 100
cv1.Width=98%x*A*0.02
cv1.Height=73%y*A*0.02
cv1.drawBitmap(b)
End Sub

Sub BtnAdd_Click
b.Initialize3(cv1.Bitmap)
cv1.drawBitmap(b)
End Sub
 
Top