зеркало из https://github.com/mono/SkiaSharp.git
Added a basic iOS sample that uses the new views
This commit is contained in:
Родитель
1f70047dd6
Коммит
d533cfc172
|
@ -0,0 +1,59 @@
|
|||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace BasicSkiaSharp
|
||||
{
|
||||
// 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,157 @@
|
|||
{
|
||||
"images": [
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"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": "ipad",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"size": "24x24",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "notificationCenter",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "27.5x27.5",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "notificationCenter",
|
||||
"subtype": "42mm"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "watch",
|
||||
"role": "companionSettings",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "watch",
|
||||
"role": "companionSettings",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"size": "40x40",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "appLauncher",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "44x44",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "longLook",
|
||||
"subtype": "42mm"
|
||||
},
|
||||
{
|
||||
"size": "86x86",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "quickLook",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "98x98",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "quickLook",
|
||||
"subtype": "42mm"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
<?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>{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>BasicSkiaSharp</RootNamespace>
|
||||
<AssemblyName>BasicSkiaSharp</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;ENABLE_TEST_CLOUD;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>i386, x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType></DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>Full</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>Full</MtouchLink>
|
||||
<MtouchArch>i386, x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<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>ARMv7, ARMv7s, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="SkiaSharp">
|
||||
<HintPath>packages\SkiaSharp.1.54.0\lib\XamariniOS\SkiaSharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
|
||||
<ImageAsset Include="Assets.xcassets\Contents.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
<InterfaceDefinition Include="Main.storyboard" />
|
||||
</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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BundleResource Include="Resources\skia_512.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\views\SkiaSharp.Views.iOS\SkiaSharp.Views.iOS.csproj">
|
||||
<Project>{74C78108-9199-4A7A-928C-FC4DC57D0AE4}</Project>
|
||||
<Name>SkiaSharp.Views.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicSkiaSharp", "BasicSkiaSharp.csproj", "{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Views.iOS", "..\..\..\views\SkiaSharp.Views.iOS\SkiaSharp.Views.iOS.csproj", "{74C78108-9199-4A7A-928C-FC4DC57D0AE4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{BD2BA0D6-FEEC-4DAC-9541-99F65C1DDBA5}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{74C78108-9199-4A7A-928C-FC4DC57D0AE4}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -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,39 @@
|
|||
<?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>SimpleSkiaSharp</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.companyname.simpleskiasharp</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>8.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" 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="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" customColorSpace="sRGB" colorSpace="calibratedRGB" red="0.97254901960784312" green="0.97254901960784312" blue="0.97254901960784312" alpha="1"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="3" translatesAutoresizingMaskIntoConstraints="NO" image="skia_512.png">
|
||||
<rect key="frame" x="44" y="150.5" width="512" height="299"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint id="4" firstItem="3" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX"/>
|
||||
<constraint id="5" firstItem="3" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY"/>
|
||||
<constraint id="12" firstItem="3" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height"/>
|
||||
<constraint id="13" firstItem="3" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="12"/>
|
||||
<exclude reference="13"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<variation key="heightClass=regular-widthClass=compact">
|
||||
<mask key="constraints">
|
||||
<include reference="12"/>
|
||||
<include reference="13"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="0.0" y="0.0"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="skia_512.png" width="512" height="299"/>
|
||||
<image name="skia_1024.png" width="1024" height="597"/>
|
||||
</resources>
|
||||
</document>
|
|
@ -0,0 +1,15 @@
|
|||
using UIKit;
|
||||
|
||||
namespace BasicSkiaSharp
|
||||
{
|
||||
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,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" 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="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<subviews/>
|
||||
</view>
|
||||
<connections/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="0.0" y="0.0"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="skia_512.png" width="512" height="299"/>
|
||||
</resources>
|
||||
</document>
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 12 KiB |
|
@ -0,0 +1,205 @@
|
|||
using System;
|
||||
using UIKit;
|
||||
using SkiaSharp.Views;
|
||||
using SkiaSharp;
|
||||
using CoreGraphics;
|
||||
|
||||
namespace BasicSkiaSharp
|
||||
{
|
||||
public partial class ViewController : UIViewController, ISKLayerDelegate, ISKGLLayerDelegate
|
||||
{
|
||||
private MySoftwareView softwareSkiaView;
|
||||
|
||||
private SKLayer softwareSkiaLayer;
|
||||
private UIView softwareSkiaLayerView;
|
||||
|
||||
private MyHardwareView hardwareSkiaView;
|
||||
|
||||
private SKGLLayer hardwareSkiaLayer;
|
||||
private UIView hardwareSkiaLayerView;
|
||||
|
||||
private UILabel softwareLabel;
|
||||
private UILabel hardwareLabel;
|
||||
private UILabel layerLabel;
|
||||
private UILabel viewLabel;
|
||||
|
||||
protected ViewController(IntPtr handle)
|
||||
: base(handle)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
|
||||
// create the labels
|
||||
var ninety = (float)Math.PI / -2f;
|
||||
var font = UIFont.BoldSystemFontOfSize(18);
|
||||
softwareLabel = new UILabel
|
||||
{
|
||||
Text = "Software",
|
||||
TextAlignment = UITextAlignment.Center,
|
||||
Font = font
|
||||
};
|
||||
View.AddSubview(softwareLabel);
|
||||
hardwareLabel = new UILabel
|
||||
{
|
||||
Text = "Hardware",
|
||||
TextAlignment = UITextAlignment.Center,
|
||||
Font = font
|
||||
};
|
||||
View.AddSubview(hardwareLabel);
|
||||
layerLabel = new UILabel
|
||||
{
|
||||
Text = "Layer",
|
||||
Transform = CGAffineTransform.MakeRotation(ninety),
|
||||
TextAlignment = UITextAlignment.Center,
|
||||
Font = font
|
||||
};
|
||||
View.AddSubview(layerLabel);
|
||||
viewLabel = new UILabel
|
||||
{
|
||||
Text = "View",
|
||||
Transform = CGAffineTransform.MakeRotation(ninety),
|
||||
TextAlignment = UITextAlignment.Center,
|
||||
Font = font
|
||||
};
|
||||
View.AddSubview(viewLabel);
|
||||
|
||||
// create a custom software view
|
||||
softwareSkiaView = new MySoftwareView();
|
||||
softwareSkiaView.Opaque = false;
|
||||
View.AddSubview(softwareSkiaView);
|
||||
|
||||
// create a custom hardware view
|
||||
hardwareSkiaView = new MyHardwareView();
|
||||
hardwareSkiaView.EnableSetNeedsDisplay = true;
|
||||
View.AddSubview(hardwareSkiaView);
|
||||
|
||||
// add a software layer
|
||||
softwareSkiaLayerView = new UIView();
|
||||
View.AddSubview(softwareSkiaLayerView);
|
||||
softwareSkiaLayer = new SKLayer
|
||||
{
|
||||
ContentsScale = UIScreen.MainScreen.Scale,
|
||||
SKDelegate = this
|
||||
};
|
||||
softwareSkiaLayerView.Layer.AddSublayer(softwareSkiaLayer);
|
||||
|
||||
// add a hardware layer
|
||||
hardwareSkiaLayerView = new UIView();
|
||||
View.AddSubview(hardwareSkiaLayerView);
|
||||
hardwareSkiaLayer = new SKGLLayer
|
||||
{
|
||||
ContentsScale = UIScreen.MainScreen.Scale,
|
||||
SKDelegate = this
|
||||
};
|
||||
hardwareSkiaLayerView.Layer.AddSublayer(hardwareSkiaLayer);
|
||||
}
|
||||
|
||||
public override void ViewWillLayoutSubviews()
|
||||
{
|
||||
base.ViewWillLayoutSubviews();
|
||||
|
||||
var sbHeight = UIApplication.SharedApplication.StatusBarFrame.Height;
|
||||
var headerHeight = 32f;
|
||||
var topHeader = new CGRect(headerHeight, sbHeight, View.Bounds.Width - headerHeight, headerHeight);
|
||||
var leftHeader = new CGRect(0, sbHeight + headerHeight, headerHeight, View.Bounds.Height - (headerHeight + sbHeight));
|
||||
var availableSpace = CGRect.FromLTRB(leftHeader.Right, topHeader.Bottom, View.Bounds.Width, View.Bounds.Height);
|
||||
var colWidth = availableSpace.Width / 2f;
|
||||
var rowHeight = availableSpace.Height / 2f;
|
||||
var inset = 12;
|
||||
|
||||
// layout the various views
|
||||
|
||||
// the labels
|
||||
softwareLabel.Frame = new CGRect(topHeader.X, topHeader.Y, colWidth, topHeader.Height);
|
||||
hardwareLabel.Frame = new CGRect(topHeader.X + colWidth, topHeader.Y, colWidth, topHeader.Height);
|
||||
viewLabel.Frame = new CGRect(leftHeader.X, topHeader.Bottom, leftHeader.Width, rowHeight);
|
||||
layerLabel.Frame = new CGRect(leftHeader.X, topHeader.Bottom + rowHeight, leftHeader.Width, rowHeight);
|
||||
|
||||
// the software view
|
||||
softwareSkiaView.Frame = new CGRect(availableSpace.X, availableSpace.Y, colWidth, rowHeight).Inset(inset, inset);
|
||||
|
||||
// the software layer
|
||||
softwareSkiaLayerView.Frame = new CGRect(availableSpace.X, availableSpace.Y + rowHeight, colWidth, rowHeight).Inset(inset, inset);
|
||||
softwareSkiaLayer.Frame = softwareSkiaLayerView.Bounds;
|
||||
|
||||
// the hardware view
|
||||
hardwareSkiaView.Frame = new CGRect(availableSpace.X + colWidth, availableSpace.Y, colWidth, rowHeight).Inset(inset, inset);
|
||||
|
||||
// the hardware layer
|
||||
hardwareSkiaLayerView.Frame = new CGRect(availableSpace.X + colWidth, availableSpace.Y + rowHeight, colWidth, rowHeight).Inset(inset, inset);
|
||||
hardwareSkiaLayer.Frame = hardwareSkiaLayerView.Bounds;
|
||||
}
|
||||
|
||||
// the real draw method
|
||||
private static void Draw(SKSurface surface, SKSize size)
|
||||
{
|
||||
const int stroke = 4;
|
||||
const int curve = 20;
|
||||
const int textSize = 60;
|
||||
const int shrink = stroke / -2;
|
||||
|
||||
var canvas = surface.Canvas;
|
||||
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
|
||||
using (var paint = new SKPaint())
|
||||
{
|
||||
paint.IsAntialias = true;
|
||||
paint.TextSize = textSize;
|
||||
|
||||
paint.Color = SKColors.Orchid;
|
||||
var r = SKRect.Create(SKPoint.Empty, size);
|
||||
canvas.DrawRoundRect(r, curve, curve, paint);
|
||||
|
||||
paint.Color = SKColors.GreenYellow;
|
||||
canvas.DrawText("Hello iOS World!", 30, textSize + 10, paint);
|
||||
|
||||
paint.Color = SKColors.Orange.WithAlpha(100);
|
||||
canvas.DrawOval(SKRect.Create(50, 50, 100, 100), paint);
|
||||
|
||||
paint.IsStroke = true;
|
||||
paint.StrokeWidth = stroke;
|
||||
paint.Color = SKColors.Black;
|
||||
r.Inflate(shrink, shrink);
|
||||
canvas.DrawRoundRect(r, curve - stroke, curve - stroke, paint);
|
||||
}
|
||||
}
|
||||
|
||||
// drawing for the software layer
|
||||
public void DrawInSurface(SKSurface surface, SKImageInfo info)
|
||||
{
|
||||
Draw(surface, info.Size);
|
||||
}
|
||||
|
||||
// drawing for the hardware layer
|
||||
public void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
Draw(surface, new SKSize(renderTarget.Width, renderTarget.Height));
|
||||
}
|
||||
|
||||
// the custom view
|
||||
private class MySoftwareView : SKView
|
||||
{
|
||||
public override void DrawInSurface(SKSurface surface, SKImageInfo info)
|
||||
{
|
||||
base.DrawInSurface(surface, info);
|
||||
|
||||
ViewController.Draw(surface, info.Size);
|
||||
}
|
||||
}
|
||||
|
||||
// the custom view
|
||||
private class MyHardwareView : SKGLView
|
||||
{
|
||||
public override void DrawInSurface(SKSurface surface, GRBackendRenderTargetDesc renderTarget)
|
||||
{
|
||||
base.DrawInSurface(surface, renderTarget);
|
||||
|
||||
ViewController.Draw(surface, new SKSize(renderTarget.Width, renderTarget.Height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 BasicSkiaSharp
|
||||
{
|
||||
[Register ("ViewController")]
|
||||
partial class ViewController
|
||||
{
|
||||
void ReleaseDesignerOutlets ()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="SkiaSharp" version="1.54.0" targetFramework="xamarinios10" />
|
||||
</packages>
|
Загрузка…
Ссылка в новой задаче