The Forms demo uses the new NuGet for iOS/Android

This commit is contained in:
Matthew Leibowitz 2016-09-15 09:31:22 +02:00
Родитель d43d5919f4
Коммит 5858c9c404
14 изменённых файлов: 185 добавлений и 341 удалений

Просмотреть файл

@ -1,53 +0,0 @@
using System;
using Android.Views;
using Android.Graphics;
using SkiaSharp;
namespace Skia.Forms.Demo.Droid
{
public class NativeSkiaView : View
{
private Bitmap bitmap;
readonly SkiaView skiaView;
readonly ISkiaViewController iskiaView;
public NativeSkiaView (Android.Content.Context context, SkiaView skiaView) : base (context)
{
this.skiaView = skiaView;
this.iskiaView = skiaView;
this.Click += OnTapped;
}
protected override void OnDraw (Android.Graphics.Canvas canvas)
{
base.OnDraw (canvas);
if (bitmap == null || bitmap.Width != canvas.Width || bitmap.Height != canvas.Height) {
if (bitmap != null)
bitmap.Dispose ();
bitmap = Bitmap.CreateBitmap (canvas.Width, canvas.Height, Bitmap.Config.Argb8888);
}
try
{
using (var surface = SKSurface.Create (canvas.Width, canvas.Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul, bitmap.LockPixels (), canvas.Width * 4)) {
var skcanvas = surface.Canvas;
skcanvas.Scale (((float)canvas.Width)/(float)skiaView.Width, ((float)canvas.Height)/(float)skiaView.Height);
iskiaView.SendDraw (skcanvas);
}
}
finally {
bitmap.UnlockPixels ();
}
canvas.DrawBitmap (bitmap, 0, 0, null);
}
void OnTapped(object sender, EventArgs e)
{
iskiaView.SendTap ();
}
}
}

Просмотреть файл

@ -1,15 +1,15 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Mono Runtime Version: 4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
[assembly: global::Android.Runtime.ResourceDesignerAttribute("Skia.Forms.Demo.Droid.Resource", IsApplication=true)]
[assembly: Android.Runtime.ResourceDesignerAttribute("Skia.Forms.Demo.Droid.Resource", IsApplication=true)]
namespace Skia.Forms.Demo.Droid
{
@ -4196,7 +4196,8 @@ namespace Skia.Forms.Demo.Droid
public partial class Styleable
{
public static int[] ActionBar = new int[] {
public static int[] ActionBar = new int[]
{
2130772007,
2130772009,
2130772010,
@ -4306,13 +4307,15 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 5
public const int ActionBar_titleTextStyle = 5;
public static int[] ActionBarLayout = new int[] {
public static int[] ActionBarLayout = new int[]
{
16842931};
// aapt resource value: 0
public const int ActionBarLayout_android_layout_gravity = 0;
public static int[] ActionMenuItemView = new int[] {
public static int[] ActionMenuItemView = new int[]
{
16843071};
// aapt resource value: 0
@ -4320,7 +4323,8 @@ namespace Skia.Forms.Demo.Droid
public static int[] ActionMenuView;
public static int[] ActionMode = new int[] {
public static int[] ActionMode = new int[]
{
2130772007,
2130772013,
2130772014,
@ -4346,7 +4350,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int ActionMode_titleTextStyle = 1;
public static int[] ActivityChooserView = new int[] {
public static int[] ActivityChooserView = new int[]
{
2130772035,
2130772036};
@ -4356,7 +4361,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 0
public const int ActivityChooserView_initialActivityCount = 0;
public static int[] AlertDialog = new int[] {
public static int[] AlertDialog = new int[]
{
16842994,
2130772037,
2130772038,
@ -4382,7 +4388,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 4
public const int AlertDialog_singleChoiceItemLayout = 4;
public static int[] AppBarLayout = new int[] {
public static int[] AppBarLayout = new int[]
{
16842964,
2130772032,
2130772215};
@ -4396,7 +4403,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int AppBarLayout_expanded = 2;
public static int[] AppBarLayout_LayoutParams = new int[] {
public static int[] AppBarLayout_LayoutParams = new int[]
{
2130772216,
2130772217};
@ -4406,7 +4414,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int AppBarLayout_LayoutParams_layout_scrollInterpolator = 1;
public static int[] AppCompatImageView = new int[] {
public static int[] AppCompatImageView = new int[]
{
16843033,
2130772042};
@ -4416,7 +4425,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int AppCompatImageView_srcCompat = 1;
public static int[] AppCompatTextView = new int[] {
public static int[] AppCompatTextView = new int[]
{
16842804,
2130772043};
@ -4426,7 +4436,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int AppCompatTextView_textAllCaps = 1;
public static int[] AppCompatTheme = new int[] {
public static int[] AppCompatTheme = new int[]
{
16842839,
16842926,
2130772044,
@ -4876,7 +4887,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 3
public const int AppCompatTheme_windowNoTitle = 3;
public static int[] BottomSheetBehavior_Params = new int[] {
public static int[] BottomSheetBehavior_Params = new int[]
{
2130772218,
2130772219};
@ -4886,13 +4898,15 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 0
public const int BottomSheetBehavior_Params_behavior_peekHeight = 0;
public static int[] ButtonBarLayout = new int[] {
public static int[] ButtonBarLayout = new int[]
{
2130772154};
// aapt resource value: 0
public const int ButtonBarLayout_allowStacking = 0;
public static int[] CardView = new int[] {
public static int[] CardView = new int[]
{
16843071,
16843072,
2130771995,
@ -4946,7 +4960,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 11
public const int CardView_contentPaddingTop = 11;
public static int[] CollapsingAppBarLayout_LayoutParams = new int[] {
public static int[] CollapsingAppBarLayout_LayoutParams = new int[]
{
2130772220,
2130772221};
@ -4956,7 +4971,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int CollapsingAppBarLayout_LayoutParams_layout_collapseParallaxMultiplier = 1;
public static int[] CollapsingToolbarLayout = new int[] {
public static int[] CollapsingToolbarLayout = new int[]
{
2130772009,
2130772222,
2130772223,
@ -5014,7 +5030,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 10
public const int CollapsingToolbarLayout_toolbarId = 10;
public static int[] CompoundButton = new int[] {
public static int[] CompoundButton = new int[]
{
16843015,
2130772155,
2130772156};
@ -5028,7 +5045,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int CompoundButton_buttonTintMode = 2;
public static int[] CoordinatorLayout = new int[] {
public static int[] CoordinatorLayout = new int[]
{
2130772235,
2130772236};
@ -5038,7 +5056,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int CoordinatorLayout_statusBarBackground = 1;
public static int[] CoordinatorLayout_LayoutParams = new int[] {
public static int[] CoordinatorLayout_LayoutParams = new int[]
{
16842931,
2130772237,
2130772238,
@ -5060,7 +5079,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 3
public const int CoordinatorLayout_LayoutParams_layout_keyline = 3;
public static int[] DesignTheme = new int[] {
public static int[] DesignTheme = new int[]
{
2130772241,
2130772242,
2130772243};
@ -5074,7 +5094,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int DesignTheme_textColorError = 2;
public static int[] DrawerArrowToggle = new int[] {
public static int[] DrawerArrowToggle = new int[]
{
2130772157,
2130772158,
2130772159,
@ -5108,7 +5129,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 7
public const int DrawerArrowToggle_thickness = 7;
public static int[] FloatingActionButton = new int[] {
public static int[] FloatingActionButton = new int[]
{
2130772032,
2130772213,
2130772214,
@ -5142,7 +5164,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 7
public const int FloatingActionButton_useCompatPadding = 7;
public static int[] ForegroundLinearLayout = new int[] {
public static int[] ForegroundLinearLayout = new int[]
{
16843017,
16843264,
2130772249};
@ -5156,7 +5179,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int ForegroundLinearLayout_foregroundInsidePadding = 2;
public static int[] LinearLayoutCompat = new int[] {
public static int[] LinearLayoutCompat = new int[]
{
16842927,
16842948,
16843046,
@ -5194,7 +5218,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 7
public const int LinearLayoutCompat_showDividers = 7;
public static int[] LinearLayoutCompat_Layout = new int[] {
public static int[] LinearLayoutCompat_Layout = new int[]
{
16842931,
16842996,
16842997,
@ -5212,7 +5237,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int LinearLayoutCompat_Layout_android_layout_width = 1;
public static int[] ListPopupWindow = new int[] {
public static int[] ListPopupWindow = new int[]
{
16843436,
16843437};
@ -5222,7 +5248,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int ListPopupWindow_android_dropDownVerticalOffset = 1;
public static int[] MediaRouteButton = new int[] {
public static int[] MediaRouteButton = new int[]
{
16843071,
16843072,
2130771994};
@ -5236,7 +5263,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int MediaRouteButton_externalRouteEnabledDrawable = 2;
public static int[] MenuGroup = new int[] {
public static int[] MenuGroup = new int[]
{
16842766,
16842960,
16843156,
@ -5262,7 +5290,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int MenuGroup_android_visible = 2;
public static int[] MenuItem = new int[] {
public static int[] MenuItem = new int[]
{
16842754,
16842766,
16842960,
@ -5332,7 +5361,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 13
public const int MenuItem_showAsAction = 13;
public static int[] MenuView = new int[] {
public static int[] MenuView = new int[]
{
16842926,
16843052,
16843053,
@ -5366,7 +5396,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 7
public const int MenuView_preserveIconSpacing = 7;
public static int[] NavigationView = new int[] {
public static int[] NavigationView = new int[]
{
16842964,
16842973,
16843039,
@ -5408,7 +5439,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 4
public const int NavigationView_menu = 4;
public static int[] PopupWindow = new int[] {
public static int[] PopupWindow = new int[]
{
16843126,
2130772173};
@ -5418,13 +5450,15 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 1
public const int PopupWindow_overlapAnchor = 1;
public static int[] PopupWindowBackgroundState = new int[] {
public static int[] PopupWindowBackgroundState = new int[]
{
2130772174};
// aapt resource value: 0
public const int PopupWindowBackgroundState_state_above_anchor = 0;
public static int[] RecyclerView = new int[] {
public static int[] RecyclerView = new int[]
{
16842948,
2130771968,
2130771969,
@ -5446,19 +5480,22 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 4
public const int RecyclerView_stackFromEnd = 4;
public static int[] ScrimInsetsFrameLayout = new int[] {
public static int[] ScrimInsetsFrameLayout = new int[]
{
2130772256};
// aapt resource value: 0
public const int ScrimInsetsFrameLayout_insetForeground = 0;
public static int[] ScrollingViewBehavior_Params = new int[] {
public static int[] ScrollingViewBehavior_Params = new int[]
{
2130772257};
// aapt resource value: 0
public const int ScrollingViewBehavior_Params_behavior_overlapTop = 0;
public static int[] SearchView = new int[] {
public static int[] SearchView = new int[]
{
16842970,
16843039,
16843296,
@ -5528,7 +5565,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 12
public const int SearchView_voiceIcon = 12;
public static int[] SnackbarLayout = new int[] {
public static int[] SnackbarLayout = new int[]
{
16843039,
2130772032,
2130772258};
@ -5542,7 +5580,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int SnackbarLayout_maxActionInlineWidth = 2;
public static int[] Spinner = new int[] {
public static int[] Spinner = new int[]
{
16842930,
16843126,
16843131,
@ -5564,7 +5603,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 4
public const int Spinner_popupTheme = 4;
public static int[] SwitchCompat = new int[] {
public static int[] SwitchCompat = new int[]
{
16843044,
16843045,
16843074,
@ -5606,7 +5646,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 3
public const int SwitchCompat_track = 3;
public static int[] TabItem = new int[] {
public static int[] TabItem = new int[]
{
16842754,
16842994,
16843087};
@ -5620,7 +5661,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int TabItem_android_text = 2;
public static int[] TabLayout = new int[] {
public static int[] TabLayout = new int[]
{
2130772259,
2130772260,
2130772261,
@ -5686,7 +5728,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 9
public const int TabLayout_tabTextColor = 9;
public static int[] TextAppearance = new int[] {
public static int[] TextAppearance = new int[]
{
16842901,
16842902,
16842903,
@ -5724,7 +5767,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 8
public const int TextAppearance_textAllCaps = 8;
public static int[] TextInputLayout = new int[] {
public static int[] TextInputLayout = new int[]
{
16842906,
16843088,
2130772275,
@ -5770,7 +5814,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int TextInputLayout_hintTextAppearance = 2;
public static int[] Toolbar = new int[] {
public static int[] Toolbar = new int[]
{
16842927,
16843072,
2130772009,
@ -5872,7 +5917,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 23
public const int Toolbar_titleTextColor = 23;
public static int[] View = new int[] {
public static int[] View = new int[]
{
16842752,
16842970,
2130772210,
@ -5894,7 +5940,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 4
public const int View_theme = 4;
public static int[] ViewBackgroundHelper = new int[] {
public static int[] ViewBackgroundHelper = new int[]
{
16842964,
2130772213,
2130772214};
@ -5908,7 +5955,8 @@ namespace Skia.Forms.Demo.Droid
// aapt resource value: 2
public const int ViewBackgroundHelper_backgroundTintMode = 2;
public static int[] ViewStubCompat = new int[] {
public static int[] ViewStubCompat = new int[]
{
16842960,
16842994,
16842995};

Просмотреть файл

@ -46,10 +46,6 @@
<EnableProguard>true</EnableProguard>
</PropertyGroup>
<ItemGroup>
<Reference Include="FormsViewGroup, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SkiaSharp">
<HintPath>..\packages\SkiaSharp.1.54.0.1\lib\MonoAndroid\SkiaSharp.dll</HintPath>
<Private>True</Private>
@ -90,21 +86,26 @@
<HintPath>..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="SkiaSharp.Views.Android">
<HintPath>..\packages\SkiaSharp.Views.1.54.0.1-beta1\lib\MonoAndroid\SkiaSharp.Views.Android.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
<Private>True</Private>
<Reference Include="FormsViewGroup">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.Android, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
<Private>True</Private>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
<Private>True</Private>
<Reference Include="Xamarin.Forms.Platform.Android">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp.Views.Forms">
<HintPath>..\packages\SkiaSharp.Views.Forms.1.54.0.1-beta1\lib\MonoAndroid\SkiaSharp.Views.Forms.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -117,8 +118,6 @@
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NativeSkiaView.cs" />
<Compile Include="SkiaViewRenderer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
@ -156,7 +155,6 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets'))" />
<Error Condition="!Exists('..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Import Project="..\packages\Xamarin.Forms.2.3.0.49\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.0.49\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
</Project>

Просмотреть файл

@ -1,28 +0,0 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer (typeof(Skia.Forms.Demo.SkiaView), typeof(Skia.Forms.Demo.Droid.SkiaViewRenderer))]
namespace Skia.Forms.Demo.Droid
{
public class SkiaViewRenderer : ViewRenderer<SkiaView, NativeSkiaView>
{
NativeSkiaView view;
public SkiaViewRenderer ()
{
}
protected override void OnElementChanged (ElementChangedEventArgs<SkiaView> e)
{
base.OnElementChanged (e);
if (Control == null) {
view = new NativeSkiaView (Context, Element);
SetNativeControl (view);
}
}
}
}

Просмотреть файл

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SkiaSharp" version="1.54.0.1" targetFramework="monoandroid60" />
<package id="SkiaSharp.Views" version="1.54.0.1-beta1" targetFramework="monoandroid60" />
<package id="SkiaSharp.Views.Forms" version="1.54.0.1-beta1" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
@ -9,5 +11,5 @@
<package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Forms" version="2.3.0.46-pre3" targetFramework="monoandroid60" />
<package id="Xamarin.Forms" version="2.3.0.49" targetFramework="monoandroid60" />
</packages>

Просмотреть файл

@ -1,13 +0,0 @@
using System;
using Xamarin.Forms;
using SkiaSharp;
namespace Skia.Forms.Demo
{
public interface ISkiaViewController : IViewController
{
void SendDraw (SKCanvas canvas);
void SendTap ();
}
}

Просмотреть файл

@ -3,6 +3,8 @@ using System.Linq;
using Xamarin.Forms;
using SkiaSharp;
using SkiaSharp.Views.Forms;
using SkiaSharp.Views;
namespace Skia.Forms.Demo
{
@ -53,6 +55,8 @@ namespace Skia.Forms.Demo
public class DetailsPage : ContentPage
{
private Demos.Sample sample;
public DetailsPage(string demo)
{
SetDemo(demo);
@ -61,7 +65,26 @@ namespace Skia.Forms.Demo
public void SetDemo(string demo)
{
Title = demo;
Content = new SkiaView(Demos.GetSample(demo));
sample = Demos.GetSample(demo);
var tap = new TapGestureRecognizer();
tap.Command = new Command(OnTap);
var view = new SKView();
view.PaintSurface += OnPaintSurface;
view.GestureRecognizers.Add(tap);
Content = view;
}
private void OnTap()
{
sample?.TapMethod?.Invoke();
}
private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
sample?.Method?.Invoke(e.Surface.Canvas, e.Info.Width, e.Info.Height);
}
}

Просмотреть файл

@ -36,24 +36,22 @@
<HintPath>packages\SkiaSharp.1.54.0.1\lib\portable-net45+xamarinmac+xamarinios+monotouch+monoandroid+win8+wpa81+wp8+xamarin.watchos+xamarin.tvos\SkiaSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Xamarin.Forms.2.3.0.46-pre3\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="Xamarin.Forms.Core">
<HintPath>packages\Xamarin.Forms.2.3.0.49\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Xamarin.Forms.2.3.0.46-pre3\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
<Private>True</Private>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>packages\Xamarin.Forms.2.3.0.49\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Xamarin.Forms.2.3.0.46-pre3\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
<Private>True</Private>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>packages\Xamarin.Forms.2.3.0.49\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp.Views.Forms">
<HintPath>packages\SkiaSharp.Views.Forms.1.54.0.1-beta1\lib\portable-net45+xamarinmac+xamarinios+monotouch+monoandroid+win8+wpa81+wp8+xamarin.watchos+xamarin.tvos\SkiaSharp.Views.Forms.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Skia.Forms.Demo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ISkiaViewController.cs" />
<Compile Include="SkiaView.cs" />
<Compile Include="..\SharedDemo\SkiaSharp.Demos.cs">
<Link>SkiaSharp.Demos.cs</Link>
</Compile>
@ -80,11 +78,5 @@
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="packages\Xamarin.Forms.2.1.0.6529\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('packages\Xamarin.Forms.2.1.0.6529\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Import Project="packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
</Target>
<Import Project="packages\Xamarin.Forms.2.3.0.49\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('packages\Xamarin.Forms.2.3.0.49\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
</Project>

Просмотреть файл

@ -1,32 +0,0 @@
using System;
using Xamarin.Forms;
using SkiaSharp;
namespace Skia.Forms.Demo
{
public class SkiaView : View, ISkiaViewController
{
Demos.Sample sample;
public SkiaView (Demos.Sample sample)
{
this.sample = sample;
}
void ISkiaViewController.SendDraw (SKCanvas canvas)
{
Draw (canvas);
}
void ISkiaViewController.SendTap ()
{
sample?.TapMethod?.Invoke ();
}
protected virtual void Draw (SKCanvas canvas)
{
sample?.Method?.Invoke (canvas, (int)Width, (int)Height);
}
}
}

Просмотреть файл

@ -1,66 +0,0 @@
using System;
using CoreGraphics;
using UIKit;
using SkiaSharp;
namespace Skia.Forms.Demo.iOS
{
public class NativeSkiaView: UIView
{
const int bitmapInfo = ((int)CGBitmapFlags.ByteOrder32Big) | ((int)CGImageAlphaInfo.PremultipliedLast);
ISkiaViewController skiaView;
public NativeSkiaView (SkiaView skiaView)
{
this.skiaView = skiaView;
AddGestureRecognizer (new UITapGestureRecognizer (OnTapped));
}
public override void Draw (CGRect rect)
{
base.Draw (rect);
var screenScale = UIScreen.MainScreen.Scale;
var width = (int)(Bounds.Width * screenScale);
var height = (int)(Bounds.Height * screenScale);
IntPtr buff = System.Runtime.InteropServices.Marshal.AllocCoTaskMem (width * height * 4);
try {
using (var surface = SKSurface.Create (width, height, SKImageInfo.PlatformColorType, SKAlphaType.Premul, buff, width * 4)) {
var skcanvas = surface.Canvas;
skcanvas.Scale ((float)screenScale, (float)screenScale);
using (new SKAutoCanvasRestore (skcanvas, true)) {
skiaView.SendDraw (skcanvas);
}
}
using (var colorSpace = CGColorSpace.CreateDeviceRGB ())
using (var bContext = new CGBitmapContext (buff, width, height, 8, width * 4, colorSpace, (CGImageAlphaInfo)bitmapInfo))
using (var image = bContext.ToImage ())
using (var context = UIGraphics.GetCurrentContext ()) {
// flip the image for CGContext.DrawImage
context.TranslateCTM (0, Frame.Height);
context.ScaleCTM (1, -1);
context.DrawImage (Bounds, image);
}
} finally {
if (buff != IntPtr.Zero)
System.Runtime.InteropServices.Marshal.FreeCoTaskMem (buff);
}
}
void OnTapped ()
{
skiaView.SendTap ();
}
public override void LayoutSubviews ()
{
base.LayoutSubviews ();
SetNeedsDisplay ();
}
}
}

Просмотреть файл

@ -86,23 +86,25 @@
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.Forms.2.3.0.46-pre3\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xamarin.iOS" />
<Reference Include="SkiaSharp.Views.iOS">
<HintPath>..\packages\SkiaSharp.Views.1.54.0.1-beta1\lib\XamariniOS\SkiaSharp.Views.iOS.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.iOS">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.3.0.49\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="SkiaSharp.Views.Forms">
<HintPath>..\packages\SkiaSharp.Views.Forms.1.54.0.1-beta1\lib\XamariniOS\SkiaSharp.Views.Forms.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Skia.Forms.Demo.csproj">
@ -128,8 +130,6 @@
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="NativeSkiaView.cs" />
<Compile Include="SkiaViewRenderer.cs" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="..\..\SharedDemo\content-font.ttf">
@ -143,11 +143,5 @@
<BundleResource Include="Resources\hamburger%402x.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.2.3.0.46-pre3\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
</Target>
<Import Project="..\packages\Xamarin.Forms.2.3.0.49\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.0.49\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
</Project>

Просмотреть файл

@ -1,24 +0,0 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer (typeof(Skia.Forms.Demo.SkiaView), typeof(Skia.Forms.Demo.iOS.SkiaViewRenderer))]
namespace Skia.Forms.Demo.iOS
{
public class SkiaViewRenderer: ViewRenderer<SkiaView, NativeSkiaView>
{
public SkiaViewRenderer ()
{
}
protected override void OnElementChanged (ElementChangedEventArgs<SkiaView> e)
{
base.OnElementChanged (e);
if (Control == null)
SetNativeControl (new NativeSkiaView (Element));
}
}
}

Просмотреть файл

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SkiaSharp" version="1.54.0.1" targetFramework="xamarinios10" />
<package id="Xamarin.Forms" version="2.3.0.46-pre3" targetFramework="xamarinios10" />
<package id="SkiaSharp.Views" version="1.54.0.1-beta1" targetFramework="xamarinios10" />
<package id="SkiaSharp.Views.Forms" version="1.54.0.1-beta1" targetFramework="xamarinios10" />
<package id="Xamarin.Forms" version="2.3.0.49" targetFramework="xamarinios10" />
</packages>

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SkiaSharp" version="1.54.0.1" targetFramework="portable45-net45+win8+wp8" />
<package id="Xamarin.Forms" version="2.3.0.46-pre3" targetFramework="portable45-net45+win8+wp8" />
<package id="SkiaSharp.Views.Forms" version="1.54.0.1-beta1" targetFramework="portable45-net45+win8+wp8" />
<package id="Xamarin.Forms" version="2.3.0.49" targetFramework="portable45-net45+win8+wp8" />
</packages>