iOS Question B4i SignatureData

Ahmet KOÇ

Member
Licensed User
Hello there
With B4a I can run the following code.

SD.Panel.Invalidate (SD = SignatureData )

but I couldn't find out how to do it with the B4I.
Best regards.
 

Ahmet KOÇ

Member
Licensed User
'Class module


Sub Class_Globals
Private base As Panel
Private cvs As Canvas
Private px, py As Float
Private mColor, mWidth As Int
Private Const backgroundcolor As Int = Colors.Gray
End Sub

Public Sub Initialize (SignatureColor As Int, SignatureWidth As Int)
base.Initialize("base")
base.Color = backgroundcolor
mColor = SignatureColor
mWidth = SignatureWidth
End Sub

Public Sub AddToParent(Parent As Panel, x As Float, y As Float, width As Float, height As Float)
Parent.AddView(base, x, y, width, height)
cvs.Initialize(base)
End Sub

Public Sub Resize(width As Float, height As Float)
base.Width = width
base.Height = height
cvs.Initialize(base)
End Sub

Public Sub Clear
cvs.DrawColor(backgroundcolor)
cvs.Refresh
End Sub

Public Sub Save(Dir As String, Name As String)
Dim out As OutputStream = File.OpenOutput(Dir, Name, False)
cvs.CreateBitmap.WriteToStream(out, 100, "PNG")
out.Close
End Sub

Private Sub Base_Touch(Action As Int, X As Float, Y As Float)
If Action = base.ACTION_DOWN Then
px = X
py = Y
Else
cvs.DrawLine(px, py, X, Y, mColor, mWidth)
cvs.Refresh
px = X
py = Y
End If
End Sub
 
Upvote 0

Similar Threads

Top