Adding Skia OSX binding and demo project

This commit is contained in:
Bill Holmes 2015-11-24 12:59:37 -05:00
Родитель c344ffab4e
Коммит 7edfd3c4fa
24 изменённых файлов: 797 добавлений и 0 удалений

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

@ -29,6 +29,8 @@ namespace SkiaSharp
const string SKIA = "@rpath/libskia_ios.framework/libskia_ios";
#elif __ANDROID__
const string SKIA = "libskia_android.so";
#elif XAMARIN_MAC
const string SKIA = "liblibskia_osx.dylib";
#else
const string SKIA = "/tmp/libskia.dylib";
#endif

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

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{4588A759-3853-49B8-8A68-6C7917BE9220}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>SkiaSharp.OSX</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>SkiaSharp</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;XAMARIN_MAC;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Profiling>false</Profiling>
<UseRefCounting>false</UseRefCounting>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<CreatePackage>false</CreatePackage>
<EnableCodeSigning>false</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Profiling>false</Profiling>
<UseRefCounting>false</UseRefCounting>
<UseSGen>false</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<CreatePackage>false</CreatePackage>
<EnableCodeSigning>false</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>XAMARIN_MAC;</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="..\Binding\Binding.projitems" Label="Shared" Condition="Exists('..\Binding\Binding.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<ItemGroup>
<Compile Include="..\SharedProps\SkiaSharpAssemblyInfo.cs">
<Link>Properties\SkiaSharpAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
</Project>

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

@ -0,0 +1,24 @@
using AppKit;
using Foundation;
namespace Skia.OSX.Demo
{
[Register ("AppDelegate")]
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void DidFinishLaunching (NSNotification notification)
{
// Insert code here to initialize your application
}
public override void WillTerminate (NSNotification notification)
{
// Insert code here to tear down your application
}
}
}

19
samples/Skia.OSX.Demo/AppDelegate.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,19 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Skia.OSX.Demo
{
partial class AppDelegate
{
void ReleaseDesignerOutlets ()
{
}
}
}

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

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Skia.OSX.Demo</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.skia-osx-demo</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>billholmes</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>
</dict>
</plist>

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

@ -0,0 +1,13 @@
using AppKit;
namespace Skia.OSX.Demo
{
static class MainClass
{
static void Main (string[] args)
{
NSApplication.Init ();
NSApplication.Main (args);
}
}
}

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

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
</dependencies>
<scenes>
<!--Application-->
<scene sceneID="JPo-4y-FX3">
<objects>
<application id="hnw-xV-0zn" sceneMemberID="viewController">
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="Skia.OSX.Demo" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Skia.OSX.Demo" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About Skia.OSX.Demo" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eHP-pT-vMg"/>
<menuItem title="Quit Skia.OSX.Demo" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="0.0"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
</connections>
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl" customClass="SkaiView">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mnJ-8z-WRI">
<rect key="frame" x="334" y="17" width="129" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="124" id="3Ya-mE-NFc"/>
<constraint firstAttribute="height" constant="21" id="PW1-2o-QII"/>
</constraints>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="5te-c2-WKW">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="LKv-bG-q8C"/>
</popUpButtonCell>
<connections>
<action selector="PopUpButtonAction:" target="XfG-lQ-9wD" id="lmM-6c-sIb"/>
</connections>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="mnJ-8z-WRI" secondAttribute="trailing" constant="20" id="FIZ-dO-bNg"/>
<constraint firstAttribute="bottom" secondItem="mnJ-8z-WRI" secondAttribute="bottom" constant="20" id="qdr-cp-9Is"/>
</constraints>
</view>
<connections>
<outlet property="PopUpButton" destination="mnJ-8z-WRI" id="mEQ-lK-fod"/>
<outlet property="SkiaView" destination="m2S-Jp-Qdl" id="8ta-WW-AHG"/>
</connections>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
</document>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 7.9 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 711 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 20 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 58 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 58 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 174 KiB

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

@ -0,0 +1,222 @@
{
"images": [
{
"size": "29x29",
"scale": "1x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "40x40",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "40x40",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "57x57",
"scale": "1x",
"idiom": "iphone"
},
{
"size": "57x57",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "60x60",
"scale": "2x",
"idiom": "iphone"
},
{
"size": "60x60",
"scale": "3x",
"idiom": "iphone"
},
{
"size": "29x29",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "29x29",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "40x40",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "50x50",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "50x50",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "72x72",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "72x72",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "76x76",
"scale": "1x",
"idiom": "ipad"
},
{
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
},
{
"role": "notificationCenter",
"size": "24x24",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "notificationCenter",
"size": "27.5x27.5",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "2x",
"idiom": "watch"
},
{
"role": "companionSettings",
"size": "29x29",
"scale": "3x",
"idiom": "watch"
},
{
"role": "appLauncher",
"size": "40x40",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "longLook",
"size": "44x44",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "86x86",
"subtype": "38mm",
"scale": "2x",
"idiom": "watch"
},
{
"role": "quickLook",
"size": "98x98",
"subtype": "42mm",
"scale": "2x",
"idiom": "watch"
},
{
"filename": "AppIcon-16.png",
"size": "16x16",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "AppIcon-16@2x.png",
"size": "16x16",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-32.png",
"size": "32x32",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "AppIcon-32@2x.png",
"size": "32x32",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-128.png",
"size": "128x128",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "AppIcon-128@2x.png",
"size": "128x128",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-256.png",
"size": "256x256",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "AppIcon-256@2x.png",
"size": "256x256",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-512.png",
"size": "512x512",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "AppIcon-512@2x.png",
"size": "512x512",
"scale": "2x",
"idiom": "mac"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,67 @@
// This file has been autogenerated from a class added in the UI designer.
using System;
using Foundation;
using AppKit;
using SkiaSharp;
namespace Skia.OSX.Demo
{
public partial class SkaiView : NSView
{
Action <SKCanvas, int, int> onDrawCallback;
public SkaiView (IntPtr handle) : base (handle)
{
onDrawCallback = Skia.Forms.Demo.DrawHelpers.DrawXamagon;
}
public override void DrawRect (CoreGraphics.CGRect dirtyRect)
{
base.DrawRect (dirtyRect);
// Just not that sharp using the scale pixel scale only
// Going going 2x Pixel Scale
var screenScale = (int)NSScreen.MainScreen.BackingScaleFactor * 2;
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, SKColorType.Rgba_8888, SKAlphaType.Premul, buff, width * 4)) {
var skcanvas = surface.Canvas;
skcanvas.Scale (screenScale, screenScale);
onDrawCallback (skcanvas, (int)Bounds.Width, (int)Bounds.Height);
}
using (var colorSpace = CoreGraphics.CGColorSpace.CreateDeviceRGB ()) {
int hack = ((int)CoreGraphics.CGBitmapFlags.ByteOrderDefault) | ((int)CoreGraphics.CGImageAlphaInfo.PremultipliedLast);
using (var bContext = new CoreGraphics.CGBitmapContext (buff, width, height, 8, width * 4, colorSpace, (CoreGraphics.CGImageAlphaInfo) hack)) {
using (var image = bContext.ToImage ()) {
using (var context = NSGraphicsContext.CurrentContext.GraphicsPort) {
context.DrawImage (Bounds, image);
}
}
}
}
} finally {
if (buff != IntPtr.Zero)
System.Runtime.InteropServices.Marshal.FreeCoTaskMem (buff);
}
}
public Action<SKCanvas, int, int> OnDrawCallback {
get {
return onDrawCallback;
}
set {
onDrawCallback = value;
SetNeedsDisplayInRect (Bounds);
}
}
}
}

20
samples/Skia.OSX.Demo/SkaiView.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,20 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Skia.OSX.Demo
{
[Register ("SkaiView")]
partial class SkaiView
{
void ReleaseDesignerOutlets ()
{
}
}
}

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

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{21C3D211-2536-4C97-9507-EFA71635713B}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Skia.OSX.Demo</RootNamespace>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<AssemblyName>Skia.OSX.Demo</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Profiling>true</Profiling>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<CreatePackage>false</CreatePackage>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<EnableCodeSigning>false</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<XamMacArch>x86_64</XamMacArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<Profiling>false</Profiling>
<UseRefCounting>true</UseRefCounting>
<UseSGen>true</UseSGen>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<CreatePackage>true</CreatePackage>
<CodeSigningKey>Developer ID Application</CodeSigningKey>
<EnableCodeSigning>true</EnableCodeSigning>
<EnablePackageSigning>false</EnablePackageSigning>
<XamMacArch>x86_64</XamMacArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-128.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-128%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-16.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-16%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-256.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-256%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-32.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-32%402x.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-512.png" />
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\AppIcon-512%402x.png" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
<Compile Include="SkaiView.cs" />
<Compile Include="SkaiView.designer.cs">
<DependentUpon>SkaiView.cs</DependentUpon>
</Compile>
<Compile Include="..\Skia.Forms.Demo\DrawHelpers.cs">
<Link>DrawHelpers.cs</Link>
</Compile>
<Compile Include="AppDelegate.designer.cs">
<DependentUpon>AppDelegate.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\..\binding\SkiaSharp.OSX\SkiaSharp.OSX.csproj">
<Project>{4588A759-3853-49B8-8A68-6C7917BE9220}</Project>
<Name>SkiaSharp.OSX</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<NativeReference Include="..\..\native-builds\osx\liblibskia_osx.dylib">
<IsCxx>False</IsCxx>
<Kind>Dynamic</Kind>
</NativeReference>
</ItemGroup>
</Project>

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

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skia.OSX.Demo", "Skia.OSX.Demo.csproj", "{21C3D211-2536-4C97-9507-EFA71635713B}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Binding", "..\..\binding\Binding\Binding.shproj", "{9C502B9A-25D4-473F-89BD-5A13DDE16354}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.OSX", "..\..\binding\SkiaSharp.OSX\SkiaSharp.OSX.csproj", "{4588A759-3853-49B8-8A68-6C7917BE9220}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{21C3D211-2536-4C97-9507-EFA71635713B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21C3D211-2536-4C97-9507-EFA71635713B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21C3D211-2536-4C97-9507-EFA71635713B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21C3D211-2536-4C97-9507-EFA71635713B}.Release|Any CPU.Build.0 = Release|Any CPU
{4588A759-3853-49B8-8A68-6C7917BE9220}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4588A759-3853-49B8-8A68-6C7917BE9220}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4588A759-3853-49B8-8A68-6C7917BE9220}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4588A759-3853-49B8-8A68-6C7917BE9220}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

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

@ -0,0 +1,46 @@
using System;
using AppKit;
using Foundation;
namespace Skia.OSX.Demo
{
public partial class ViewController : NSViewController
{
public ViewController (IntPtr handle) : base (handle)
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
PopUpButton.AddItems (new [] {"Xamagon", "Text", "Gradient"});
PopUpButton.SelectItem (0);
}
partial void PopUpButtonAction (NSObject sender)
{
switch (PopUpButton.SelectedItem.Title) {
case "Xamagon":
SkiaView.OnDrawCallback = Skia.Forms.Demo.DrawHelpers.DrawXamagon;
break;
case "Text":
SkiaView.OnDrawCallback = Skia.Forms.Demo.DrawHelpers.TextSample;
break;
case "Gradient":
SkiaView.OnDrawCallback = Skia.Forms.Demo.DrawHelpers.DrawGradient;
break;
}
}
public override NSObject RepresentedObject {
get {
return base.RepresentedObject;
}
set {
base.RepresentedObject = value;
// Update the view, if already loaded.
}
}
}
}

37
samples/Skia.OSX.Demo/ViewController.designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,37 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the UI designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
using Foundation;
using System.CodeDom.Compiler;
namespace Skia.OSX.Demo
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
AppKit.NSPopUpButton PopUpButton { get; set; }
[Outlet]
Skia.OSX.Demo.SkaiView SkiaView { get; set; }
[Action ("PopUpButtonAction:")]
partial void PopUpButtonAction (Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (PopUpButton != null) {
PopUpButton.Dispose ();
PopUpButton = null;
}
if (SkiaView != null) {
SkiaView.Dispose ();
SkiaView = null;
}
}
}
}