├── README.md
├── SharpDrawing.pcvd
├── iOS
├── Assets.xcassets
│ ├── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── packages.config
├── Entitlements.plist
├── Main.cs
├── AppDelegate.cs
├── LaunchScreen.storyboard
├── Controls
│ ├── SharpViewRenderer.cs
│ └── Native
│ │ └── UISharpView.cs
├── Info.plist
└── SharpPaintCode.iOS.csproj
├── Droid
├── Resources
│ ├── drawable
│ │ └── icon.png
│ ├── drawable-hdpi
│ │ └── icon.png
│ ├── drawable-xhdpi
│ │ └── icon.png
│ ├── drawable-xxhdpi
│ │ └── icon.png
│ ├── layout
│ │ ├── Toolbar.axml
│ │ └── Tabbar.axml
│ ├── Resource.designer.cs
│ ├── values
│ │ └── styles.xml
│ └── AboutResources.txt
├── Properties
│ ├── AndroidManifest.xml
│ └── AssemblyInfo.cs
├── Assets
│ └── AboutAssets.txt
├── MainActivity.cs
├── packages.config
├── Controls
│ ├── Native
│ │ ├── SharpView.cs
│ │ ├── SharpKit.java
│ │ └── SharpKit.cs
│ └── SharpViewRenderer.cs
└── SharpPaintCode.Droid.csproj
├── packages.config
├── App.xaml
├── .gitignore
├── SharpPaintCodePage.xaml
├── App.xaml.cs
├── Controls
└── SharpView.cs
├── SharpPaintCodePage.xaml.cs
├── Properties
└── AssemblyInfo.cs
├── SharpPaintCode.csproj
└── SharpPaintCode.sln
/README.md:
--------------------------------------------------------------------------------
1 | # sharp-paintcode
2 | A sample use of PaintCode3 with Xamarin.Forms' custom renderers
3 |
--------------------------------------------------------------------------------
/SharpDrawing.pcvd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thatcsharpguy/sharp-paintcode/master/SharpDrawing.pcvd
--------------------------------------------------------------------------------
/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Droid/Resources/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thatcsharpguy/sharp-paintcode/master/Droid/Resources/drawable/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thatcsharpguy/sharp-paintcode/master/Droid/Resources/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thatcsharpguy/sharp-paintcode/master/Droid/Resources/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/Droid/Resources/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thatcsharpguy/sharp-paintcode/master/Droid/Resources/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/iOS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/iOS/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Droid/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Droid/Resources/layout/Toolbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Droid/Resources/layout/Tabbar.axml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/iOS/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace SharpPaintCode.iOS
9 | {
10 | public class Application
11 | {
12 | // This is the main entry point of the application.
13 | static void Main(string[] args)
14 | {
15 | // if you want to use a different Application Delegate class from "AppDelegate"
16 | // you can specify it here.
17 | UIApplication.Main(args, null, "AppDelegate");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Autosave files
2 | *~
3 |
4 | # build
5 | [Oo]bj/
6 | [Bb]in/
7 | packages/
8 | TestResults/
9 |
10 | # globs
11 | Makefile.in
12 | *.DS_Store
13 | *.sln.cache
14 | *.suo
15 | *.cache
16 | *.pidb
17 | *.userprefs
18 | *.usertasks
19 | config.log
20 | config.make
21 | config.status
22 | aclocal.m4
23 | install-sh
24 | autom4te.cache/
25 | *.user
26 | *.tar.gz
27 | tarballs/
28 | test-results/
29 | Thumbs.db
30 |
31 | # Mac bundle stuff
32 | *.dmg
33 | *.app
34 |
35 | # resharper
36 | *_Resharper.*
37 | *.Resharper
38 |
39 | # dotCover
40 | *.dotCover
41 |
--------------------------------------------------------------------------------
/iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | using Foundation;
6 | using UIKit;
7 |
8 | namespace SharpPaintCode.iOS
9 | {
10 | [Register("AppDelegate")]
11 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
12 | {
13 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
14 | {
15 | global::Xamarin.Forms.Forms.Init();
16 |
17 | LoadApplication(new App());
18 |
19 | return base.FinishedLaunching(app, options);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/SharpPaintCodePage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms;
2 |
3 | namespace SharpPaintCode
4 | {
5 | public partial class App : Application
6 | {
7 | public App()
8 | {
9 | InitializeComponent();
10 |
11 | MainPage = new SharpPaintCodePage();
12 | }
13 |
14 | protected override void OnStart()
15 | {
16 | // Handle when your app starts
17 | }
18 |
19 | protected override void OnSleep()
20 | {
21 | // Handle when your app sleeps
22 | }
23 |
24 | protected override void OnResume()
25 | {
26 | // Handle when your app resumes
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Droid/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with your package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/Controls/SharpView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 |
4 | namespace SharpPaintCode.Controls
5 | {
6 | public class SharpView : View
7 | {
8 | public static readonly BindableProperty FillColorProperty =
9 | BindableProperty.Create(nameof(FillColor), typeof(Color), typeof(SharpView), default(Color));
10 |
11 | public Color FillColor
12 | {
13 | get { return (Color)GetValue(FillColorProperty); }
14 | set { SetValue(FillColorProperty, value); }
15 | }
16 |
17 | public SharpView()
18 | {
19 | BackgroundColor = Color.Transparent;
20 | HorizontalOptions = LayoutOptions.Center;
21 | WidthRequest = 150;
22 | HeightRequest = 150;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Droid/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Android.App;
4 | using Android.Content;
5 | using Android.Content.PM;
6 | using Android.Runtime;
7 | using Android.Views;
8 | using Android.Widget;
9 | using Android.OS;
10 |
11 | namespace SharpPaintCode.Droid
12 | {
13 | [Activity(Label = "SharpPaintCode.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
14 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
15 | {
16 | protected override void OnCreate(Bundle bundle)
17 | {
18 | TabLayoutResource = Resource.Layout.Tabbar;
19 | ToolbarResource = Resource.Layout.Toolbar;
20 |
21 | base.OnCreate(bundle);
22 |
23 | global::Xamarin.Forms.Forms.Init(this, bundle);
24 |
25 | LoadApplication(new App());
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Droid/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SharpPaintCodePage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms;
2 |
3 | namespace SharpPaintCode
4 | {
5 | public partial class SharpPaintCodePage : ContentPage
6 | {
7 | public SharpPaintCodePage()
8 | {
9 | InitializeComponent();
10 | }
11 |
12 | int _currentColor = 0;
13 | Color[] Colors = new Color[]
14 | {
15 | Color.Red,
16 | Color.Olive,
17 | Color.Green,
18 | Color.DodgerBlue,
19 | Color.DeepPink,
20 | Color.DarkOrange
21 | };
22 |
23 | void NextColorsButtonClicked(object sender, System.EventArgs e)
24 | {
25 | _currentColor++;
26 | SetColor();
27 | }
28 |
29 | protected override void OnAppearing()
30 | {
31 | SetColor();
32 | }
33 |
34 | void SetColor()
35 | {
36 | Sharp1.FillColor = Colors[_currentColor % Colors.Length];
37 | Sharp2.FillColor = Colors[(_currentColor+1) % Colors.Length];
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | // Information about this assembly is defined by the following attributes.
5 | // Change them to the values specific to your project.
6 |
7 | [assembly: AssemblyTitle("SharpPaintCode")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("")]
12 | [assembly: AssemblyCopyright("")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
19 |
20 | [assembly: AssemblyVersion("1.0.*")]
21 |
22 | // The following attributes are used to specify the signing key for the assembly,
23 | // if desired. See the Mono documentation for more information about signing.
24 |
25 | //[assembly: AssemblyDelaySign(false)]
26 | //[assembly: AssemblyKeyFile("")]
27 |
--------------------------------------------------------------------------------
/Droid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using Android.App;
4 |
5 | // Information about this assembly is defined by the following attributes.
6 | // Change them to the values specific to your project.
7 |
8 | [assembly: AssemblyTitle("SharpPaintCode.Droid")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
18 | // The form "{Major}.{Minor}.*" will automatically update the build and revision,
19 | // and "{Major}.{Minor}.{Build}.*" will update just the revision.
20 |
21 | [assembly: AssemblyVersion("1.0.0")]
22 |
23 | // The following attributes are used to specify the signing key for the assembly,
24 | // if desired. See the Mono documentation for more information about signing.
25 |
26 | //[assembly: AssemblyDelaySign(false)]
27 | //[assembly: AssemblyKeyFile("")]
28 |
--------------------------------------------------------------------------------
/Droid/Controls/Native/SharpView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Android.Content;
3 | using Android.Graphics;
4 | using Android.Util;
5 | using Android.Views;
6 |
7 | namespace SharpPaintCode.Droid.Controls.Native
8 | {
9 | public class SharpView : View
10 | {
11 | #region Constructores
12 |
13 | public SharpView(Context context, IAttributeSet attrs) : base(context, attrs)
14 | {
15 | }
16 |
17 | public SharpView(Context context) : base(context)
18 | {
19 | }
20 |
21 | #endregion
22 |
23 | #region Propiedades
24 |
25 | public Color _fillColor = Color.Argb(255, 60, 138, 63);
26 | public Color FillColor
27 | {
28 | get { return _fillColor; }
29 | set
30 | {
31 | _fillColor = value;
32 | Invalidate();
33 | }
34 | }
35 |
36 | #endregion
37 |
38 | #region Drawing
39 | protected override void OnDraw(Canvas canvas)
40 | {
41 | SharpKit.DrawSharpCanvas(canvas, _fillColor.ToArgb(), Width, Height);
42 | }
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Droid/Resources/Resource.designer.cs:
--------------------------------------------------------------------------------
1 | namespace SharpPaintCode.Droid.Resources
2 | {
3 |
4 |
5 | public partial class Resource
6 | {
7 |
8 | public partial class Attribute
9 | {
10 |
11 | private Attribute()
12 | {
13 | }
14 | }
15 |
16 | public partial class Drawable
17 | {
18 |
19 | // aapt resource value: 0x7f020000
20 | public const int icon = 2130837504;
21 |
22 | private Drawable()
23 | {
24 | }
25 | }
26 |
27 | public partial class Layout
28 | {
29 |
30 | // aapt resource value: 0x7f030000
31 | public const int Main = 2130903040;
32 |
33 | private Layout()
34 | {
35 | }
36 | }
37 |
38 | public partial class String
39 | {
40 |
41 | // aapt resource value: 0x7f040000
42 | public const int hello = 2130968576;
43 |
44 | // aapt resource value: 0x7f040001
45 | public const int app_name = 2130968577;
46 |
47 | private String()
48 | {
49 | }
50 | }
51 |
52 | public partial class Id
53 | {
54 |
55 | // aapt resource value: 0x7f050000
56 | public const int myButton = 2131034112;
57 |
58 | private Id()
59 | {
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Droid/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/iOS/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Droid/Controls/SharpViewRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using SharpPaintCode.Droid.Controls;
4 | using Xamarin.Forms;
5 | using Xamarin.Forms.Platform.Android;
6 | using FormsSharpView = SharpPaintCode.Controls.SharpView;
7 | using NativeSharpView = SharpPaintCode.Droid.Controls.Native.SharpView;
8 |
9 | [assembly: ExportRenderer(typeof(FormsSharpView), typeof(SharpViewRenderer))]
10 | namespace SharpPaintCode.Droid.Controls
11 | {
12 | public class SharpViewRenderer : ViewRenderer
13 | {
14 | protected override void OnElementChanged(ElementChangedEventArgs e)
15 | {
16 | base.OnElementChanged(e);
17 |
18 | if (e.NewElement != null)
19 | {
20 | if (Control == null)
21 | {
22 | var native = new NativeSharpView(Context);
23 | native.FillColor = Element.FillColor.ToAndroid();
24 | SetNativeControl(native);
25 | }
26 | }
27 | }
28 |
29 | protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
30 | {
31 | if (e.PropertyName.Equals(nameof(FormsSharpView.FillColor)))
32 | {
33 | Control.FillColor = Element.FillColor.ToAndroid();
34 | }
35 | else
36 | {
37 | base.OnElementPropertyChanged(sender, e);
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/iOS/Controls/SharpViewRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using CoreGraphics;
4 | using SharpPaintCode.Controls;
5 | using SharpPaintCode.iOS.Controls;
6 | using SharpPaintCode.iOS.Controls.Native;
7 | using Xamarin.Forms;
8 | using Xamarin.Forms.Platform.iOS;
9 |
10 | [assembly: ExportRenderer(typeof(SharpView), typeof(SharpViewRenderer))]
11 | namespace SharpPaintCode.iOS.Controls
12 | {
13 | public class SharpViewRenderer : ViewRenderer
14 | {
15 | protected override void OnElementChanged(ElementChangedEventArgs e)
16 | {
17 | base.OnElementChanged(e);
18 |
19 | if (e.NewElement != null)
20 | {
21 | if (Control == null)
22 | {
23 | var sharpFrame = new CGRect(0, 0, Element.WidthRequest, Element.HeightRequest);
24 | var native = new UISharpView(sharpFrame);
25 | native.FillColor = Element.FillColor.ToUIColor();
26 | SetNativeControl(native);
27 | }
28 | }
29 | }
30 |
31 | protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
32 | {
33 | if(e.PropertyName.Equals(nameof(SharpView.FillColor)))
34 | {
35 | Control.FillColor = Element.FillColor.ToUIColor();
36 | }
37 | else
38 | {
39 | base.OnElementPropertyChanged(sender, e);
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDisplayName
6 | SharpPaintCode
7 | CFBundleName
8 | SharpPaintCode
9 | CFBundleIdentifier
10 | com.thatcsharpguy.sharppaintcode
11 | CFBundleShortVersionString
12 | 1.0
13 | CFBundleVersion
14 | 1.0
15 | LSRequiresIPhoneOS
16 |
17 | MinimumOSVersion
18 | 8.0
19 | UIDeviceFamily
20 |
21 | 1
22 | 2
23 |
24 | UILaunchStoryboardName
25 | LaunchScreen
26 | UIRequiredDeviceCapabilities
27 |
28 | armv7
29 |
30 | UISupportedInterfaceOrientations
31 |
32 | UIInterfaceOrientationPortrait
33 | UIInterfaceOrientationLandscapeLeft
34 | UIInterfaceOrientationLandscapeRight
35 |
36 | UISupportedInterfaceOrientations~ipad
37 |
38 | UIInterfaceOrientationPortrait
39 | UIInterfaceOrientationPortraitUpsideDown
40 | UIInterfaceOrientationLandscapeLeft
41 | UIInterfaceOrientationLandscapeRight
42 |
43 | XSAppIconAssets
44 | Assets.xcassets/AppIcon.appiconset
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Droid/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.axml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable/
12 | icon.png
13 |
14 | layout/
15 | main.axml
16 |
17 | values/
18 | strings.xml
19 |
20 | In order to get the build system to recognize Android resources, set the build action to
21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
22 | instead operate on resource IDs. When you compile an Android application that uses resources,
23 | the build system will package the resources for distribution and generate a class called "R"
24 | (this is an Android convention) that contains the tokens for each one of the resources
25 | included. For example, for the above Resources layout, this is what the R class would expose:
26 |
27 | public class R {
28 | public class drawable {
29 | public const int icon = 0x123;
30 | }
31 |
32 | public class layout {
33 | public const int main = 0x456;
34 | }
35 |
36 | public class strings {
37 | public const int first_string = 0xabc;
38 | public const int second_string = 0xbcd;
39 | }
40 | }
41 |
42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
43 | to reference the layout/main.axml file, or R.strings.first_string to reference the first
44 | string in the dictionary file values/strings.xml.
45 |
--------------------------------------------------------------------------------
/SharpPaintCode.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}
7 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | true
9 | Library
10 | SharpPaintCode
11 | SharpPaintCode
12 | v4.5
13 | Profile111
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug
20 | DEBUG;
21 | prompt
22 | 4
23 |
24 |
25 | true
26 | bin\Release
27 | prompt
28 | 4
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | App.xaml
37 |
38 |
39 | SharpPaintCodePage.xaml
40 |
41 |
42 |
43 |
44 |
45 |
46 | packages\Xamarin.Forms.2.3.4.231\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll
47 |
48 |
49 | packages\Xamarin.Forms.2.3.4.231\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll
50 |
51 |
52 | packages\Xamarin.Forms.2.3.4.231\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "idiom": "iphone",
5 | "size": "29x29",
6 | "scale": "1x"
7 | },
8 | {
9 | "idiom": "iphone",
10 | "size": "29x29",
11 | "scale": "2x"
12 | },
13 | {
14 | "idiom": "iphone",
15 | "size": "29x29",
16 | "scale": "3x"
17 | },
18 | {
19 | "idiom": "iphone",
20 | "size": "40x40",
21 | "scale": "2x"
22 | },
23 | {
24 | "idiom": "iphone",
25 | "size": "40x40",
26 | "scale": "3x"
27 | },
28 | {
29 | "idiom": "iphone",
30 | "size": "57x57",
31 | "scale": "1x"
32 | },
33 | {
34 | "idiom": "iphone",
35 | "size": "57x57",
36 | "scale": "2x"
37 | },
38 | {
39 | "idiom": "iphone",
40 | "size": "60x60",
41 | "scale": "2x"
42 | },
43 | {
44 | "idiom": "iphone",
45 | "size": "60x60",
46 | "scale": "3x"
47 | },
48 | {
49 | "idiom": "ipad",
50 | "size": "29x29",
51 | "scale": "1x"
52 | },
53 | {
54 | "idiom": "ipad",
55 | "size": "29x29",
56 | "scale": "2x"
57 | },
58 | {
59 | "idiom": "ipad",
60 | "size": "40x40",
61 | "scale": "1x"
62 | },
63 | {
64 | "idiom": "ipad",
65 | "size": "40x40",
66 | "scale": "2x"
67 | },
68 | {
69 | "idiom": "ipad",
70 | "size": "50x50",
71 | "scale": "1x"
72 | },
73 | {
74 | "idiom": "ipad",
75 | "size": "50x50",
76 | "scale": "2x"
77 | },
78 | {
79 | "idiom": "ipad",
80 | "size": "72x72",
81 | "scale": "1x"
82 | },
83 | {
84 | "idiom": "ipad",
85 | "size": "72x72",
86 | "scale": "2x"
87 | },
88 | {
89 | "idiom": "ipad",
90 | "size": "76x76",
91 | "scale": "1x"
92 | },
93 | {
94 | "idiom": "ipad",
95 | "size": "76x76",
96 | "scale": "2x"
97 | },
98 | {
99 | "size": "24x24",
100 | "idiom": "watch",
101 | "scale": "2x",
102 | "role": "notificationCenter",
103 | "subtype": "38mm"
104 | },
105 | {
106 | "size": "27.5x27.5",
107 | "idiom": "watch",
108 | "scale": "2x",
109 | "role": "notificationCenter",
110 | "subtype": "42mm"
111 | },
112 | {
113 | "size": "29x29",
114 | "idiom": "watch",
115 | "role": "companionSettings",
116 | "scale": "2x"
117 | },
118 | {
119 | "size": "29x29",
120 | "idiom": "watch",
121 | "role": "companionSettings",
122 | "scale": "3x"
123 | },
124 | {
125 | "size": "40x40",
126 | "idiom": "watch",
127 | "scale": "2x",
128 | "role": "appLauncher",
129 | "subtype": "38mm"
130 | },
131 | {
132 | "size": "44x44",
133 | "idiom": "watch",
134 | "scale": "2x",
135 | "role": "longLook",
136 | "subtype": "42mm"
137 | },
138 | {
139 | "size": "86x86",
140 | "idiom": "watch",
141 | "scale": "2x",
142 | "role": "quickLook",
143 | "subtype": "38mm"
144 | },
145 | {
146 | "size": "98x98",
147 | "idiom": "watch",
148 | "scale": "2x",
149 | "role": "quickLook",
150 | "subtype": "42mm"
151 | }
152 | ],
153 | "info": {
154 | "version": 1,
155 | "author": "xcode"
156 | }
157 | }
--------------------------------------------------------------------------------
/SharpPaintCode.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpPaintCode", "SharpPaintCode.csproj", "{809085AF-EB1B-486E-9A2B-E5B6C36FDB93}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpPaintCode.iOS", "iOS\SharpPaintCode.iOS.csproj", "{A45372F4-5148-4EBD-A319-EBBB775F6B00}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpPaintCode.Droid", "Droid\SharpPaintCode.Droid.csproj", "{8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | Debug|iPhoneSimulator = Debug|iPhoneSimulator
15 | Release|iPhone = Release|iPhone
16 | Release|iPhoneSimulator = Release|iPhoneSimulator
17 | Debug|iPhone = Debug|iPhone
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Release|Any CPU.Build.0 = Release|Any CPU
24 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
25 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
26 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Release|iPhone.ActiveCfg = Release|Any CPU
27 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Release|iPhone.Build.0 = Release|Any CPU
28 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
29 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
30 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Debug|iPhone.ActiveCfg = Debug|Any CPU
31 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}.Debug|iPhone.Build.0 = Debug|Any CPU
32 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
33 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
34 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Release|Any CPU.ActiveCfg = Release|iPhone
35 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Release|Any CPU.Build.0 = Release|iPhone
36 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
37 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
38 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Release|iPhone.ActiveCfg = Release|iPhone
39 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Release|iPhone.Build.0 = Release|iPhone
40 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
41 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
42 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Debug|iPhone.ActiveCfg = Debug|iPhone
43 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}.Debug|iPhone.Build.0 = Debug|iPhone
44 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Release|Any CPU.Build.0 = Release|Any CPU
48 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
49 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
50 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Release|iPhone.ActiveCfg = Release|Any CPU
51 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Release|iPhone.Build.0 = Release|Any CPU
52 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
53 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
54 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Debug|iPhone.ActiveCfg = Debug|Any CPU
55 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}.Debug|iPhone.Build.0 = Debug|Any CPU
56 | EndGlobalSection
57 | EndGlobal
58 |
--------------------------------------------------------------------------------
/iOS/SharpPaintCode.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | iPhoneSimulator
6 | {A45372F4-5148-4EBD-A319-EBBB775F6B00}
7 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | Exe
9 | SharpPaintCode.iOS
10 | SharpPaintCode.iOS
11 | Resources
12 |
13 |
14 | true
15 | full
16 | false
17 | bin\iPhoneSimulator\Debug
18 | DEBUG;ENABLE_TEST_CLOUD;
19 | prompt
20 | 4
21 | iPhone Developer
22 | true
23 | true
24 | true
25 | true
26 | 25416
27 | None
28 | i386, x86_64
29 | HttpClientHandler
30 | x86
31 |
32 |
33 | pdbonly
34 | true
35 | bin\iPhone\Release
36 | prompt
37 | 4
38 | iPhone Developer
39 | true
40 | Entitlements.plist
41 | SdkOnly
42 | ARMv7, ARM64
43 | HttpClientHandler
44 | x86
45 |
46 |
47 | pdbonly
48 | true
49 | bin\iPhoneSimulator\Release
50 | prompt
51 | 4
52 | iPhone Developer
53 | true
54 | true
55 | None
56 | i386, x86_64
57 | HttpClientHandler
58 | x86
59 |
60 |
61 | true
62 | full
63 | false
64 | bin\iPhone\Debug
65 | DEBUG;ENABLE_TEST_CLOUD;
66 | prompt
67 | 4
68 | iPhone Developer
69 | true
70 | true
71 | true
72 | true
73 | true
74 | Entitlements.plist
75 | 54657
76 | SdkOnly
77 | ARMv7, ARM64
78 | HttpClientHandler
79 | x86
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | ..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll
88 |
89 |
90 | ..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll
91 |
92 |
93 | ..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll
94 |
95 |
96 | ..\packages\Xamarin.Forms.2.3.4.231\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll
97 |
98 |
99 |
100 |
101 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}
102 | SharpPaintCode
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/Droid/SharpPaintCode.Droid.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {8FFF1F4E-8F57-439E-80EA-E1CCF4ADE7D3}
7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | Library
9 | SharpPaintCode.Droid
10 | SharpPaintCode.Droid
11 | v7.0
12 | True
13 | Resources\Resource.designer.cs
14 | Resource
15 | Properties\AndroidManifest.xml
16 | Resources
17 | Assets
18 | true
19 |
20 |
21 | true
22 | full
23 | false
24 | bin\Debug
25 | DEBUG;
26 | prompt
27 | 4
28 | None
29 |
30 |
31 | true
32 | pdbonly
33 | true
34 | bin\Release
35 | prompt
36 | 4
37 | true
38 | false
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | ..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll
47 |
48 |
49 | ..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll
50 |
51 |
52 | ..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll
53 |
54 |
55 | ..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll
56 |
57 |
58 | ..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll
59 |
60 |
61 | ..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll
62 |
63 |
64 | ..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll
65 |
66 |
67 | ..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll
68 |
69 |
70 | ..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\FormsViewGroup.dll
71 |
72 |
73 | ..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Core.dll
74 |
75 |
76 | ..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll
77 |
78 |
79 | ..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Platform.dll
80 |
81 |
82 | ..\packages\Xamarin.Forms.2.3.4.231\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll
83 |
84 |
85 |
86 |
87 | {809085AF-EB1B-486E-9A2B-E5B6C36FDB93}
88 | SharpPaintCode
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/iOS/Controls/Native/UISharpView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using CoreGraphics;
3 | using UIKit;
4 |
5 | namespace SharpPaintCode.iOS.Controls.Native
6 | {
7 | public class UISharpView : UIView
8 | {
9 | #region Constructores
10 |
11 | public UISharpView(IntPtr p)
12 | : base(p) { }
13 |
14 | public UISharpView(CGRect rect)
15 | : base(rect) { }
16 |
17 | public UISharpView() { }
18 |
19 | #endregion
20 |
21 | #region Properties
22 | UIColor _fillColor = UIColor.FromRGB(60, 138, 63);
23 |
24 | public UIColor FillColor
25 | {
26 | get { return _fillColor; }
27 | set { _fillColor = value; SetNeedsDisplay(); }
28 | }
29 | #endregion
30 |
31 | #region Drawing methods
32 |
33 | public override void Draw(CGRect rect)
34 | {
35 | DrawSharpCanvas(FillColor, rect.Width, rect.Height);
36 | }
37 |
38 | private void DrawSharpCanvas(UIColor fillColor, nfloat width, nfloat height)
39 | {
40 |
41 | //// Frames
42 | var sharpFrame = new CGRect(0.0f, 0.0f, width, height);
43 |
44 |
45 | //// SharpSymbol Drawing
46 | var sharpSymbolPath = new UIBezierPath();
47 | sharpSymbolPath.MoveTo(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00002f * sharpFrame.Height));
48 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.20000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + -0.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.08245f * sharpFrame.Height));
49 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 1.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.20000f * sharpFrame.Height));
50 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 1.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.40000f * sharpFrame.Height));
51 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.40000f * sharpFrame.Height));
52 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.60000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.46586f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.53414f * sharpFrame.Height));
53 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 1.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.60000f * sharpFrame.Height));
54 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 1.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.80000f * sharpFrame.Height));
55 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.80000f * sharpFrame.Height));
56 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.91755f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height));
57 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height));
58 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.80000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.91755f * sharpFrame.Height));
59 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.80000f * sharpFrame.Height));
60 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.91755f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height));
61 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height));
62 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.80000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 1.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.91755f * sharpFrame.Height));
63 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.80000f * sharpFrame.Height));
64 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.60000f * sharpFrame.Height));
65 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.60000f * sharpFrame.Height));
66 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.40000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.53414f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.46586f * sharpFrame.Height));
67 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.40000f * sharpFrame.Height));
68 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.00000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.20000f * sharpFrame.Height));
69 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.20000f * sharpFrame.Height));
70 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.08245f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.20000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00000f * sharpFrame.Height));
71 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00000f * sharpFrame.Height));
72 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.20000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.08245f * sharpFrame.Height));
73 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.20000f * sharpFrame.Height));
74 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.08245f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00000f * sharpFrame.Height));
75 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00000f * sharpFrame.Height));
76 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.80000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.00002f * sharpFrame.Height));
77 | sharpSymbolPath.ClosePath();
78 | sharpSymbolPath.MoveTo(new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.40000f * sharpFrame.Height));
79 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.40000f * sharpFrame.Height));
80 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.60000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.46586f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.40000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.53414f * sharpFrame.Height));
81 | sharpSymbolPath.AddLineTo(new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.60000f * sharpFrame.Height));
82 | sharpSymbolPath.AddCurveToPoint(new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.40000f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.53414f * sharpFrame.Height), new CGPoint(sharpFrame.GetMinX() + 0.60000f * sharpFrame.Width, sharpFrame.GetMinY() + 0.46586f * sharpFrame.Height));
83 | sharpSymbolPath.ClosePath();
84 | fillColor.SetFill();
85 | sharpSymbolPath.Fill();
86 | }
87 |
88 | #endregion
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/Droid/Controls/Native/SharpKit.java:
--------------------------------------------------------------------------------
1 | package sharppaintcode.droid.controls.Native;
2 |
3 | import android.graphics.Paint;
4 | import android.graphics.RectF;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Path;
8 |
9 |
10 |
11 | /**
12 | * Created by Antonio Feregrino on 6/3/17.
13 | * Copyright © 2017 That C# guy. All rights reserved.
14 | *
15 | * Generated by PaintCode
16 | * http://www.paintcodeapp.com
17 | *
18 | * @author Antonio Feregrino
19 | */
20 | public class SharpKit
21 | {
22 |
23 |
24 | // Resizing Behavior
25 | public enum ResizingBehavior
26 | {
27 | AspectFit, //!< The content is proportionally resized to fit into the target rectangle.
28 | AspectFill, //!< The content is proportionally resized to completely fill the target rectangle.
29 | Stretch, //!< The content is stretched to match the entire target rectangle.
30 | Center, //!< The content is centered in the target rectangle, but it is NOT resized.
31 | }
32 |
33 | // Canvas Drawings
34 | // Sharp
35 |
36 | private static class CacheForSharpCanvas
37 | {
38 | private static Paint paint = new Paint();
39 | private static RectF originalFrame = new RectF(0f, 0f, 100f, 100f);
40 | private static RectF resizedFrame = new RectF();
41 | private static RectF sharpFrame = new RectF();
42 | private static RectF sharpSymbolRect = new RectF();
43 | private static Path sharpSymbolPath = new Path();
44 | }
45 |
46 | public static void drawSharpCanvas(Canvas canvas, int fillColor, float width, float height)
47 | {
48 | SharpKit.drawSharpCanvas(canvas, new RectF(0f, 0f, 100f, 100f), ResizingBehavior.AspectFit, fillColor, width, height);
49 | }
50 |
51 | public static void drawSharpCanvas(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int fillColor, float width, float height)
52 | {
53 | // General Declarations
54 | Paint paint = CacheForSharpCanvas.paint;
55 |
56 | // Resize to Target Frame
57 | canvas.save();
58 | RectF resizedFrame = CacheForSharpCanvas.resizedFrame;
59 | SharpKit.resizingBehaviorApply(resizing, CacheForSharpCanvas.originalFrame, targetFrame, resizedFrame);
60 | canvas.translate(resizedFrame.left, resizedFrame.top);
61 | canvas.scale(resizedFrame.width() / 100f, resizedFrame.height() / 100f);
62 |
63 | // SharpFrame
64 | RectF sharpFrame = CacheForSharpCanvas.sharpFrame;
65 | sharpFrame.set(0f, 0f, width, height);
66 |
67 | // SharpSymbol
68 | RectF sharpSymbolRect = CacheForSharpCanvas.sharpSymbolRect;
69 | sharpSymbolRect.set(0f, 0f, 100f, 100f);
70 | Path sharpSymbolPath = CacheForSharpCanvas.sharpSymbolPath;
71 | sharpSymbolPath.reset();
72 | sharpSymbolPath.moveTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.00002f);
73 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top, sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.08245f, sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.2f);
74 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width(), sharpFrame.top + sharpFrame.height() * 0.2f);
75 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width(), sharpFrame.top + sharpFrame.height() * 0.4f);
76 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.4f);
77 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.46586f, sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.53414f, sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.6f);
78 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width(), sharpFrame.top + sharpFrame.height() * 0.6f);
79 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width(), sharpFrame.top + sharpFrame.height() * 0.8f);
80 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.8f);
81 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.91755f, sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height(), sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height());
82 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height());
83 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height(), sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.91755f, sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.8f);
84 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.8f);
85 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.91755f, sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height(), sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height());
86 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height());
87 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height(), sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.91755f, sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.8f);
88 | sharpSymbolPath.lineTo(sharpFrame.left, sharpFrame.top + sharpFrame.height() * 0.8f);
89 | sharpSymbolPath.lineTo(sharpFrame.left, sharpFrame.top + sharpFrame.height() * 0.6f);
90 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.6f);
91 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.53414f, sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.46586f, sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.4f);
92 | sharpSymbolPath.lineTo(sharpFrame.left, sharpFrame.top + sharpFrame.height() * 0.4f);
93 | sharpSymbolPath.lineTo(sharpFrame.left, sharpFrame.top + sharpFrame.height() * 0.2f);
94 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.2f);
95 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top + sharpFrame.height() * 0.08245f, sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top, sharpFrame.left + sharpFrame.width() * 0.2f, sharpFrame.top);
96 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top);
97 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top, sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.08245f, sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.2f);
98 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.2f);
99 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.08245f, sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top, sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top);
100 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top);
101 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.8f, sharpFrame.top + sharpFrame.height() * 0.00002f);
102 | sharpSymbolPath.close();
103 | sharpSymbolPath.moveTo(sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.4f);
104 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.4f);
105 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.46586f, sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.53414f, sharpFrame.left + sharpFrame.width() * 0.4f, sharpFrame.top + sharpFrame.height() * 0.6f);
106 | sharpSymbolPath.lineTo(sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.6f);
107 | sharpSymbolPath.cubicTo(sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.53414f, sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.46586f, sharpFrame.left + sharpFrame.width() * 0.6f, sharpFrame.top + sharpFrame.height() * 0.4f);
108 | sharpSymbolPath.close();
109 |
110 | paint.reset();
111 | paint.setFlags(Paint.ANTI_ALIAS_FLAG);
112 | paint.setStyle(Paint.Style.FILL);
113 | paint.setColor(fillColor);
114 | canvas.drawPath(sharpSymbolPath, paint);
115 |
116 | canvas.restore();
117 | }
118 |
119 |
120 | // Resizing Behavior
121 | public static void resizingBehaviorApply(ResizingBehavior behavior, RectF rect, RectF target, RectF result)
122 | {
123 | if (rect.equals(target) || target == null)
124 | {
125 | result.set(rect);
126 | return;
127 | }
128 |
129 | if (behavior == ResizingBehavior.Stretch)
130 | {
131 | result.set(target);
132 | return;
133 | }
134 |
135 | float xRatio = Math.abs(target.width() / rect.width());
136 | float yRatio = Math.abs(target.height() / rect.height());
137 | float scale = 0f;
138 |
139 | switch (behavior)
140 | {
141 | case AspectFit:
142 | {
143 | scale = Math.min(xRatio, yRatio);
144 | break;
145 | }
146 | case AspectFill:
147 | {
148 | scale = Math.max(xRatio, yRatio);
149 | break;
150 | }
151 | case Center:
152 | {
153 | scale = 1f;
154 | break;
155 | }
156 | }
157 |
158 | float newWidth = Math.abs(rect.width() * scale);
159 | float newHeight = Math.abs(rect.height() * scale);
160 | result.set(target.centerX() - newWidth / 2,
161 | target.centerY() - newHeight / 2,
162 | target.centerX() + newWidth / 2,
163 | target.centerY() + newHeight / 2);
164 | }
165 |
166 |
167 | }
--------------------------------------------------------------------------------
/Droid/Controls/Native/SharpKit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Android.Graphics;
3 |
4 | namespace SharpPaintCode.Droid.Controls.Native
5 | {
6 | public class SharpKit
7 | {
8 | // Resizing Behavior
9 | public enum ResizingBehavior
10 | {
11 | AspectFit, //!< The content is proportionally resized to fit into the target rectangle.
12 | AspectFill, //!< The content is proportionally resized to completely fill the target rectangle.
13 | Stretch, //!< The content is stretched to match the entire target rectangle.
14 | Center, //!< The content is centered in the target rectangle, but it is NOT resized.
15 | }
16 |
17 | // Canvas Drawings
18 | // Sharp
19 |
20 | private static class CacheForSharpCanvas
21 | {
22 | public static Paint paint = new Paint();
23 | public static RectF originalFrame = new RectF(0f, 0f, 100f, 100f);
24 | public static RectF resizedFrame = new RectF();
25 | public static RectF sharpFrame = new RectF();
26 | public static RectF sharpSymbolRect = new RectF();
27 | public static Path sharpSymbolPath = new Path();
28 | }
29 |
30 | public static void DrawSharpCanvas(Canvas canvas, int fillColor, float width, float height)
31 | {
32 | SharpKit.DrawSharpCanvas(canvas, new RectF(0f, 0f, 100f, 100f), ResizingBehavior.AspectFit, fillColor, width, height);
33 | }
34 |
35 | public static void DrawSharpCanvas(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int fillColor, float width, float height)
36 | {
37 | // General Declarations
38 | Paint paint = CacheForSharpCanvas.paint;
39 |
40 | // Resize to Target Frame
41 | canvas.Save();
42 | RectF resizedFrame = CacheForSharpCanvas.resizedFrame;
43 | SharpKit.resizingBehaviorApply(resizing, CacheForSharpCanvas.originalFrame, targetFrame, resizedFrame);
44 | canvas.Translate(resizedFrame.Left, resizedFrame.Top);
45 | canvas.Scale(resizedFrame.Width() / 100f, resizedFrame.Height() / 100f);
46 |
47 | // SharpFrame
48 | RectF sharpFrame = CacheForSharpCanvas.sharpFrame;
49 | sharpFrame.Set(0f, 0f, width, height);
50 |
51 | // SharpSymbol
52 | RectF sharpSymbolRect = CacheForSharpCanvas.sharpSymbolRect;
53 | sharpSymbolRect.Set(0f, 0f, 100f, 100f);
54 | Path sharpSymbolPath = CacheForSharpCanvas.sharpSymbolPath;
55 | sharpSymbolPath.Reset();
56 | sharpSymbolPath.MoveTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.00002f);
57 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
58 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.2f);
59 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.4f);
60 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
61 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
62 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.6f);
63 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width(), sharpFrame.Top + sharpFrame.Height() * 0.8f);
64 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
65 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height());
66 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height());
67 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
68 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
69 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height());
70 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height());
71 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height(), sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.91755f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.8f);
72 | sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.8f);
73 | sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.6f);
74 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
75 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
76 | sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.4f);
77 | sharpSymbolPath.LineTo(sharpFrame.Left, sharpFrame.Top + sharpFrame.Height() * 0.2f);
78 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
79 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.2f, sharpFrame.Top);
80 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top);
81 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
82 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.2f);
83 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.08245f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top);
84 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top);
85 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.8f, sharpFrame.Top + sharpFrame.Height() * 0.00002f);
86 | sharpSymbolPath.Close();
87 | sharpSymbolPath.MoveTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
88 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
89 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.4f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
90 | sharpSymbolPath.LineTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.6f);
91 | sharpSymbolPath.CubicTo(sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.53414f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.46586f, sharpFrame.Left + sharpFrame.Width() * 0.6f, sharpFrame.Top + sharpFrame.Height() * 0.4f);
92 | sharpSymbolPath.Close();
93 |
94 | paint.Reset();
95 | paint.Flags = PaintFlags.AntiAlias;
96 | paint.SetStyle(Paint.Style.Fill);
97 | paint.Color = new Color(fillColor);
98 | canvas.DrawPath(sharpSymbolPath, paint);
99 |
100 | canvas.Restore();
101 | }
102 |
103 |
104 | // Resizing Behavior
105 | public static void resizingBehaviorApply(ResizingBehavior behavior, RectF rect, RectF target, RectF result)
106 | {
107 | if (rect.Equals(target) || target == null)
108 | {
109 | result.Set(rect);
110 | return;
111 | }
112 |
113 | if (behavior == ResizingBehavior.Stretch)
114 | {
115 | result.Set(target);
116 | return;
117 | }
118 |
119 | float xRatio = Math.Abs(target.Width() / rect.Width());
120 | float yRatio = Math.Abs(target.Height() / rect.Height());
121 | float scale = 0f;
122 |
123 | switch (behavior)
124 | {
125 | case ResizingBehavior.AspectFit:
126 | {
127 | scale = Math.Min(xRatio, yRatio);
128 | break;
129 | }
130 | case ResizingBehavior.AspectFill:
131 | {
132 | scale = Math.Max(xRatio, yRatio);
133 | break;
134 | }
135 | case ResizingBehavior.Center:
136 | {
137 | scale = 1f;
138 | break;
139 | }
140 | }
141 |
142 | float newWidth = Math.Abs(rect.Width() * scale);
143 | float newHeight = Math.Abs(rect.Height() * scale);
144 | result.Set(target.CenterX() - newWidth / 2,
145 | target.CenterY() - newHeight / 2,
146 | target.CenterX() + newWidth / 2,
147 | target.CenterY() + newHeight / 2);
148 | }
149 |
150 | }
151 | }
--------------------------------------------------------------------------------