Skip to content

NGraphics.Plugin.Autodetect is to enable autodection of the platform from a PCL project (i.e enable NGraphics usage directly within a Xamarin Forms PCL project)

License

Notifications You must be signed in to change notification settings

chrisadol/NGraphics.Plugin.Autodetect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NGraphics.Plugin.Autodetect

NGraphics.Plugin.Autodetect is to enable autodection of the platform from a PCL project (i.e. to enable NGraphics usage directly within a Xamarin Forms Portable/PCL project).

Disclaimer

This plugin is NOT in any way affiliated with the actual NGraphics creators, so if this plugin does not work then it is not their fault!

Installation

You can install the NGraphics.Plugin.Autodetect from nuget.

Ensure you install it in all projects where you want the code to work, even though you will be writing code in the main Xamarin.Forms app.

Usage

The only feature in NGrpahics.Plugin.Autodetect is AutodetectNGraphicsPlatform.AutodetectCurrent which can be called directly from within Xamarin Forms Portable app code.

In your Xamarin Forms Portable app add the following using statements:

using NGraphics;
using NGraphics.Plugin.Autodetect;

Next, again in your Xamarin Forms Portable app, call AutodetectNGraphicsPlatform.AutodetectCurrent as follows:

var size = new NGraphics.Size(1000, 1000);
var canvas = AutodetectNGraphicsPlatform.AutodetectCurrent.CreateImageCanvas(size, scale: 2);

var skyBrush = new LinearGradientBrush(Point.Zero, Point.OneY, Colors.Blue, Colors.White);
canvas.FillRectangle(new Rect(canvas.Size), skyBrush);
//refer to NGraphics documentation on how to use NGraphics itself
canvas.GetImage().SaveAsPng(GetPath("Example1.png"));

Note that the actual NGraphics documentation can be found here.

About

NGraphics.Plugin.Autodetect is to enable autodection of the platform from a PCL project (i.e enable NGraphics usage directly within a Xamarin Forms PCL project)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages