This commit is contained in:
Matthew Leibowitz 2016-06-09 17:07:25 +02:00
Родитель ec8a22a129
Коммит 7e1c27d65e
32 изменённых файлов: 1232 добавлений и 0 удалений

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

@ -821,6 +821,11 @@ Task ("samples")
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "iPhone" };
});
RunNuGetRestore ("./samples/Skia.tvOS.Demo/Skia.tvOS.Demo.sln");
DotNetBuild ("./samples/Skia.tvOS.Demo/Skia.tvOS.Demo.sln", c => {
c.Configuration = "Release";
c.Properties ["Platform"] = new [] { "iPhoneSimulator" };
});
}
if (IsRunningOnWindows ()) {

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

@ -957,6 +957,7 @@ namespace SkiaSharp
OSX = 4,
WindowsDesktop = 8,
UWP = 16,
tvOS = 32,
All = 0xFFFF,
}

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

@ -0,0 +1,60 @@
using Foundation;
using UIKit;
namespace Skia.tvOS.Demo
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
public override UIWindow Window
{
get;
set;
}
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
public override void OnResignActivation(UIApplication application)
{
// Invoked when the application is about to move from active to inactive state.
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
// or when the user quits the application and it begins the transition to the background state.
// Games should use this method to pause the game.
}
public override void DidEnterBackground(UIApplication application)
{
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
}
public override void WillEnterForeground(UIApplication application)
{
// Called as part of the transiton from background to active state.
// Here you can undo many of the changes made on entering the background.
}
public override void OnActivated(UIApplication application)
{
// Restart any tasks that were paused (or not yet started) while the application was inactive.
// If the application was previously in the background, optionally refresh the user interface.
}
public override void WillTerminate(UIApplication application)
{
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
}
}
}

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

@ -0,0 +1,54 @@
{
"images": [
{
"idiom": "universal"
},
{
"scale": "1x",
"idiom": "universal"
},
{
"scale": "2x",
"idiom": "universal"
},
{
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,17 @@
{
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,54 @@
{
"images": [
{
"idiom": "universal"
},
{
"scale": "1x",
"idiom": "universal"
},
{
"scale": "2x",
"idiom": "universal"
},
{
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,54 @@
{
"images": [
{
"idiom": "universal"
},
{
"scale": "1x",
"idiom": "universal"
},
{
"scale": "2x",
"idiom": "universal"
},
{
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,54 @@
{
"images": [
{
"idiom": "universal"
},
{
"scale": "1x",
"idiom": "universal"
},
{
"scale": "2x",
"idiom": "universal"
},
{
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,17 @@
{
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,54 @@
{
"images": [
{
"idiom": "universal"
},
{
"scale": "1x",
"idiom": "universal"
},
{
"scale": "2x",
"idiom": "universal"
},
{
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,54 @@
{
"images": [
{
"idiom": "universal"
},
{
"scale": "1x",
"idiom": "universal"
},
{
"scale": "2x",
"idiom": "universal"
},
{
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,26 @@
{
"assets" : [
{
"size" : "1280x768",
"idiom" : "tv",
"filename" : "App Icon - Large.imagestack",
"role" : "primary-app-icon"
},
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "App Icon - Small.imagestack",
"role" : "primary-app-icon"
},
{
"size" : "1920x720",
"idiom" : "tv",
"filename" : "Top Shelf Image.imageset",
"role" : "top-shelf-image"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,54 @@
{
"images": [
{
"idiom": "universal"
},
{
"scale": "1x",
"idiom": "universal"
},
{
"scale": "2x",
"idiom": "universal"
},
{
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

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

@ -0,0 +1,162 @@
{
"images": [
{
"minimum-system-version": "8.0",
"orientation": "portrait",
"extent": "full-screen",
"size": "414x736",
"subtype": "736h",
"scale": "3x",
"idiom": "iphone"
},
{
"minimum-system-version": "8.0",
"orientation": "portrait",
"extent": "full-screen",
"size": "375x667",
"subtype": "667h",
"scale": "2x",
"idiom": "iphone"
},
{
"minimum-system-version": "8.0",
"orientation": "landscape",
"extent": "full-screen",
"size": "736x414",
"subtype": "736h",
"scale": "3x",
"idiom": "iphone"
},
{
"minimum-system-version": "7.0",
"orientation": "portrait",
"extent": "full-screen",
"size": "320x480",
"scale": "2x",
"idiom": "iphone"
},
{
"minimum-system-version": "7.0",
"orientation": "portrait",
"extent": "full-screen",
"size": "320x568",
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"minimum-system-version": "7.0",
"orientation": "portrait",
"extent": "full-screen",
"size": "768x1024",
"scale": "1x",
"idiom": "ipad"
},
{
"minimum-system-version": "7.0",
"orientation": "portrait",
"extent": "full-screen",
"size": "768x1024",
"scale": "2x",
"idiom": "ipad"
},
{
"minimum-system-version": "7.0",
"orientation": "landscape",
"extent": "full-screen",
"size": "1024x768",
"scale": "1x",
"idiom": "ipad"
},
{
"minimum-system-version": "7.0",
"orientation": "landscape",
"extent": "full-screen",
"size": "1024x768",
"scale": "2x",
"idiom": "ipad"
},
{
"orientation": "portrait",
"extent": "full-screen",
"size": "320x480",
"scale": "1x",
"idiom": "iphone"
},
{
"orientation": "portrait",
"extent": "full-screen",
"size": "320x480",
"scale": "2x",
"idiom": "iphone"
},
{
"orientation": "portrait",
"extent": "full-screen",
"size": "320x568",
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"orientation": "portrait",
"extent": "full-screen",
"size": "768x1024",
"scale": "1x",
"idiom": "ipad"
},
{
"orientation": "portrait",
"extent": "full-screen",
"size": "768x1024",
"scale": "2x",
"idiom": "ipad"
},
{
"orientation": "portrait",
"extent": "to-status-bar",
"size": "768x1004",
"scale": "1x",
"idiom": "ipad"
},
{
"orientation": "portrait",
"extent": "to-status-bar",
"size": "768x1004",
"scale": "2x",
"idiom": "ipad"
},
{
"orientation": "landscape",
"extent": "full-screen",
"size": "1024x768",
"scale": "1x",
"idiom": "ipad"
},
{
"orientation": "landscape",
"extent": "full-screen",
"size": "1024x768",
"scale": "2x",
"idiom": "ipad"
},
{
"orientation": "landscape",
"extent": "to-status-bar",
"size": "1024x748",
"scale": "1x",
"idiom": "ipad"
},
{
"orientation": "landscape",
"extent": "to-status-bar",
"size": "1024x748",
"scale": "2x",
"idiom": "ipad"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}

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

@ -0,0 +1,6 @@
<?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>
</dict>
</plist>

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

@ -0,0 +1,35 @@
<?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>CFBundleDisplayName</key>
<string>Skia.tvOS.Demo</string>
<key>CFBundleName</key>
<string>Skia.tvOS.Demo</string>
<key>CFBundleIdentifier</key>
<string>com.companyname.skia-tvos-demo</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.1</string>
<key>UIDeviceFamily</key>
<array>
<integer>3</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/App Icon &amp; Top Shelf Image.brandassets</string>
<key>XSLaunchImageAssets</key>
<string>Assets.xcassets/LaunchImages.launchimage</string>
</dict>
</plist>

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

@ -0,0 +1,15 @@
using UIKit;
namespace Skia.tvOS.Demo
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}

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

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="9046" systemVersion="14F27" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9035"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<view contentMode="scaleToFill" id="3" translatesAutoresizingMaskIntoConstraints="NO" customClass="SkiaView">
<rect key="frame" x="384" y="0.0" width="1536" height="1080"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<subviews/>
</view>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="4" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="0.0" y="0.0" width="384" height="1080"/>
<subviews/>
</scrollView>
</subviews>
<constraints>
<constraint id="5" firstItem="4" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom"/>
<constraint id="6" firstItem="wfy-db-euE" firstAttribute="top" secondItem="4" secondAttribute="bottom"/>
<constraint id="7" firstItem="4" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading"/>
<constraint id="8" firstItem="4" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="0.2"/>
<constraint id="9" firstItem="3" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom"/>
<constraint id="10" firstItem="8bC-Xf-vdC" firstAttribute="trailing" secondItem="3" secondAttribute="trailing"/>
<constraint id="11" firstItem="wfy-db-euE" firstAttribute="top" secondItem="3" secondAttribute="bottom"/>
<constraint id="12" firstItem="3" firstAttribute="leading" secondItem="4" secondAttribute="trailing"/>
</constraints>
</view>
<connections>
<outlet property="skiaView" destination="3" id="name-outlet-3"/>
<outlet property="scrollView" destination="4" id="name-outlet-4"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
</scenes>
</document>

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

@ -0,0 +1,155 @@
<?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)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{D686F3AC-BAD7-40FF-AFC9-CA6462279545}</ProjectGuid>
<ProjectTypeGuids>{06FA79CB-D6CD-4721-BB4B-1BD202089C55};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Skia.tvOS.Demo</RootNamespace>
<AssemblyName>Skia.tvOS.Demo</AssemblyName>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchFastDev>true</MtouchFastDev>
<MtouchProfiling>true</MtouchProfiling>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<DeviceSpecificBuild>false</DeviceSpecificBuild>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseLlvm>true</MtouchUseLlvm>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchFloat32>true</MtouchFloat32>
<MtouchEnableBitcode>true</MtouchEnableBitcode>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARM64</MtouchArch>
<MtouchLink>Full</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchLink>Full</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<DeviceSpecificBuild>true</DeviceSpecificBuild>
<MtouchDebug>true</MtouchDebug>
<MtouchFastDev>true</MtouchFastDev>
<MtouchProfiling>true</MtouchProfiling>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchLink>None</MtouchLink>
<MtouchArch>ARM64</MtouchArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.TVOS" />
<Reference Include="SkiaSharp">
<HintPath>packages\SkiaSharp.1.49.4-beta4\lib\XamarintvOS\SkiaSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Large.imagestack\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Large.imagestack\Back.imagestacklayer\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Large.imagestack\Back.imagestacklayer\Content.imageset\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Large.imagestack\Front.imagestacklayer\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Large.imagestack\Front.imagestacklayer\Content.imageset\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Large.imagestack\Middle.imagestacklayer\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Large.imagestack\Middle.imagestacklayer\Content.imageset\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Small.imagestack\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Small.imagestack\Back.imagestacklayer\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Small.imagestack\Back.imagestacklayer\Content.imageset\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Small.imagestack\Front.imagestacklayer\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Small.imagestack\Front.imagestacklayer\Content.imageset\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Small.imagestack\Middle.imagestacklayer\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\App Icon - Small.imagestack\Middle.imagestacklayer\Content.imageset\Contents.json" />
<ImageAsset Include="Assets.xcassets\App Icon &amp; Top Shelf Image.brandassets\Top Shelf Image.imageset\Contents.json" />
<ImageAsset Include="Assets.xcassets\LaunchImages.launchimage\Contents.json" />
<ImageAsset Include="Assets.xcassets\Contents.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
<None Include="packages.config" />
</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="SkiaView.cs" />
<Compile Include="SkiaView.designer.cs">
<DependentUpon>SkiaView.cs</DependentUpon>
</Compile>
<Compile Include="..\SharedDemo\SkiaSharp.Demos.cs">
<Link>SkiaSharp.Demos.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\SharedDemo\baboon.png">
<Link>baboon.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\color-wheel.png">
<Link>color-wheel.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\SharedDemo\embedded-font.ttf">
<Link>embedded-font.ttf</Link>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BundleResource Include="..\SharedDemo\content-font.ttf">
<Link>Resources\content-font.ttf</Link>
</BundleResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\TVOS\Xamarin.TVOS.CSharp.targets" />
</Project>

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

@ -0,0 +1,29 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skia.tvOS.Demo", "Skia.tvOS.Demo.csproj", "{D686F3AC-BAD7-40FF-AFC9-CA6462279545}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Release|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Release|Any CPU.Build.0 = Debug|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Release|iPhone.ActiveCfg = Release|iPhone
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Release|iPhone.Build.0 = Release|iPhone
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Debug|iPhone.ActiveCfg = Debug|iPhone
{D686F3AC-BAD7-40FF-AFC9-CA6462279545}.Debug|iPhone.Build.0 = Debug|iPhone
EndGlobalSection
EndGlobal

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

@ -0,0 +1,81 @@
using System;
using CoreGraphics;
using UIKit;
using SkiaSharp;
namespace Skia.tvOS.Demo
{
public partial class SkiaView : UIView
{
private const int bitmapInfo = ((int)CGBitmapFlags.ByteOrder32Big) | ((int)CGImageAlphaInfo.PremultipliedLast);
Demos.Sample sample;
public SkiaView(IntPtr handle)
: base(handle)
{
}
public override void Draw(CGRect rect)
{
base.Draw(rect);
if (sample == null)
return;
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, SKColorType.N_32, SKAlphaType.Premul, buff, width * 4))
{
var skcanvas = surface.Canvas;
skcanvas.Scale((float)screenScale, (float)screenScale);
using (new SKAutoCanvasRestore(skcanvas, true))
{
Sample?.Method(skcanvas, (int)Bounds.Width, (int)Bounds.Height);
}
}
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);
}
}
public override void LayoutSubviews()
{
base.LayoutSubviews();
SetNeedsDisplay();
}
public Demos.Sample Sample
{
get
{
return sample;
}
set
{
sample = value;
SetNeedsDisplay();
}
}
}
}

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

@ -0,0 +1,21 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;
namespace Skia.tvOS.Demo
{
[Register ("SkiaView")]
partial class SkiaView
{
void ReleaseDesignerOutlets ()
{
}
}
}

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

@ -0,0 +1,89 @@
using System;
using System.IO;
using CoreGraphics;
using Foundation;
using UIKit;
namespace Skia.tvOS.Demo
{
public partial class ViewController : UIViewController
{
private UIButton tapButton;
public ViewController(IntPtr handle)
: base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
tapButton = new UIButton(UIButtonType.RoundedRect)
{
Frame = new CGRect(scrollView.Bounds.Right + 12, 0, 300, 100),
};
tapButton.SetTitle("Action", UIControlState.Normal);
tapButton.PrimaryActionTriggered += OnTapped;
View.AddSubview(tapButton);
// set up resource paths
string fontName = "content-font.ttf";
SkiaSharp.Demos.CustomFontPath = NSBundle.MainBundle.PathForResource(Path.GetFileNameWithoutExtension(fontName), Path.GetExtension(fontName));
var dir = Path.Combine(Path.GetTempPath(), "SkiaSharp.Demos", Path.GetRandomFileName());
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
SkiaSharp.Demos.WorkingDirectory = dir;
SkiaSharp.Demos.OpenFileDelegate = path =>
{
var resourceToOpen = NSUrl.FromFilename(Path.Combine(dir, path));
// TODO: try open file
var alert = UIAlertController.Create("SkiaSharp", "Unable to open file.", UIAlertControllerStyle.Alert);
alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
PresentViewController(alert, true, null);
};
var demos = SkiaSharp.Demos.SamplesForPlatform(SkiaSharp.Demos.Platform.tvOS);
var y = 100 + 12;
foreach (var demo in demos)
{
var button = new UIButton(UIButtonType.RoundedRect);
button.Frame = new CGRect(12, y, scrollView.Bounds.Width - 12 - 12, 100);
y += 100 + 12;
button.SetTitle(demo, UIControlState.Normal);
button.PrimaryActionTriggered += ButtonTapped;
if (skiaView.Sample == null)
{
// tap the first button so there is something on the screen
ButtonTapped(button, EventArgs.Empty);
}
scrollView.AddSubview(button);
}
scrollView.ContentSize = new CGSize(scrollView.Bounds.Width, y + 100 + 12);
}
private void OnTapped(object sender, EventArgs e)
{
skiaView.Sample?.TapMethod?.Invoke();
}
private void ButtonTapped(object sender, EventArgs e)
{
var button = (UIButton)sender;
var title = button.Title(UIControlState.Normal);
skiaView.Sample = SkiaSharp.Demos.GetSample(title);
var newBounds = tapButton.Frame;
newBounds.Y = button.Frame.Top - scrollView.ContentOffset.Y;
tapButton.Frame = newBounds;
tapButton.Hidden = skiaView.Sample?.TapMethod == null;
}
}
}

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

@ -0,0 +1,38 @@
// WARNING
//
// This file has been generated automatically by Xamarin Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;
namespace Skia.tvOS.Demo
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UIScrollView scrollView { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
Skia.tvOS.Demo.SkiaView skiaView { get; set; }
void ReleaseDesignerOutlets ()
{
if (scrollView != null) {
scrollView.Dispose ();
scrollView = null;
}
if (skiaView != null) {
skiaView.Dispose ();
skiaView = null;
}
}
}
}

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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SkiaSharp" version="1.49.4-beta4" targetFramework="xamarintvos10" />
</packages>