├── .gitignore ├── README.md ├── Sample └── TinySvgHelper.Sample │ ├── TinySvgHelper.Sample.Android │ ├── Assets │ │ ├── AboutAssets.txt │ │ ├── door.svg │ │ ├── info.svg │ │ └── logo.svg │ ├── MainActivity.cs │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ ├── Resource.designer.cs │ │ ├── drawable │ │ │ └── send.png │ │ ├── layout │ │ │ ├── Tabbar.xml │ │ │ └── Toolbar.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── icon.xml │ │ │ └── icon_round.xml │ │ ├── mipmap-hdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-mdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-xhdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ └── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ └── TinySvgHelper.Sample.Android.csproj │ ├── TinySvgHelper.Sample.iOS │ ├── AppDelegate.cs │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon1024.png │ │ │ ├── Icon120.png │ │ │ ├── Icon152.png │ │ │ ├── Icon167.png │ │ │ ├── Icon180.png │ │ │ ├── Icon20.png │ │ │ ├── Icon29.png │ │ │ ├── Icon40.png │ │ │ ├── Icon58.png │ │ │ ├── Icon60.png │ │ │ ├── Icon76.png │ │ │ ├── Icon80.png │ │ │ └── Icon87.png │ ├── Entitlements.plist │ ├── Info.plist │ ├── Main.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Default-568h@2x.png │ │ ├── Default-Portrait.png │ │ ├── Default-Portrait@2x.png │ │ ├── Default.png │ │ ├── Default@2x.png │ │ ├── LaunchScreen.storyboard │ │ ├── door.svg │ │ ├── info.svg │ │ ├── logo.svg │ │ └── send.png │ └── TinySvgHelper.Sample.iOS.csproj │ └── TinySvgHelper.Sample │ ├── AboutView.xaml │ ├── AboutView.xaml.cs │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── MainShell.xaml │ ├── MainShell.xaml.cs │ ├── StartView.xaml │ ├── StartView.xaml.cs │ └── TinySvgHelper.Sample.csproj ├── TinySvgHelper.sln ├── TinySvgHelper ├── IPlatformHelper.cs ├── PlatformHelper.android.cs ├── PlatformHelper.ios.cs ├── SvgExtension.cs ├── SvgHelper.cs └── TinySvgHelper.csproj └── azure-pipelines.yml /.gitignore: -------------------------------------------------------------------------------- 1 | # globs 2 | Makefile.in 3 | *.userprefs 4 | *.usertasks 5 | config.make 6 | config.status 7 | aclocal.m4 8 | install-sh 9 | autom4te.cache/ 10 | *.tar.gz 11 | tarballs/ 12 | test-results/ 13 | 14 | # Mac bundle stuff 15 | *.dmg 16 | *.app 17 | 18 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 19 | # General 20 | .DS_Store 21 | .AppleDouble 22 | .LSOverride 23 | 24 | # Icon must end with two \r 25 | Icon 26 | 27 | 28 | # Thumbnails 29 | ._* 30 | 31 | # Files that might appear in the root of a volume 32 | .DocumentRevisions-V100 33 | .fseventsd 34 | .Spotlight-V100 35 | .TemporaryItems 36 | .Trashes 37 | .VolumeIcon.icns 38 | .com.apple.timemachine.donotpresent 39 | 40 | # Directories potentially created on remote AFP share 41 | .AppleDB 42 | .AppleDesktop 43 | Network Trash Folder 44 | Temporary Items 45 | .apdisk 46 | 47 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 48 | # Windows thumbnail cache files 49 | Thumbs.db 50 | ehthumbs.db 51 | ehthumbs_vista.db 52 | 53 | # Dump file 54 | *.stackdump 55 | 56 | # Folder config file 57 | [Dd]esktop.ini 58 | 59 | # Recycle Bin used on file shares 60 | $RECYCLE.BIN/ 61 | 62 | # Windows Installer files 63 | *.cab 64 | *.msi 65 | *.msix 66 | *.msm 67 | *.msp 68 | 69 | # Windows shortcuts 70 | *.lnk 71 | 72 | # content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 73 | ## Ignore Visual Studio temporary files, build results, and 74 | ## files generated by popular Visual Studio add-ons. 75 | ## 76 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 77 | 78 | # User-specific files 79 | *.suo 80 | *.user 81 | *.userosscache 82 | *.sln.docstates 83 | 84 | # User-specific files (MonoDevelop/Xamarin Studio) 85 | *.userprefs 86 | 87 | # Build results 88 | [Dd]ebug/ 89 | [Dd]ebugPublic/ 90 | [Rr]elease/ 91 | [Rr]eleases/ 92 | x64/ 93 | x86/ 94 | bld/ 95 | [Bb]in/ 96 | [Oo]bj/ 97 | [Ll]og/ 98 | 99 | # Visual Studio 2015/2017 cache/options directory 100 | .vs/ 101 | # Uncomment if you have tasks that create the project's static files in wwwroot 102 | #wwwroot/ 103 | 104 | # Visual Studio 2017 auto generated files 105 | Generated\ Files/ 106 | 107 | # MSTest test Results 108 | [Tt]est[Rr]esult*/ 109 | [Bb]uild[Ll]og.* 110 | 111 | # NUNIT 112 | *.VisualState.xml 113 | TestResult.xml 114 | 115 | # Build Results of an ATL Project 116 | [Dd]ebugPS/ 117 | [Rr]eleasePS/ 118 | dlldata.c 119 | 120 | # Benchmark Results 121 | BenchmarkDotNet.Artifacts/ 122 | 123 | # .NET Core 124 | project.lock.json 125 | project.fragment.lock.json 126 | artifacts/ 127 | 128 | # StyleCop 129 | StyleCopReport.xml 130 | 131 | # Files built by Visual Studio 132 | *_i.c 133 | *_p.c 134 | *_h.h 135 | *.ilk 136 | *.meta 137 | *.obj 138 | *.iobj 139 | *.pch 140 | *.pdb 141 | *.ipdb 142 | *.pgc 143 | *.pgd 144 | *.rsp 145 | *.sbr 146 | *.tlb 147 | *.tli 148 | *.tlh 149 | *.tmp 150 | *.tmp_proj 151 | *_wpftmp.csproj 152 | *.log 153 | *.vspscc 154 | *.vssscc 155 | .builds 156 | *.pidb 157 | *.svclog 158 | *.scc 159 | 160 | # Chutzpah Test files 161 | _Chutzpah* 162 | 163 | # Visual C++ cache files 164 | ipch/ 165 | *.aps 166 | *.ncb 167 | *.opendb 168 | *.opensdf 169 | *.sdf 170 | *.cachefile 171 | *.VC.db 172 | *.VC.VC.opendb 173 | 174 | # Visual Studio profiler 175 | *.psess 176 | *.vsp 177 | *.vspx 178 | *.sap 179 | 180 | # Visual Studio Trace Files 181 | *.e2e 182 | 183 | # TFS 2012 Local Workspace 184 | $tf/ 185 | 186 | # Guidance Automation Toolkit 187 | *.gpState 188 | 189 | # ReSharper is a .NET coding add-in 190 | _ReSharper*/ 191 | *.[Rr]e[Ss]harper 192 | *.DotSettings.user 193 | 194 | # JustCode is a .NET coding add-in 195 | .JustCode 196 | 197 | # TeamCity is a build add-in 198 | _TeamCity* 199 | 200 | # DotCover is a Code Coverage Tool 201 | *.dotCover 202 | 203 | # AxoCover is a Code Coverage Tool 204 | .axoCover/* 205 | !.axoCover/settings.json 206 | 207 | # Visual Studio code coverage results 208 | *.coverage 209 | *.coveragexml 210 | 211 | # NCrunch 212 | _NCrunch_* 213 | .*crunch*.local.xml 214 | nCrunchTemp_* 215 | 216 | # MightyMoose 217 | *.mm.* 218 | AutoTest.Net/ 219 | 220 | # Web workbench (sass) 221 | .sass-cache/ 222 | 223 | # Installshield output folder 224 | [Ee]xpress/ 225 | 226 | # DocProject is a documentation generator add-in 227 | DocProject/buildhelp/ 228 | DocProject/Help/*.HxT 229 | DocProject/Help/*.HxC 230 | DocProject/Help/*.hhc 231 | DocProject/Help/*.hhk 232 | DocProject/Help/*.hhp 233 | DocProject/Help/Html2 234 | DocProject/Help/html 235 | 236 | # Click-Once directory 237 | publish/ 238 | 239 | # Publish Web Output 240 | *.[Pp]ublish.xml 241 | *.azurePubxml 242 | # Note: Comment the next line if you want to checkin your web deploy settings, 243 | # but database connection strings (with potential passwords) will be unencrypted 244 | *.pubxml 245 | *.publishproj 246 | 247 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 248 | # checkin your Azure Web App publish settings, but sensitive information contained 249 | # in these scripts will be unencrypted 250 | PublishScripts/ 251 | 252 | # NuGet Packages 253 | *.nupkg 254 | # The packages folder can be ignored because of Package Restore 255 | **/[Pp]ackages/* 256 | # except build/, which is used as an MSBuild target. 257 | !**/[Pp]ackages/build/ 258 | # Uncomment if necessary however generally it will be regenerated when needed 259 | #!**/[Pp]ackages/repositories.config 260 | # NuGet v3's project.json files produces more ignorable files 261 | *.nuget.props 262 | *.nuget.targets 263 | 264 | # Microsoft Azure Build Output 265 | csx/ 266 | *.build.csdef 267 | 268 | # Microsoft Azure Emulator 269 | ecf/ 270 | rcf/ 271 | 272 | # Windows Store app package directories and files 273 | AppPackages/ 274 | BundleArtifacts/ 275 | Package.StoreAssociation.xml 276 | _pkginfo.txt 277 | *.appx 278 | 279 | # Visual Studio cache files 280 | # files ending in .cache can be ignored 281 | *.[Cc]ache 282 | # but keep track of directories ending in .cache 283 | !*.[Cc]ache/ 284 | 285 | # Others 286 | ClientBin/ 287 | ~$* 288 | *~ 289 | *.dbmdl 290 | *.dbproj.schemaview 291 | *.jfm 292 | *.pfx 293 | *.publishsettings 294 | orleans.codegen.cs 295 | 296 | # Including strong name files can present a security risk 297 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 298 | #*.snk 299 | 300 | # Since there are multiple workflows, uncomment next line to ignore bower_components 301 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 302 | #bower_components/ 303 | 304 | # RIA/Silverlight projects 305 | Generated_Code/ 306 | 307 | # Backup & report files from converting an old project file 308 | # to a newer Visual Studio version. Backup files are not needed, 309 | # because we have git ;-) 310 | _UpgradeReport_Files/ 311 | Backup*/ 312 | UpgradeLog*.XML 313 | UpgradeLog*.htm 314 | ServiceFabricBackup/ 315 | *.rptproj.bak 316 | 317 | # SQL Server files 318 | *.mdf 319 | *.ldf 320 | *.ndf 321 | 322 | # Business Intelligence projects 323 | *.rdl.data 324 | *.bim.layout 325 | *.bim_*.settings 326 | *.rptproj.rsuser 327 | 328 | # Microsoft Fakes 329 | FakesAssemblies/ 330 | 331 | # GhostDoc plugin setting file 332 | *.GhostDoc.xml 333 | 334 | # Node.js Tools for Visual Studio 335 | .ntvs_analysis.dat 336 | node_modules/ 337 | 338 | # Visual Studio 6 build log 339 | *.plg 340 | 341 | # Visual Studio 6 workspace options file 342 | *.opt 343 | 344 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 345 | *.vbw 346 | 347 | # Visual Studio LightSwitch build output 348 | **/*.HTMLClient/GeneratedArtifacts 349 | **/*.DesktopClient/GeneratedArtifacts 350 | **/*.DesktopClient/ModelManifest.xml 351 | **/*.Server/GeneratedArtifacts 352 | **/*.Server/ModelManifest.xml 353 | _Pvt_Extensions 354 | 355 | # Paket dependency manager 356 | .paket/paket.exe 357 | paket-files/ 358 | 359 | # FAKE - F# Make 360 | .fake/ 361 | 362 | # JetBrains Rider 363 | .idea/ 364 | *.sln.iml 365 | 366 | # CodeRush personal settings 367 | .cr/personal 368 | 369 | # Python Tools for Visual Studio (PTVS) 370 | __pycache__/ 371 | *.pyc 372 | 373 | # Cake - Uncomment if you are using it 374 | # tools/** 375 | # !tools/packages.config 376 | 377 | # Tabs Studio 378 | *.tss 379 | 380 | # Telerik's JustMock configuration file 381 | *.jmconfig 382 | 383 | # BizTalk build output 384 | *.btp.cs 385 | *.btm.cs 386 | *.odx.cs 387 | *.xsd.cs 388 | 389 | # OpenCover UI analysis results 390 | OpenCover/ 391 | 392 | # Azure Stream Analytics local run output 393 | ASALocalRun/ 394 | 395 | # MSBuild Binary and Structured Log 396 | *.binlog 397 | 398 | # NVidia Nsight GPU debugger configuration file 399 | *.nvuser 400 | 401 | # MFractors (Xamarin productivity tool) working folder 402 | .mfractor/ 403 | 404 | # Local History for Visual Studio 405 | .localhistory/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TinySvgHelper 2 | TinySvgHelper is a library that makes it easier to use svg images in your Xamarin.Forms app. 3 | 4 | ## Get started with TinySvgHelper 5 | The library is published to NuGet, https://www.nuget.org/packages/TinySvgHelper/ 6 | 7 | To install it, search for TinySvgHelper in the **Nuget Package Manager** or install it with the following command: 8 | ```powershell 9 | Install-Package TinySvgHelper 10 | ``` 11 | 12 | To use it you must add SvgHelper.Init() to your MainActivity and/or AppDelegate. 13 | 14 | ### MainActivity 15 | ```csharp 16 | protected override void OnCreate(Bundle savedInstanceState) 17 | { 18 | .... 19 | 20 | SvgHelper.Init(); 21 | 22 | ... 23 | } 24 | ``` 25 | 26 | ### AppDelegate 27 | ```csharp 28 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 29 | { 30 | ... 31 | 32 | SvgHelper.Init(); 33 | 34 | ... 35 | } 36 | ``` 37 | 38 | ## Use TinySvgHelper 39 | You can use TinySvgHelper either from your XAML- or C# code. For iOS add the svg files to the **Resources** folder and for Android add the svg files to the **Assets** folder. 40 | 41 | ### XAML 42 | First you need to import the namespace: 43 | ```xaml 44 | xmlns:svg="clr-namespace:TinySvgHelper;assembly=TinySvgHelper" 45 | ``` 46 | 47 | Then you will use it as a markup extension: 48 | ```xaml 49 | 50 | ``` 51 | 52 | You can also specify a color to it: 53 | ```xaml 54 | 55 | 56 | 57 | ``` 58 | 59 | ### C# 60 | ```csharp 61 | using TinySvgHelper; 62 | ``` 63 | 64 | ```csharp 65 | var image = new Image(); 66 | image.Source = SvgHelper.GetAsImageSource("info.svg", 50, 50, Color.Blue); 67 | ``` 68 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/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 you 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 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Assets/door.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Assets/info.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Android.App; 4 | using Android.Content.PM; 5 | using Android.Runtime; 6 | using Android.Views; 7 | using Android.Widget; 8 | using Android.OS; 9 | 10 | namespace TinySvgHelper.Sample.Droid 11 | { 12 | [Activity(Label = "TinySvgHelper.Sample", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 13 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 14 | { 15 | protected override void OnCreate(Bundle savedInstanceState) 16 | { 17 | TabLayoutResource = Resource.Layout.Tabbar; 18 | ToolbarResource = Resource.Layout.Toolbar; 19 | 20 | base.OnCreate(savedInstanceState); 21 | 22 | Xamarin.Essentials.Platform.Init(this, savedInstanceState); 23 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState); 24 | 25 | SvgHelper.Init(); 26 | 27 | LoadApplication(new App()); 28 | } 29 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) 30 | { 31 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 32 | 33 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("TinySvgHelper.Sample.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("TinySvgHelper.Sample.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | // Add some common permissions, these can be removed if not needed 33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 35 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/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.xml), 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-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/drawable/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/drawable/send.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/layout/Tabbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/layout/Toolbar.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-hdpi/icon.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xhdpi/icon.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxxhdpi/icon.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | 8 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.Android/TinySvgHelper.Sample.Android.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {1022FFDD-13BA-480D-94B6-683C8577DF35} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | {c9e5eea5-ca05-42a1-839b-61506e0a37df} 9 | Library 10 | TinySvgHelper.Sample.Droid 11 | TinySvgHelper.Sample.Android 12 | True 13 | Resources\Resource.designer.cs 14 | Resource 15 | Properties\AndroidManifest.xml 16 | Resources 17 | Assets 18 | v9.0 19 | true 20 | true 21 | Xamarin.Android.Net.AndroidClientHandler 22 | 23 | 24 | 25 | 26 | true 27 | portable 28 | false 29 | bin\Debug 30 | DEBUG; 31 | prompt 32 | 4 33 | None 34 | 35 | 36 | true 37 | portable 38 | true 39 | bin\Release 40 | prompt 41 | 4 42 | true 43 | false 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | {9d55118f-a1bb-4700-a937-35f99f3ccbe6} 90 | TinySvgHelper 91 | 92 | 93 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655} 94 | TinySvgHelper.Sample 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.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 TinySvgHelper.Sample.iOS 9 | { 10 | // The UIApplicationDelegate for the application. This class is responsible for launching the 11 | // User Interface of the application, as well as listening (and optionally responding) to 12 | // application events from iOS. 13 | [Register("AppDelegate")] 14 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 15 | { 16 | // 17 | // This method is invoked when the application has loaded and is ready to run. In this 18 | // method you should instantiate the window, load the UI into it and then make the window 19 | // visible. 20 | // 21 | // You have 17 seconds to return from this method, or iOS will terminate your application. 22 | // 23 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 24 | { 25 | global::Xamarin.Forms.Forms.Init(); 26 | 27 | SvgHelper.Init(); 28 | 29 | LoadApplication(new App()); 30 | 31 | return base.FinishedLaunching(app, options); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing", 109 | "filename": "Icon1024.png" 110 | } 111 | ], 112 | "properties": {}, 113 | "info": { 114 | "version": 1, 115 | "author": "xcode" 116 | } 117 | } -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | TinySvgHelper.Sample 27 | CFBundleIdentifier 28 | com.companyname.TinySvgHelper.Sample 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | TinySvgHelper.Sample 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | 38 | 39 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.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 TinySvgHelper.Sample.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 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TinySvgHelper.Sample.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TinySvgHelper.Sample.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/door.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/info.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyStuff/TinySvgHelper/cf32d41896b7317dcc166b492ede145f1251d0dd/Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/Resources/send.png -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.iOS/TinySvgHelper.Sample.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | 8.0.30703 7 | 2.0 8 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {6143fdea-f3c2-4a09-aafa-6e230626515e} 11 | Exe 12 | TinySvgHelper.Sample.iOS 13 | Resources 14 | TinySvgHelper.Sample.iOS 15 | true 16 | NSUrlSessionHandler 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\iPhoneSimulator\Debug 23 | DEBUG 24 | prompt 25 | 4 26 | x86_64 27 | None 28 | true 29 | 30 | 31 | none 32 | true 33 | bin\iPhoneSimulator\Release 34 | prompt 35 | 4 36 | None 37 | x86_64 38 | 39 | 40 | true 41 | full 42 | false 43 | bin\iPhone\Debug 44 | DEBUG 45 | prompt 46 | 4 47 | ARM64 48 | iPhone Developer 49 | true 50 | Entitlements.plist 51 | 52 | 53 | none 54 | true 55 | bin\iPhone\Release 56 | prompt 57 | 4 58 | ARM64 59 | iPhone Developer 60 | Entitlements.plist 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | false 73 | 74 | 75 | false 76 | 77 | 78 | false 79 | 80 | 81 | false 82 | 83 | 84 | false 85 | 86 | 87 | false 88 | 89 | 90 | false 91 | 92 | 93 | false 94 | 95 | 96 | false 97 | 98 | 99 | false 100 | 101 | 102 | false 103 | 104 | 105 | false 106 | 107 | 108 | false 109 | 110 | 111 | false 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | {9d55118f-a1bb-4700-a937-35f99f3ccbe6} 130 | TinySvgHelper 131 | 132 | 133 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655} 134 | TinySvgHelper.Sample 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/AboutView.xaml: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/AboutView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Xamarin.Forms; 8 | using Xamarin.Forms.Xaml; 9 | 10 | namespace TinySvgHelper.Sample 11 | { 12 | [XamlCompilation(XamlCompilationOptions.Compile)] 13 | public partial class AboutView : ContentPage 14 | { 15 | public AboutView() 16 | { 17 | InitializeComponent(); 18 | 19 | Icon.Source = TinySvgHelper.SvgHelper.GetAsImageSource("info.svg", 50, 50, Color.Blue); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using Xamarin.Forms.Xaml; 4 | 5 | namespace TinySvgHelper.Sample 6 | { 7 | public partial class App : Application 8 | { 9 | public App() 10 | { 11 | InitializeComponent(); 12 | 13 | MainPage = new MainShell(); 14 | } 15 | 16 | protected override void OnStart() 17 | { 18 | // Handle when your app starts 19 | } 20 | 21 | protected override void OnSleep() 22 | { 23 | // Handle when your app sleeps 24 | } 25 | 26 | protected override void OnResume() 27 | { 28 | // Handle when your app resumes 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms.Xaml; 2 | 3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/MainShell.xaml: -------------------------------------------------------------------------------- 1 |  2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/MainShell.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Xamarin.Forms; 8 | using Xamarin.Forms.Xaml; 9 | 10 | namespace TinySvgHelper.Sample 11 | { 12 | [XamlCompilation(XamlCompilationOptions.Compile)] 13 | public partial class MainShell 14 | { 15 | public MainShell() 16 | { 17 | InitializeComponent(); 18 | 19 | 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/StartView.xaml: -------------------------------------------------------------------------------- 1 |  2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/StartView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Xamarin.Forms; 8 | using Xamarin.Forms.Xaml; 9 | 10 | namespace TinySvgHelper.Sample 11 | { 12 | [XamlCompilation(XamlCompilationOptions.Compile)] 13 | public partial class StartView : ContentPage 14 | { 15 | public StartView() 16 | { 17 | InitializeComponent(); 18 | 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Sample/TinySvgHelper.Sample/TinySvgHelper.Sample/TinySvgHelper.Sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | pdbonly 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | MSBuild:UpdateDesignTimeXaml 24 | 25 | 26 | MSBuild:UpdateDesignTimeXaml 27 | 28 | 29 | MSBuild:UpdateDesignTimeXaml 30 | 31 | 32 | -------------------------------------------------------------------------------- /TinySvgHelper.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 16 3 | VisualStudioVersion = 16.0.29201.188 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinySvgHelper", "TinySvgHelper\TinySvgHelper.csproj", "{9D55118F-A1BB-4700-A937-35F99F3CCBE6}" 6 | EndProject 7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinySvgHelper.Sample.Android", "Sample\TinySvgHelper.Sample\TinySvgHelper.Sample.Android\TinySvgHelper.Sample.Android.csproj", "{1022FFDD-13BA-480D-94B6-683C8577DF35}" 8 | EndProject 9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinySvgHelper.Sample.iOS", "Sample\TinySvgHelper.Sample\TinySvgHelper.Sample.iOS\TinySvgHelper.Sample.iOS.csproj", "{0135B5B9-1A02-4846-9FC3-43ED06BA309F}" 10 | EndProject 11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinySvgHelper.Sample", "Sample\TinySvgHelper.Sample\TinySvgHelper.Sample\TinySvgHelper.Sample.csproj", "{8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}" 12 | EndProject 13 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{A9599736-1610-4EA8-B56E-58FD3DDDB5A4}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Debug|iPhone = Debug|iPhone 19 | Debug|iPhoneSimulator = Debug|iPhoneSimulator 20 | Release|Any CPU = Release|Any CPU 21 | Release|iPhone = Release|iPhone 22 | Release|iPhoneSimulator = Release|iPhoneSimulator 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Debug|iPhone.ActiveCfg = Debug|Any CPU 28 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Debug|iPhone.Build.0 = Debug|Any CPU 29 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 30 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 31 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Release|iPhone.ActiveCfg = Release|Any CPU 34 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Release|iPhone.Build.0 = Release|Any CPU 35 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 36 | {9D55118F-A1BB-4700-A937-35F99F3CCBE6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 37 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 40 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|iPhone.ActiveCfg = Debug|Any CPU 41 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|iPhone.Build.0 = Debug|Any CPU 42 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|iPhone.Deploy.0 = Debug|Any CPU 43 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 44 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 45 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU 46 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|Any CPU.Build.0 = Release|Any CPU 48 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|Any CPU.Deploy.0 = Release|Any CPU 49 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|iPhone.ActiveCfg = Release|Any CPU 50 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|iPhone.Build.0 = Release|Any CPU 51 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|iPhone.Deploy.0 = Release|Any CPU 52 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 53 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 54 | {1022FFDD-13BA-480D-94B6-683C8577DF35}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU 55 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Debug|Any CPU.ActiveCfg = Debug|iPhone 56 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Debug|iPhone.ActiveCfg = Debug|iPhone 57 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Debug|iPhone.Build.0 = Debug|iPhone 58 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 59 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 60 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Release|Any CPU.ActiveCfg = Release|iPhone 61 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Release|iPhone.ActiveCfg = Release|iPhone 62 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Release|iPhone.Build.0 = Release|iPhone 63 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 64 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 65 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 66 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Debug|Any CPU.Build.0 = Debug|Any CPU 67 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Debug|iPhone.ActiveCfg = Debug|Any CPU 68 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Debug|iPhone.Build.0 = Debug|Any CPU 69 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 70 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 71 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Release|Any CPU.ActiveCfg = Release|Any CPU 72 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Release|Any CPU.Build.0 = Release|Any CPU 73 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Release|iPhone.ActiveCfg = Release|Any CPU 74 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Release|iPhone.Build.0 = Release|Any CPU 75 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 76 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(NestedProjects) = preSolution 82 | {1022FFDD-13BA-480D-94B6-683C8577DF35} = {A9599736-1610-4EA8-B56E-58FD3DDDB5A4} 83 | {0135B5B9-1A02-4846-9FC3-43ED06BA309F} = {A9599736-1610-4EA8-B56E-58FD3DDDB5A4} 84 | {8F1B0CD5-6E2D-4059-A5F2-DAA11516A655} = {A9599736-1610-4EA8-B56E-58FD3DDDB5A4} 85 | EndGlobalSection 86 | GlobalSection(ExtensibilityGlobals) = postSolution 87 | SolutionGuid = {9ED43799-64C7-4F63-A5F9-C1253D6F4FE1} 88 | EndGlobalSection 89 | EndGlobal 90 | -------------------------------------------------------------------------------- /TinySvgHelper/IPlatformHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SkiaSharp.Extended.Svg; 3 | 4 | namespace TinySvgHelper 5 | { 6 | internal interface IPlatformHelper 7 | { 8 | SKSvg Load(string svgImage); 9 | int GetScaleFactor(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /TinySvgHelper/PlatformHelper.android.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Android.App; 4 | using SkiaSharp.Extended.Svg; 5 | 6 | namespace TinySvgHelper 7 | { 8 | internal class PlatformHelper : IPlatformHelper 9 | { 10 | 11 | public SKSvg Load(string svgImage) 12 | { 13 | try 14 | { 15 | var svg = new SkiaSharp.Extended.Svg.SKSvg(); 16 | Stream asset = null; 17 | 18 | try 19 | { 20 | asset = Application.Context.Assets.Open(svgImage); 21 | } 22 | catch (Exception) 23 | { 24 | throw new Exception($"SVG-file, {svgImage} cannot be foundin the Asset folder."); 25 | } 26 | 27 | svg.Load(asset); 28 | 29 | return svg; 30 | } 31 | catch(Exception) 32 | { 33 | throw new Exception($"SVG-file, {svgImage} is not supported by SkiaSharp.Svg."); 34 | } 35 | 36 | 37 | } 38 | 39 | public int GetScaleFactor() 40 | { 41 | return (int)Application.Context.Resources.DisplayMetrics.Density; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /TinySvgHelper/PlatformHelper.ios.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SkiaSharp.Extended.Svg; 3 | using UIKit; 4 | 5 | namespace TinySvgHelper 6 | { 7 | internal class PlatformHelper : IPlatformHelper 8 | { 9 | public SKSvg Load(string svgImage) 10 | { 11 | var svg = new SkiaSharp.Extended.Svg.SKSvg(); 12 | 13 | svg.Load(svgImage); 14 | 15 | return svg; 16 | } 17 | 18 | public int GetScaleFactor() 19 | { 20 | return (int)UIScreen.MainScreen.Scale; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /TinySvgHelper/SvgExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using Xamarin.Forms.Xaml; 4 | 5 | namespace TinySvgHelper 6 | { 7 | public class SvgExtension : IMarkupExtension 8 | { 9 | public object ProvideValue(IServiceProvider serviceProvider) 10 | { 11 | var source = SvgHelper.GetAsImageSource(FileName, Width, Height, Color); 12 | 13 | return source; 14 | } 15 | 16 | public string FileName { get; set; } 17 | public float Width { get; set; } 18 | public float Height { get; set; } 19 | public Color Color { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /TinySvgHelper/SvgHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using SkiaSharp; 4 | using SkiaSharp.Views.Forms; 5 | using Xamarin.Forms; 6 | 7 | namespace TinySvgHelper 8 | { 9 | public class SvgHelper 10 | { 11 | internal static IPlatformHelper PlatformHelper {get;set;} 12 | 13 | public static void Init() 14 | { 15 | #if __IOS__ || __ANDROID__ 16 | PlatformHelper = new PlatformHelper(); 17 | #endif 18 | } 19 | 20 | public static ImageSource GetAsImageSource(string svgImage, float width, float height, Color color) 21 | { 22 | var scaleFactor = PlatformHelper.GetScaleFactor(); 23 | 24 | SkiaSharp.Extended.Svg.SKSvg svg = PlatformHelper.Load(svgImage); 25 | 26 | var svgSize = svg.Picture.CullRect; 27 | var svgMax = Math.Max(svgSize.Width, svgSize.Height); 28 | 29 | var canvasMin = Math.Min((int)(width * scaleFactor), (int)(height * scaleFactor)); 30 | var scale = canvasMin / svgMax; 31 | var matrix = SKMatrix.MakeScale(scale, scale); 32 | 33 | var bitmap = new SKBitmap((int)(width * scaleFactor), (int)(height * scaleFactor)); 34 | 35 | var canvas = new SKCanvas(bitmap); 36 | canvas.Clear(); 37 | 38 | if (color != Color.Default) 39 | { 40 | var paint = new SKPaint() 41 | { 42 | ColorFilter = SKColorFilter.CreateBlendMode(color.ToSKColor(), SKBlendMode.SrcIn) 43 | }; 44 | 45 | canvas.DrawPicture(svg.Picture, ref matrix, paint); 46 | } 47 | else 48 | { 49 | canvas.DrawPicture(svg.Picture, ref matrix); 50 | } 51 | 52 | var image = SKImage.FromBitmap(bitmap); 53 | 54 | var encoded = image.Encode(); 55 | 56 | var stream = encoded.AsStream(); 57 | var bytes = ReadFully(stream); 58 | 59 | var source = ImageSource.FromStream(() => new MemoryStream(bytes)); 60 | 61 | return source; 62 | 63 | } 64 | 65 | private static byte[] ReadFully(Stream input) 66 | { 67 | byte[] buffer = new byte[16 * 1024]; 68 | using (MemoryStream ms = new MemoryStream()) 69 | { 70 | int read; 71 | while ((read = input.Read(buffer, 0, buffer.Length)) > 0) 72 | { 73 | ms.Write(buffer, 0, read); 74 | } 75 | return ms.ToArray(); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /TinySvgHelper/TinySvgHelper.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0;Xamarin.iOS10;MonoAndroid90;MonoAndroid10.0 5 | TinySvgHelper 6 | TinySvgHelper 7 | 1.0.0 8 | TinySvgHelper is a library that helps you using SVG images in a Xamarin.Forms app. 9 | Daniel Hindrikes 10 | TinyStuff 11 | https://github.com/TinyStuff/TinySvgHelper 12 | https://github.com/TinyStuff/TinySvgHelper 13 | MIT 14 | https://avatars2.githubusercontent.com/u/34911293 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | name: '1.0' 2 | 3 | trigger: 4 | - master 5 | 6 | pool: 7 | vmImage: 'macos-latest' 8 | 9 | steps: 10 | - task: NuGetToolInstaller@1 11 | inputs: 12 | versionSpec: '4.5' 13 | 14 | - task: NuGetCommand@2 15 | inputs: 16 | command: 'restore' 17 | restoreSolution: '**/*.sln' 18 | feedsToUse: 'select' 19 | 20 | - task: MSBuild@1 21 | inputs: 22 | solution: '**/TinySvgHelper.csproj' 23 | configuration: 'Release' 24 | msbuildArguments: '/t:pack /p:PackageVersion=$(Build.BuildNumber).$(Build.BuildId)' 25 | 26 | - task: CopyFiles@2 27 | inputs: 28 | Contents: '**/*nupkg' 29 | TargetFolder: '$(build.artifactstagingdirectory)' 30 | 31 | - task: PublishBuildArtifacts@1 32 | inputs: 33 | PathtoPublish: '$(Build.ArtifactStagingDirectory)' 34 | ArtifactName: 'packages' 35 | publishLocation: 'Container' --------------------------------------------------------------------------------