Android Question Saving a bitmap larger than scree size in CanvasView

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 make the rectangles (say) on the Horse. It’s just like a drawing on a layer. Horse size will increase from 0 to 200% by seekbar slide. But program crashes on pressing BtnAdd every time when horse is more than 100% size. (This is required to draw an object on the horse with precision). 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 As Button
Dim btnUndo,btnRedo As Button
Dim spnrTools As Spinner
Dim spnrColor As Spinner
Dim spnrLineWidth 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
cv1.Width=98%x*A*0.02
cv1.Height=73%y*A*0.02
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
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
 

Vellad

Member
Licensed User
Longtime User
Canvasview with seekbar:
Sub Globals
Dim cv1 As CanvasView
Dim b As Bitmap
Dim skBar As SeekBar
Dim A As Int
Dim btnAdd,btnErase,btnDraw As Button
Dim btnUndo,btnRedo As Button
Dim spnrTools As Spinner
Dim spnrColor As Spinner
Dim spnrLineWidth 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
cv1.Width=98%x*A*0.02
cv1.Height=73%y*A*0.02
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
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
 
Upvote 0
Top