It wraps this Github project (requested by @MarcoRome). Posting the following:
1. B4A project
2. B4A library files - copy them to your additional library folder.
Once you have made your drawing you can click on "Copy" to copy it to an Imageview (from where you can do with it whatever you want) or click "Clear" to clear the drawing area and start drawing from scratch.
@MarcoRome, see what else you think should be added and if the project that I am wrapping will allow to add such features I will try and make them available to be used in B4A.
Sample Code:
FabricView
Author: Github: Antwan Gaggi, Wrapped by: Johan Schoeman
Version: 1
1. B4A project
2. B4A library files - copy them to your additional library folder.
Once you have made your drawing you can click on "Copy" to copy it to an Imageview (from where you can do with it whatever you want) or click "Clear" to clear the drawing area and start drawing from scratch.
@MarcoRome, see what else you think should be added and if the project that I am wrapping will allow to add such features I will try and make them available to be used in B4A.
Sample Code:
B4X:
#Region Project Attributes
#ApplicationLabel: FabricView
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private fv1 As FabricView
Private Button1 As Button
Private ImageView1 As ImageView
Private Button2 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
'fv1.BackgroundMode = fv1.BACKGROUND_STYLE_NOTEBOOK_PAPER
'fv1.BackgroundMode = fv1.BACKGROUND_STYLE_BLANK
fv1.BackgroundMode = fv1.BACKGROUND_STYLE_GRAPH_PAPER
fv1.DrawColor = Colors.Red
fv1.DrawBackgroundColor = Colors.LightGray
fv1.NoteBookLeftLineColor = Colors.Blue
fv1.NoteBookLeftLinePadding = 60
fv1.FabricLineColor = Colors.Yellow
ImageView1.Bitmap = Null
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
ImageView1.Bitmap = fv1.CanvasBitmap
End Sub
Sub Button2_Click
fv1.cleanPage
ImageView1.Bitmap = Null
End Sub
FabricView
Author: Github: Antwan Gaggi, Wrapped by: Johan Schoeman
Version: 1
- FabricView
Fields:- BACKGROUND_STYLE_BLANK As Int
- BACKGROUND_STYLE_GRAPH_PAPER As Int
- BACKGROUND_STYLE_NOTEBOOK_PAPER As Int
- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- cleanPage
Clean the canvas, remove everything drawn on the canvas.
- Background As Drawable
- BackgroundMode As Int [write only]
- CanvasBitmap As Object [read only]
- Color As Int [write only]
- DrawBackgroundColor As Int [write only]
- DrawColor As Int [write only]
- Enabled As Boolean
- FabricLineColor As Int [write only]
- Height As Int
- InteractionMode As Int [write only]
- Left As Int
- NoteBookLeftLineColor As Int [write only]
- NoteBookLeftLinePadding As Int [write only]
- Parent As Object [read only]
- Size As Float [write only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int