Remove 8.1 support: assorted other cleanups

This commit is contained in:
Shawn Hargreaves 2018-02-22 10:55:59 -08:00
Родитель 5a950279a3
Коммит ba8daad256
51 изменённых файлов: 87 добавлений и 651 удалений

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

@ -10,13 +10,10 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0" DefaultTargets="Build">
<!-- Parameters that can be configured by the caller, eg. "msbuild Win2D.proj /p:BuildPhone=false" -->
<!-- Parameters that can be configured by the caller, eg. "msbuild Win2D.proj /p:BuildTests=false" -->
<PropertyGroup>
<BuildPlatforms>Win32;x64;ARM;AnyCPU</BuildPlatforms>
<BuildConfigurations>Debug;Release</BuildConfigurations>
<BuildWindows>true</BuildWindows>
<BuildPhone>true</BuildPhone>
<BuildUAP>true</BuildUAP>
<BuildTests>true</BuildTests>
<BuildTools>true</BuildTools>
<BuildDocs>true</BuildDocs>
@ -24,40 +21,12 @@
</PropertyGroup>
<PropertyGroup>
<Has81Sdk Condition="'$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot81)' != ''">true</Has81Sdk>
<Has10Sdk Condition="'$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots@KitsRoot10)' != ''">true</Has10Sdk>
<RunningFrom2017Prompt Condition="'$(VisualStudioVersion)' &gt;= '15.0'">true</RunningFrom2017Prompt>
<ShouldRunUAPTests>false</ShouldRunUAPTests>
<ShouldRunUAPTests Condition="'$(registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion@CurrentBuildNumber)' &gt;= '10000'">true</ShouldRunUAPTests>
</PropertyGroup>
<!-- Disable building targets when the SDK isn't installed -->
<PropertyGroup Condition="'$(Has81Sdk)' != 'true' and $(BuildWindows)">
<BuildWindows>false</BuildWindows>
<SkippedBuildWindows>true</SkippedBuildWindows>
</PropertyGroup>
<PropertyGroup Condition="'$(Has81Sdk)' != 'true' and $(BuildPhone)">
<BuildPhone>false</BuildPhone>
<SkippedBuildPhone>true</SkippedBuildPhone>
</PropertyGroup>
<PropertyGroup Condition="('$(Has10Sdk)' != 'true' or '$(RunningFrom2017Prompt)' != 'true') and $(BuildUAP)">
<BuildUAP>false</BuildUAP>
<SkippedBuildUAP>true</SkippedBuildUAP>
</PropertyGroup>
<!-- Set default platforms for each project type -->
<ItemDefinitionGroup>
<WindowsProject>
<Platforms>Win32;x64;ARM</Platforms>
<BinDir>Windows</BinDir>
</WindowsProject>
<PhoneProject>
<Platforms>Win32;ARM</Platforms>
<BinDir>Phone</BinDir>
</PhoneProject>
<UAPProject>
<Platforms>Win32;x64;ARM</Platforms>
<BinDir>UAP</BinDir>
@ -69,95 +38,34 @@
</ItemDefinitionGroup>
<!-- Windows projects implementing the Canvas API -->
<ItemGroup Condition="$(BuildWindows)">
<WindowsProject Include="winrt\lib\winrt.lib.Windows.vcxproj" />
<WindowsProject Include="winrt\dll\winrt.dll.Windows.vcxproj" />
<WindowsProject Include="numerics\DotNet\DotNetNumerics.Windows.csproj" />
</ItemGroup>
<!-- Windows Phone projects implementing the Canvas API -->
<ItemGroup Condition="$(BuildPhone)">
<PhoneProject Include="winrt\lib\winrt.lib.WindowsPhone.vcxproj" />
<PhoneProject Include="winrt\dll\winrt.dll.WindowsPhone.vcxproj" />
<PhoneProject Include="numerics\DotNet\DotNetNumerics.WindowsPhone.csproj" />
</ItemGroup>
<!-- UAP projects implementing the Canvas API -->
<ItemGroup Condition="$(BuildUAP)">
<!-- Projects implementing the Canvas API -->
<ItemGroup>
<UAPProject Include="winrt\lib\winrt.lib.uap.vcxproj" />
<UAPProject Include="winrt\dll\winrt.dll.uap.vcxproj" />
</ItemGroup>
<!-- Windows test projects -->
<ItemGroup Condition="$(BuildWindows) and $(BuildTests)">
<WindowsProject Include="winrt\test.internal\winrt.test.internal.Windows.vcxproj">
<Platforms>Win32;x64</Platforms>
<AutomatedTests>desktop</AutomatedTests>
</WindowsProject>
<WindowsProject Include="winrt\test.external\Windows\winrt.test.external.Windows.vcxproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
<WindowsProject Include="winrt\test.nativecomponent\winrt.test.nativecomponent.Windows.vcxproj" />
<WindowsProject Include="winrt\test.managed\Windows\winrt.test.managed.Windows.csproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
<WindowsProject Include="samples\SimpleSample\Windows\SimpleSample.Windows.csproj" />
<WindowsProject Include="samples\CoreWindowExample\Windows\CoreWindowExample.Windows.csproj" />
<WindowsProject Include="samples\ExampleGallery\Direct3DInterop\Windows\ExampleGallery.Direct3DInterop.Windows.vcxproj">
<BuildInParallel>false</BuildInParallel>
</WindowsProject>
<WindowsProject Include="samples\ExampleGallery\BackgroundTask\Windows\ExampleGallery.BackgroundTask.Windows.csproj" />
<WindowsProject Include="samples\ExampleGallery\Windows\ExampleGallery.Windows.csproj" />
<WindowsProject Include="numerics\Cpp\tests\CppNumericsTests.Windows.vcxproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
<WindowsProject Include="numerics\DotNet\tests\Windows\DotNetNumericsTests.Windows.csproj">
<AutomatedTests>store</AutomatedTests>
</WindowsProject>
<WindowsProject Include="numerics\Cpp\perftest\CppNumericsPerfTest.vcxproj">
<Platforms>Win32;x64</Platforms>
</WindowsProject>
</ItemGroup>
<!-- Windows Phone test projects -->
<ItemGroup Condition="$(BuildPhone) and $(BuildTests)">
<PhoneProject Include="winrt\test.external\WindowsPhone\winrt.test.external.WindowsPhone.vcxproj" />
<PhoneProject Include="winrt\test.nativecomponent\winrt.test.nativecomponent.WindowsPhone.vcxproj" />
<PhoneProject Include="winrt\test.managed\WindowsPhone\winrt.test.managed.WindowsPhone.csproj" />
<PhoneProject Include="samples\SimpleSample\WindowsPhone\SimpleSample.WindowsPhone.csproj" />
<PhoneProject Include="samples\CoreWindowExample\WindowsPhone\CoreWindowExample.WindowsPhone.csproj" />
<PhoneProject Include="samples\ExampleGallery\Direct3DInterop\WindowsPhone\ExampleGallery.Direct3DInterop.WindowsPhone.vcxproj">
<BuildInParallel>false</BuildInParallel>
</PhoneProject>
<PhoneProject Include="samples\ExampleGallery\BackgroundTask\WindowsPhone\ExampleGallery.BackgroundTask.WindowsPhone.csproj"/>
<PhoneProject Include="samples\ExampleGallery\WindowsPhone\ExampleGallery.WindowsPhone.csproj"/>
<PhoneProject Include="numerics\Cpp\tests\CppNumericsTests.WindowsPhone.vcxproj" />
<PhoneProject Include="numerics\DotNet\tests\WindowsPhone\DotNetNumericsTests.WindowsPhone.csproj" />
</ItemGroup>
<!-- UAP test projects -->
<ItemGroup Condition="$(BuildUAP) and $(BuildTests)">
<!-- Test projects -->
<ItemGroup Condition="$(BuildTests)">
<UAPProject Include="winrt\test.internal\winrt.test.internal.uap.vcxproj">
<Platforms>Win32;x64</Platforms>
<AutomatedTests Condition="$(ShouldRunUAPTests)">desktop</AutomatedTests>
</UAPProject>
<UAPProject Include="winrt\test.external\UAP\winrt.test.external.uap.vcxproj">
<UAPProject Include="winrt\test.external\winrt.test.external.uap.vcxproj">
<Platforms>Win32;x64</Platforms>
<AutomatedTests Condition="$(ShouldRunUAPTests)">store</AutomatedTests>
</UAPProject>
<UAPProject Include="winrt\test.nativecomponent\winrt.test.nativecomponent.uap.vcxproj" />
<UAPProject Include="winrt\test.managed\UAP\winrt.test.managed.uap.csproj">
<UAPProject Include="winrt\test.managed\winrt.test.managed.uap.csproj">
<AutomatedTests Condition="$(ShouldRunUAPTests)">store</AutomatedTests>
</UAPProject>
<UAPProject Include="samples\SimpleSample\UAP\SimpleSample.uap.csproj" />
<UAPProject Include="samples\CoreWindowExample\UAP\CoreWindowExample.uap.csproj" />
<UAPProject Include="samples\SimpleSample\SimpleSample.uap.csproj" />
<UAPProject Include="samples\CoreWindowExample\CoreWindowExample.uap.csproj" />
<UAPProject Include="samples\CompositionExample\CompositionExample.csproj" />
<UAPProject Include="samples\ExampleGallery\Direct3DInterop\UAP\ExampleGallery.Direct3DInterop.uap.vcxproj">
<UAPProject Include="samples\ExampleGallery\Direct3DInterop\ExampleGallery.Direct3DInterop.uap.vcxproj">
<BuildInParallel>false</BuildInParallel>
</UAPProject>
<UAPProject Include="samples\ExampleGallery\BackgroundTask\UAP\ExampleGallery.BackgroundTask.uap.csproj" />
<UAPProject Include="samples\ExampleGallery\UAP\ExampleGallery.uap.csproj" />
<UAPProject Include="samples\ExampleGallery\BackgroundTask\ExampleGallery.BackgroundTask.uap.csproj" />
<UAPProject Include="samples\ExampleGallery\ExampleGallery.uap.csproj" />
</ItemGroup>
<!-- Tools projects -->
@ -181,9 +89,8 @@
<!-- Restore NuGet packages for all projects -->
<ItemGroup>
<NuGetRestore Include="samples\**\packages.config" Condition="$(BuildTests)" />
<NuGetRestore Include="samples\**\project.json" Condition="$(BuildUAP) and $(BuildTests)" />
<NuGetRestore Include="winrt\**\project.json" Condition="$(BuildUAP) and $(BuildTests)" />
<NuGetRestore Include="numerics\**\project.json" Condition="$(BuildUAP)" />
<NuGetRestore Include="samples\**\project.json" Condition="$(BuildTests)" />
<NuGetRestore Include="winrt\**\project.json" Condition="$(BuildTests)" />
<NuGetRestore Include="tools\exportsample\packages.config" Condition="$(BuildTools)" />
</ItemGroup>
@ -195,7 +102,7 @@
<!-- Use batching to build each project in turn -->
<Target Name="BuildProjects"
DependsOnTargets="PrepareVersionInfo; ChooseProjectsToBuild; ListSkippedTargets; RestoreNuGetPackages"
DependsOnTargets="PrepareVersionInfo; ChooseProjectsToBuild; RestoreNuGetPackages"
Inputs="@(ProjectsToBuild)"
Outputs="%(PlatformIndependentName)">
@ -214,7 +121,7 @@
<BuildConfiguration Include="$(BuildConfigurations)" />
<!-- Generate the cartesian product of all projects * all platforms we are building -->
<CandidateProjects Include="@(WindowsProject);@(PhoneProject);@(UAPProject);@(AnyCPUProject)">
<CandidateProjects Include="@(UAPProject);@(AnyCPUProject)">
<Platform>%(BuildPlatform.Identity)</Platform>
</CandidateProjects>
@ -300,7 +207,6 @@
<Target Name="BuildDocs"
Condition="$(BuildDocs) and
$(BuildTools) and
$(BuildUAP) and
$(BuildPlatforms.Contains('AnyCPU')) and
$(BuildPlatforms.Contains('Win32')) and
$(BuildConfigurations.Contains('Release'))">
@ -369,20 +275,6 @@
</Target>
<Target Name="ListSkippedTargets">
<Warning Condition="'$(SkippedBuildWindows)' == 'true'"
Text="Skipped building for Windows 8.1 since Windows 8.1 SDK is not installed." />
<Warning Condition="'$(SkippedBuildPhone)' == 'true'"
Text="Skipped building for Windows Phone 8.1 since Windows 8.1 SDK is not installed." />
<Warning Condition="'$(SkippedBuildUAP)' == 'true' and '$(Has10Sdk)' != 'true'"
Text="Skipped building for Windows 10 UAP since Windows 10 SDK is not installed." />
<Warning Condition="'$(SkippedBuildUAP)' == 'true' and '$(Has10Sdk)' == 'true' and '$(RunningFrom2017Prompt)' != 'true'"
Text="Skipped building for Windows 10 UAP since not running from a MSBuild Command Prompt for VS2017" />
</Target>
<Import Project="$(MsBuildThisFileDirectory)build\nuget-restore.targets" />
</Project>

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

@ -2,30 +2,10 @@
SETLOCAL
IF "%VisualStudioVersion%" LSS "12.0" (
IF "%VisualStudioVersion%" LSS "15.0" (
GOTO WRONG_COMMAND_PROMPT
)
SET NO81=
SET NOUAP=
IF "%1" == "no81" (
SET NO81=1
) ELSE IF "%1" == "nouap" (
SET NOUAP=1
) ELSE IF "%1" NEQ "" (
GOTO SHOW_USAGE
)
IF NOT "%NOUAP%" == "1" (
IF "%VisualStudioVersion%" LSS "15.0" (
ECHO Warning: Visual Studio 2017 or higher required to build with Universal Windows Platform support.
ECHO Building without Universal Windows Platform support.
ECHO.
SET NOUAP=1
)
)
WHERE /Q msbuild >NUL
IF %ERRORLEVEL% NEQ 0 (
ECHO Error: It appears that 'msbuild' is not available in this environment.
@ -33,16 +13,7 @@ IF %ERRORLEVEL% NEQ 0 (
GOTO WRONG_COMMAND_PROMPT
)
SET BUILD_ARGS=
IF "%NO81%" == "1" (
SET BUILD_ARGS=/p:BuildWindows=false /p:BuildPhone=false
)
IF "%NOUAP%" == "1" (
SET BUILD_ARGS=/p:BuildUAP=false
)
msbuild "%~dp0Win2D.proj" /v:m /maxcpucount /nr:false /p:BuildTests=false /p:BuildTools=false /p:BuildDocs=false %BUILD_ARGS%
msbuild "%~dp0Win2D.proj" /v:m /maxcpucount /nr:false /p:BuildTests=false /p:BuildTools=false /p:BuildDocs=false
IF %ERRORLEVEL% NEQ 0 (
ECHO Build failed; aborting.
@ -58,27 +29,13 @@ IF %ERRORLEVEL% NEQ 0 (
ECHO.
CALL "%~dp0build\nuget\build-nupkg.cmd" %* local
CALL "%~dp0build\nuget\build-nupkg.cmd" local
GOTO END
:SHOW_USAGE
ECHO %0 [no81^|nouap]
ECHO.
ECHO no81: pass this to disable building Windows 8.1 and Windows Phone 8.1 support
ECHO nouap: pass this to disable building Universal Windows Platform support
GOTO END
:WRONG_COMMAND_PROMPT
ECHO Please run this script from the appropriate command prompt:
ECHO.
ECHO For Visual Studio 2013, building for Windows / Phone 8.1:
ECHO - Visual Studio 2013 Command Prompt
ECHO.
ECHO For Visual Studio 2017, building for Windows / Phone 8.1 and Universal Windows Platform:
ECHO - Developer Command Prompt for VS2017
ECHO Please run this script from a Developer Command Prompt for VS2017
ECHO.
PAUSE
GOTO END

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

@ -11,7 +11,6 @@
-->
<PropertyGroup>
<DeviceType Condition="'$(TargetPlatformIdentifier)' == 'WindowsPhoneApp'">Phone</DeviceType>
<DeviceType Condition="'$(DeviceType)' == ''">$(TargetPlatformIdentifier)</DeviceType>
</PropertyGroup>

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

@ -12,7 +12,7 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64" Condition="'$(ApplicationType)' != 'Windows Phone'">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
@ -24,24 +24,22 @@
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64" Condition="'$(ApplicationType)' != 'Windows Phone'">
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Configuration">
<PlatformToolset Condition="'$(ApplicationType)' == 'Windows Store' And '$(ApplicationTypeRevision)' == '8.1'">v120</PlatformToolset>
<PlatformToolset Condition="'$(ApplicationType)' == 'Windows Store' And '$(ApplicationTypeRevision)' == '10.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(ApplicationType)' == 'Windows Phone'">v120_wp81</PlatformToolset>
<PlatformToolset Condition="'$(ApplicationType)' == 'Windows Store' And '$(ApplicationTypeRevision)' == '10.0'">v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<PropertyGroup>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>/DNTDDI_VERSION=0x0A000003 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>

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

@ -15,9 +15,6 @@
<PropertyGroup>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
</PropertyGroup>

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

@ -29,7 +29,7 @@
<HeaderFileName Condition="'%(MidlRT.RenameHeaderTo)' != ''">$(IdlHeaderDirectory)\%(MidlRT.RenameHeaderTo)</HeaderFileName>
<ProxyFileName>$(IntDir)%(Filename)_p.c</ProxyFileName>
<InterfaceIdentifierFileName>$(IntDir)%(Filename)_i.c</InterfaceIdentifierFileName>
<AdditionalOptions>/target NT62</AdditionalOptions>
<MinimumTargetSystem>NT62</MinimumTargetSystem>
</Midl>
</ItemGroup>
</Target>

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

@ -36,7 +36,7 @@
</Target>
<Target Name="CheckNuGetVersion" Condition="'$(BuildUAP)' != '' AND '$(BuildUAP)'">
<Target Name="CheckNuGetVersion">
<Exec Command="$(NuGetCommand) help | findstr /i /c:&quot;NuGet Version&quot;"
CustomErrorRegularExpression="(?i)NuGet Version: [012]"

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

@ -33,19 +33,6 @@ IF %ERRORLEVEL% NEQ 0 (
SET /p VERSION=<VERSION
SET NO81=
SET NOUAP=
IF "%1" == "no81" (
SHIFT
SET NO81=1
)
IF "%1" == "nouap" (
SHIFT
SET NOUAP=1
)
IF "%1" == "signed" (
SHIFT
SET BIN=bin\signed
@ -70,15 +57,7 @@ SET NUGET_ARGS=^
-version %VERSION% ^
-properties bin=%BIN%;LicenseUrl=%LICENSE_URL%;RequireLicenseAcceptance=%REQUIRE_LICENSE_ACCEPTANCE%
IF NOT "%NO81%" == "1" (
nuget pack Win2D.win81.nuspec %NUGET_ARGS%
IF %ERRORLEVEL% NEQ 0 GOTO END
)
IF NOT "%NOUAP%" == "1" (
nuget pack Win2D.uwp.nuspec %NUGET_ARGS%
IF %ERRORLEVEL% NEQ 0 GOTO END
)
nuget pack Win2D.uwp.nuspec %NUGET_ARGS%
:END

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

@ -30,43 +30,8 @@ namespace CoreWindowExample
{
// Note: swapchain size & window size may not be exactly equal since they are represented with
// floating point numbers and are calculated via different code paths.
#if WINDOWS_PHONE_APP
// Windows Phone does not support ResizeBuffers for CoreWindow swap chains
//
var device = SwapChain.Device;
SwapChain.Dispose();
SwapChain = CanvasSwapChain.CreateForCoreWindow(device, window, dpi);
#else
SwapChain.ResizeBuffers((float)windowSize.Width, (float)windowSize.Height, dpi);
#endif
}
#if WINDOWS_PHONE_APP
var orientation = DisplayInformation.GetForCurrentView().CurrentOrientation;
CanvasSwapChainRotation rotation = CanvasSwapChainRotation.None;
switch (orientation)
{
case DisplayOrientations.Portrait:
rotation = CanvasSwapChainRotation.None;
break;
case DisplayOrientations.Landscape:
rotation = CanvasSwapChainRotation.Rotate270;
break;
case DisplayOrientations.LandscapeFlipped:
rotation = CanvasSwapChainRotation.Rotate90;
break;
case DisplayOrientations.PortraitFlipped:
rotation = CanvasSwapChainRotation.Rotate180;
break;
}
if (SwapChain.Rotation != rotation)
SwapChain.Rotation = rotation;
#endif
}
static public bool SizeEqualsWithTolerance(Size sizeA, Size sizeB)

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

@ -7,8 +7,6 @@ using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
namespace ExampleGallery
{
@ -17,10 +15,6 @@ namespace ExampleGallery
/// </summary>
public sealed partial class App : Application
{
#if WINDOWS_PHONE_APP
private TransitionCollection transitions;
#endif
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
@ -63,21 +57,6 @@ namespace ExampleGallery
if (rootFrame.Content == null)
{
#if WINDOWS_PHONE_APP
// Removes the turnstile navigation for startup.
if (rootFrame.ContentTransitions != null)
{
this.transitions = new TransitionCollection();
foreach (var c in rootFrame.ContentTransitions)
{
this.transitions.Add(c);
}
}
rootFrame.ContentTransitions = null;
rootFrame.Navigated += this.RootFrame_FirstNavigated;
#endif
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
@ -91,20 +70,6 @@ namespace ExampleGallery
Window.Current.Activate();
}
#if WINDOWS_PHONE_APP
/// <summary>
/// Restores the content transitions after the app has launched.
/// </summary>
/// <param name="sender">The object where the handler is attached.</param>
/// <param name="e">Details about the navigation event.</param>
private void RootFrame_FirstNavigated(object sender, NavigationEventArgs e)
{
var rootFrame = sender as Frame;
rootFrame.ContentTransitions = this.transitions ?? new TransitionCollection() { new NavigationThemeTransition() };
rootFrame.Navigated -= this.RootFrame_FirstNavigated;
}
#endif
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents

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

@ -76,18 +76,13 @@ namespace ExampleGallery
switch (BackgroundExecutionManager.GetAccessStatus())
{
case BackgroundAccessStatus.Unspecified:
#if WINDOWS_UWP
// DeniedByUser is new in OS version 14393.
case BackgroundAccessStatus.DeniedByUser:
// Denied was marked deprecated in 14393, but we must still handle it in case we are run on an older OS.
// Therefore we temporarily disable the deprecated API warning.
#pragma warning disable 618
#endif
case BackgroundAccessStatus.Denied:
#if WINDOWS_UWP
#pragma warning restore 618
#endif
return false;
default:

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

@ -3,14 +3,11 @@
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.Text;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
using System;
using System.Numerics;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Foundation;
using Windows.Storage;
@ -26,11 +23,6 @@ namespace ExampleGallery
public BitmapRotation()
{
this.InitializeComponent();
#if !WINDOWS_UWP
BitmapTypesList.Visibility = Visibility.Collapsed;
BitmapTypesLabel.Visibility = Visibility.Collapsed;
#endif
}
ICanvasImage[] testBitmaps;
@ -58,9 +50,7 @@ namespace ExampleGallery
public enum BitmapType
{
CanvasBitmap,
#if WINDOWS_UWP
CanvasVirtualBitmap
#endif
}
public enum BitmapSourceOption
@ -95,20 +85,16 @@ namespace ExampleGallery
{
if (bitmapType == BitmapType.CanvasBitmap)
newTestBitmaps[i] = await CanvasBitmap.LoadAsync(sender, stream);
#if WINDOWS_UWP
else
newTestBitmaps[i] = await CanvasVirtualBitmap.LoadAsync(sender, stream);
#endif
}
}
else
{
if (bitmapType == BitmapType.CanvasBitmap)
newTestBitmaps[i] = await CanvasBitmap.LoadAsync(sender, pathName);
#if WINDOWS_UWP
else
newTestBitmaps[i] = await CanvasVirtualBitmap.LoadAsync(sender, pathName);
#endif
}
}
@ -159,13 +145,11 @@ namespace ExampleGallery
{
ds.DrawImage(bitmap, cellRect);
}
#if WINDOWS_UWP
else
{
var virtualBitmap = image as CanvasVirtualBitmap;
ds.DrawImage(virtualBitmap, cellRect, virtualBitmap.Bounds);
}
#endif
}
else
{

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

@ -110,17 +110,7 @@ namespace ExampleGallery
rippleEffect.Properties["frequency"] = 0.15f;
rippleEffect.Properties["dpi"] = sender.Dpi;
#if WINDOWS_UWP
rippleEffect.Properties["center"] = tigerSize / 3;
#else
rippleEffect.Properties["center"] = (Microsoft.Graphics.Canvas.Numerics.Vector2)(tigerSize / 3);
// When compiling for Windows 8.1, we must explicitly convert vector and matrix values
// from System.Numerics to their Microsoft.Graphics.Canvas.Numerics equivalents before
// passing them to PixelShaderEffect.Properties. This is not neccessary when targetting
// UWP, which handles the conversion automatically. For more info, see the article:
// http://blogs.msdn.com/b/win2d/archive/2015/06/02/winrt-vector-and-matrix-types-in-windows-10.aspx
#endif
// Create other dissolve mask images.
CreateTurbulence();

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

@ -2,7 +2,6 @@
//
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Brushes;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.Graphics.Canvas.Text;
@ -11,18 +10,10 @@ using Microsoft.Graphics.Canvas.UI.Xaml;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Globalization;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
#if !WINDOWS_UWP
using Vector2 = Microsoft.Graphics.Canvas.Numerics.Vector2;
#endif
namespace ExampleGallery
{

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

@ -6,7 +6,6 @@
#include "TeapotRenderer.h"
using namespace ExampleGallery::Direct3DInterop;
using namespace Windows::Foundation::Numerics;
TeapotRenderer::TeapotRenderer(ICanvasResourceCreator^ resourceCreator)
@ -33,27 +32,21 @@ TeapotRenderer::TeapotRenderer(ICanvasResourceCreator^ resourceCreator)
}
void TeapotRenderer::SetWorld(Matrix4x4 value)
void TeapotRenderer::SetWorld(float4x4 value)
{
float4x4 temp(value);
m_basicEffect->SetWorld(XMLoadFloat4x4(&temp));
m_basicEffect->SetWorld(XMLoadFloat4x4(&value));
}
void TeapotRenderer::SetView(Matrix4x4 value)
void TeapotRenderer::SetView(float4x4 value)
{
float4x4 temp(value);
m_basicEffect->SetView(XMLoadFloat4x4(&temp));
m_basicEffect->SetView(XMLoadFloat4x4(&value));
}
void TeapotRenderer::SetProjection(Matrix4x4 value)
void TeapotRenderer::SetProjection(float4x4 value)
{
float4x4 temp(value);
m_basicEffect->SetProjection(XMLoadFloat4x4(&temp));
m_basicEffect->SetProjection(XMLoadFloat4x4(&value));
}

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

@ -11,18 +11,8 @@ namespace ExampleGallery
using namespace ::DirectX;
using namespace Microsoft::Graphics::Canvas;
using namespace Microsoft::WRL;
#if WINVER <= _WIN32_WINNT_WINBLUE
// On Windows 8.1, we must use the Microsoft::Graphics::Canvas::Numerics types
// when exchanging matrices between different WinRT components.
using namespace Microsoft::Graphics::Canvas::Numerics;
using namespace Microsoft::Graphics::Canvas::DirectX::Direct3D11;
#else
// On Windows 10, we can directly use the Windows::Foundation::Numerics::float4x4 type.
// See http://blogs.msdn.com/b/win2d/archive/2015/06/02/winrt-vector-and-matrix-types-in-windows-10.aspx
using Matrix4x4 = Windows::Foundation::Numerics::float4x4;
using namespace Windows::Foundation::Numerics;
using namespace Windows::Graphics::DirectX::Direct3D11;
#endif
// Interop helper shows how to mix Win2D with Direct3D rendering.
@ -34,9 +24,9 @@ namespace ExampleGallery
public:
TeapotRenderer(ICanvasResourceCreator^ resourceCreator);
void SetWorld(Matrix4x4 value);
void SetView(Matrix4x4 value);
void SetProjection(Matrix4x4 value);
void SetWorld(float4x4 value);
void SetView(float4x4 value);
void SetProjection(float4x4 value);
void SetTexture(IDirect3DSurface^ texture);

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

@ -10,12 +10,10 @@
#include <WindowsNumerics.h>
// DirectX headers.
#if WINVER > _WIN32_WINNT_WINBLUE
#include <d2d1_3.h>
#endif
#include <d2d1_2.h>
#include <d2d1helper.h>
#include <DirectXMath.h>
#include <Windows.Graphics.DirectX.Direct3D11.interop.h>
// DirectX Tool Kit headers.
#include <GeometricPrimitive.h>
@ -23,9 +21,3 @@
// Win2D headers.
#include <Microsoft.Graphics.Canvas.native.h>
#if WINVER <= _WIN32_WINNT_WINBLUE
#include <Microsoft.Graphics.Canvas.DirectX.Direct3D11.interop.h>
#else
#include <Windows.Graphics.DirectX.Direct3D11.interop.h>
#endif

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

@ -31,9 +31,7 @@ namespace ExampleGallery
DefaultDpiBitmap,
HighDpiBitmap,
LowDpiBitmap,
#if WINDOWS_UWP
VirtualBitmap,
#endif
}
public enum IntermediateMode
@ -75,12 +73,6 @@ namespace ExampleGallery
const float lowDpi = 48;
#if !WINDOWS_UWP
// dummy CanvasVirtualBitmap type to simplify some of the ifdefs
class CanvasVirtualBitmap { }
#endif
// We need two copies of all these graphics resources, one for the main CanvasDevice used on the
// UI thread, plus a second set for use by the CanvasAnimatedControl which runs on a separate thread.
class PerDeviceResources
@ -447,7 +439,6 @@ namespace ExampleGallery
ICanvasImage GetSourceBitmap(PerDeviceResources resources)
{
#if WINDOWS_UWP
if (CurrentSource == SourceMode.VirtualBitmap)
{
var virtualBitmap = resources.VirtualBitmap;
@ -455,7 +446,6 @@ namespace ExampleGallery
resources.AddMessage("VirtualBitmap (dpi: 96, size: {0}, pixels: {1},{2} ->\n", virtualBitmap.Size, pixels.Width, pixels.Height);
return resources.VirtualBitmap;
}
#endif
CanvasBitmap bitmap;
@ -525,17 +515,12 @@ namespace ExampleGallery
static async Task<CanvasVirtualBitmap> CreateTestVirtualBitmap(ICanvasResourceCreatorWithDpi resourceCreator)
{
#if WINDOWS_UWP
var canvasBitmap = CreateTestBitmap(resourceCreator, 96);
var stream = new InMemoryRandomAccessStream();
await canvasBitmap.SaveAsync(stream, CanvasBitmapFileFormat.Png);
return await CanvasVirtualBitmap.LoadAsync(resourceCreator, stream);
#else
await Task.Yield(); // prevent warning about no await in async method
return new CanvasVirtualBitmap();
#endif
}

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

@ -2,14 +2,13 @@
//
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
#if WINDOWS_UWP
using Windows.Graphics.DirectX;
#else
using Microsoft.Graphics.Canvas.DirectX;
#endif
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Brushes;
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.Graphics.Canvas.Text;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -18,14 +17,10 @@ using System.Reflection;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Foundation;
using Windows.Graphics.DirectX;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Microsoft.Graphics.Canvas.UI.Xaml;
using Microsoft.Graphics.Canvas.Brushes;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.Graphics.Canvas.Text;
namespace ExampleGallery

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

@ -3,6 +3,7 @@
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Brushes;
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.Text;
using Microsoft.Graphics.Canvas.UI;
@ -15,14 +16,10 @@ using System.Numerics;
using System.Reflection;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.Effects;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Microsoft.Graphics.Canvas.Brushes;
#if WINDOWS_UWP
using Windows.Graphics.Effects;
#endif
namespace ExampleGallery
{
@ -51,7 +48,6 @@ namespace ExampleGallery
Shadow,
Tile,
Transform3D,
#if WINDOWS_UWP
AlphaMask,
ChromaKey,
Contrast,
@ -72,7 +68,6 @@ namespace ExampleGallery
TemperatureAndTint,
Tint,
Vignette,
#endif
}
public EffectsExample()
@ -260,10 +255,6 @@ namespace ExampleGallery
effect = CreateTransform3D();
break;
#if WINDOWS_UWP
// The following effects are new in the Universal Windows Platform.
// They are not supported on Windows 8.1 or Phone 8.1.
case EffectType.AlphaMask:
effect = CreateAlphaMask();
break;
@ -344,8 +335,6 @@ namespace ExampleGallery
effect = CreateVignette();
break;
#endif // WINDOWS_UWP
default:
throw new NotSupportedException();
}
@ -1056,9 +1045,6 @@ namespace ExampleGallery
return transformEffect;
}
#if WINDOWS_UWP
const string requiresWin10 = "This effect is new in the\nUniversal Windows Platform.\nIt is not supported on \nWindows 8.1 or Phone 8.1.";
const string requiresWin10_14393 = "This effect is new in\nWindows 10 Anniversary Update.\nIt is not supported on\nolder versions of Windows.";
private ICanvasImage CreateAlphaMask()
@ -1106,8 +1092,6 @@ namespace ExampleGallery
private ICanvasImage CreateChromaKey()
{
textLabel = requiresWin10;
var chromaKeyEffect = new ChromaKeyEffect
{
Source = bitmapTiger,
@ -1132,8 +1116,6 @@ namespace ExampleGallery
private ICanvasImage CreateContrast()
{
textLabel = requiresWin10;
var contrastEffect = new ContrastEffect
{
Source = bitmapTiger
@ -1180,8 +1162,6 @@ namespace ExampleGallery
private ICanvasImage CreateEdgeDetection()
{
textLabel = requiresWin10;
var edgeDetectionEffect = new EdgeDetectionEffect
{
Source = bitmapTiger
@ -1199,8 +1179,6 @@ namespace ExampleGallery
private ICanvasImage CreateEmboss()
{
textLabel = requiresWin10;
var embossEffect = new EmbossEffect
{
Source = bitmapTiger
@ -1218,8 +1196,6 @@ namespace ExampleGallery
private ICanvasImage CreateExposure()
{
textLabel = requiresWin10;
var exposureEffect = new ExposureEffect
{
Source = bitmapTiger
@ -1236,8 +1212,6 @@ namespace ExampleGallery
private ICanvasImage CreateGrayscale()
{
textLabel = requiresWin10;
animationFunction = elapsedTime => { };
return new GrayscaleEffect
@ -1248,8 +1222,6 @@ namespace ExampleGallery
private ICanvasImage CreateHighlightsAndShadows()
{
textLabel = requiresWin10;
var highlightsAndShadowsEffect = new HighlightsAndShadowsEffect
{
Source = bitmapTiger
@ -1268,8 +1240,6 @@ namespace ExampleGallery
private ICanvasImage CreateInvert()
{
textLabel = requiresWin10;
animationFunction = elapsedTime => { };
return new InvertEffect
@ -1309,8 +1279,6 @@ namespace ExampleGallery
private ICanvasImage CreatePosterize()
{
textLabel = requiresWin10;
var posterizeEffect = new PosterizeEffect
{
Source = bitmapTiger
@ -1329,8 +1297,6 @@ namespace ExampleGallery
private ICanvasImage CreateRgbToHue()
{
textLabel = requiresWin10;
// Convert the input image from RGB to HSV color space.
var rgbToHueEffect = new RgbToHueEffect
{
@ -1372,8 +1338,6 @@ namespace ExampleGallery
private ICanvasImage CreateSepia()
{
textLabel = requiresWin10;
var sepiaEffect = new SepiaEffect
{
Source = bitmapTiger
@ -1390,8 +1354,6 @@ namespace ExampleGallery
private ICanvasImage CreateSharpen()
{
textLabel = requiresWin10;
var sharpenEffect = new SharpenEffect
{
Source = bitmapTiger
@ -1408,8 +1370,6 @@ namespace ExampleGallery
private ICanvasImage CreateStraighten()
{
textLabel = requiresWin10;
var straightenEffect = new StraightenEffect
{
Source = bitmapTiger,
@ -1427,8 +1387,6 @@ namespace ExampleGallery
private ICanvasImage CreateTableTransfer3D()
{
textLabel = requiresWin10;
animationFunction = elapsedTime => { };
var transferTable = CreateTransferTableFromFunction(canvas, 16, 16, 16, DesaturateAllButTheReds);
@ -1487,8 +1445,6 @@ namespace ExampleGallery
private ICanvasImage CreateTemperatureAndTint()
{
textLabel = requiresWin10;
var temperatureAndTintEffect = new TemperatureAndTintEffect
{
Source = bitmapTiger
@ -1533,8 +1489,6 @@ namespace ExampleGallery
private ICanvasImage CreateVignette()
{
textLabel = requiresWin10;
var vignetteEffect = new VignetteEffect
{
Source = bitmapTiger
@ -1605,8 +1559,6 @@ namespace ExampleGallery
return commandList;
}
#endif // WINDOWS_UWP
private ICanvasImage AddSoftEdgedCrop(ICanvasImage effect)
{
var size = bitmapTiger.Size;

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

@ -16,11 +16,6 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
#if !WINDOWS_UWP
using Vector2 = Microsoft.Graphics.Canvas.Numerics.Vector2;
using Matrix3x2 = Microsoft.Graphics.Canvas.Numerics.Matrix3x2;
#endif
namespace ExampleGallery
{
public sealed partial class FontMetrics : UserControl

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

@ -216,13 +216,7 @@ namespace ExampleGallery
float animationDistanceThisFrame = CurrentContourTracingAnimation == ContourTracingAnimationOption.Slow ? 1.0f : 20.0f;
currentDistanceOnContourPath = (currentDistanceOnContourPath + animationDistanceThisFrame) % totalDistanceOnContourPath;
#if WINDOWS_UWP
Vector2 outTangent;
#else
Microsoft.Graphics.Canvas.Numerics.Vector2 outTangent;
#endif
pointOnContourPath = combinedGeometry.ComputePointOnPath(currentDistanceOnContourPath, out outTangent);
tangentOnContourPath = outTangent;
pointOnContourPath = combinedGeometry.ComputePointOnPath(currentDistanceOnContourPath, out tangentOnContourPath);
}
}

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

@ -11,16 +11,9 @@ using System;
using System.Collections.Generic;
using System.Numerics;
using Windows.Foundation;
using Windows.Globalization;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
#if !WINDOWS_UWP
using Vector2 = Microsoft.Graphics.Canvas.Numerics.Vector2;
using Matrix3x2 = Microsoft.Graphics.Canvas.Numerics.Matrix3x2;
#endif
//
// This example has some similar features to the TextOutlines demo.

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

@ -72,20 +72,6 @@ namespace ExampleGallery
static IconInfo[] requiredIcons =
{
new IconInfo("Windows", "Logo.scale-100.png", 150, 150) { BottomPadding = 0.25f },
new IconInfo("Windows", "Wide310x150Logo.scale-100.png", 310, 150) { BottomPadding = 0.25f },
new IconInfo("Windows", "SmallLogo.scale-100.png", 30, 30),
new IconInfo("Windows", "SplashScreen.scale-100.png", 620, 300) { BottomPadding = 0.1f, TransparentBackground = true },
new IconInfo("Windows", "StoreLogo.scale-100.png", 50, 50),
new IconInfo("Windows", "BadgeLogo.scale-100.png", 24, 24) { TransparentBackground = true, Monochrome = true },
new IconInfo("WindowsPhone", "Logo.scale-240.png", 360, 360) { BottomPadding = 0.25f },
new IconInfo("WindowsPhone", "WideLogo.scale-240.png", 744, 360) { BottomPadding = 0.25f },
new IconInfo("WindowsPhone", "SmallLogo.scale-240.png", 106, 106),
new IconInfo("WindowsPhone", "Square71x71Logo.scale-240.png", 170, 170),
new IconInfo("WindowsPhone", "SplashScreen.scale-240.png", 1152, 1920) { TransparentBackground = true},
new IconInfo("WindowsPhone", "StoreLogo.scale-240.png", 120, 120),
new IconInfo("UAP", "Logo.scale-100.png", 150, 150) { BottomPadding = 0.25f },
new IconInfo("UAP", "WideLogo.scale-100.png", 310, 150) { BottomPadding = 0.25f },
new IconInfo("UAP", "SmallLogo.scale-100.png", 44, 44),

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

@ -94,7 +94,7 @@ namespace ExampleGallery
}
}
#if WINDOWS_UWP
// VirtualBitmapExample needs the user to pick an image, so we need to draw our own thumbnail
partial class VirtualBitmapExample : ICustomThumbnailSource
{
@ -106,5 +106,4 @@ namespace ExampleGallery
}
}
}
#endif
}

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

@ -55,11 +55,6 @@ namespace ExampleGallery
async Task<StorageFolder> PickOutputFolder(string title)
{
#if WINDOWS_PHONE_APP
await new MessageDialog("Not supported on Windows Phone. Please run on a Windows PC instead.").ShowAsync();
return null;
#else
var folderPicker = new FolderPicker
{
CommitButtonText = title,
@ -68,7 +63,6 @@ namespace ExampleGallery
};
return await folderPicker.PickSingleFolderAsync();
#endif
}
public CanvasDebugLevel DebugLevel

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

@ -47,14 +47,10 @@ namespace ExampleGallery
new ExampleDefinition("Burning Text", typeof(BurningTextExample)),
new ExampleDefinition("Mandelbrot", typeof(Mandelbrot)),
new ExampleDefinition("Game of Life", typeof(GameOfLife)),
#if WINDOWS_UWP
new ExampleDefinition("Camera Effect", typeof(CameraEffectExample)),
new ExampleDefinition("Video Effect", typeof(BasicVideoEffectExample)),
#endif
new ExampleDefinition("Particle System", typeof(ParticleExample)),
#if WINDOWS_UWP
new ExampleDefinition("Sprite Sheets", typeof(SpriteSheets)),
#endif
new ExampleDefinition("Vector Art", typeof(VectorArt)),
// Show capabilities of the API.
@ -62,16 +58,12 @@ namespace ExampleGallery
new ExampleDefinition("Custom Effects", typeof(CustomEffects)),
new ExampleDefinition("Geometry Operations", typeof(GeometryOperations)),
new ExampleDefinition("Layers", typeof(LayersExample)),
#if WINDOWS_UWP
new ExampleDefinition("Ink", typeof(InkExample)),
#endif
new ExampleDefinition("Shapes", typeof(ShapesExample)),
new ExampleDefinition("Stroke Styles", typeof(StrokeStyles)),
new ExampleDefinition("Arc Options", typeof(ArcOptions)),
#if WINDOWS_UWP
new ExampleDefinition("SVG", typeof(SvgExample)),
new ExampleDefinition("Gradient Mesh", typeof(GradientMeshExample)),
#endif
new ExampleDefinition("Histogram", typeof(HistogramExample)),
new ExampleDefinition("Text Layouts", typeof(TextLayouts)),
new ExampleDefinition("Text Outlines", typeof(TextOutlines)),
@ -87,15 +79,11 @@ namespace ExampleGallery
new ExampleDefinition("Custom Control", typeof(CustomControlExample)),
new ExampleDefinition("Virtual Control", typeof(VirtualControlExample)),
new ExampleDefinition("Animated Control", typeof(AnimatedControlExample)),
#if WINDOWS_UWP
new ExampleDefinition("Virtual Bitmap", typeof(VirtualBitmapExample)),
#endif
new ExampleDefinition("Direct3D Interop", typeof(Direct3DInteropExample)),
new ExampleDefinition("Keyboard Input", typeof(KeyboardInputExample)),
new ExampleDefinition("Background Task", typeof(BackgroundTaskExample)),
#if !WINDOWS_PHONE_APP
new ExampleDefinition("Printing", typeof(PrintingExample)),
#endif
// Tests for internal use by the Win2D team.
new ExampleDefinition("Image Source Update Region", typeof(ImageSourceUpdateRegion)),
@ -104,9 +92,7 @@ namespace ExampleGallery
new ExampleDefinition("Control Transforms", typeof(ControlTransforms)),
new ExampleDefinition("DrawImage Emulations", typeof(DrawImageEmulations)),
new ExampleDefinition("Bitmap Rotation", typeof(BitmapRotation)),
#if WINDOWS_UWP
new ExampleDefinition("SpriteBatch Performance", typeof(SpriteBatchPerf)),
#endif
new ExampleDefinition("Developer Tools", typeof(DeveloperTools)),
new ExampleDefinition("About", typeof(About)),
};

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

@ -4,10 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
@ -76,26 +72,15 @@ namespace ExampleGallery
{
this.Page = page;
#if WINDOWS_APP
this.HasHardwareButtons = false;
#else
this.HasHardwareButtons = true;
#endif
// When this page is part of the visual tree make two changes:
// 1) Map application view state to visual state for the page
// 2) Handle hardware navigation requests
this.Page.Loaded += (sender, e) =>
{
#if WINDOWS_PHONE_APP
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
#endif
#if WINDOWS_UWP
Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += NavigationHelper_BackRequested;
#endif
#if !WINDOWS_PHONE_APP
// Keyboard and mouse navigation only apply when occupying the entire window
if (this.Page.ActualHeight == Window.Current.Bounds.Height &&
this.Page.ActualWidth == Window.Current.Bounds.Width)
@ -106,26 +91,17 @@ namespace ExampleGallery
Window.Current.CoreWindow.PointerPressed +=
this.CoreWindow_PointerPressed;
}
#endif
};
// Undo the same changes when the page is no longer visible
this.Page.Unloaded += (sender, e) =>
{
#if WINDOWS_PHONE_APP
Windows.Phone.UI.Input.HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
#endif
#if WINDOWS_UWP
Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested -= NavigationHelper_BackRequested;
#endif
#if !WINDOWS_PHONE_APP
Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated -=
CoreDispatcher_AcceleratorKeyActivated;
Window.Current.CoreWindow.PointerPressed -=
this.CoreWindow_PointerPressed;
#endif
};
}
@ -225,23 +201,6 @@ namespace ExampleGallery
if (this.Frame != null && this.Frame.CanGoForward) this.Frame.GoForward();
}
#if WINDOWS_PHONE_APP
/// <summary>
/// Invoked when the hardware back button is pressed. For Windows Phone only.
/// </summary>
/// <param name="sender">Instance that triggered the event.</param>
/// <param name="e">Event data describing the conditions that led to the event.</param>
private void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
if (this.GoBackCommand.CanExecute(null))
{
e.Handled = true;
this.GoBackCommand.Execute(null);
}
}
#endif
#if WINDOWS_UWP
private void NavigationHelper_BackRequested(object sender, BackRequestedEventArgs e)
{
if (this.GoBackCommand.CanExecute(null))
@ -250,9 +209,7 @@ namespace ExampleGallery
this.GoBackCommand.Execute(null);
}
}
#endif
#if !WINDOWS_PHONE_APP
/// <summary>
/// Invoked on every keystroke, including system keys such as Alt key combinations, when
/// this page is active and occupies the entire window. Used to detect keyboard navigation
@ -324,7 +281,6 @@ namespace ExampleGallery
if (forwardPressed) this.GoForwardCommand.Execute(null);
}
}
#endif
#endregion
@ -355,9 +311,7 @@ namespace ExampleGallery
/// property provides the group to be displayed.</param>
public void OnNavigatedTo(NavigationEventArgs e)
{
#if WINDOWS_UWP
Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = CanGoBack() ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
#endif
var frameState = SuspensionManager.SessionStateForFrame(this.Frame);
this._pageKey = "Page-" + this.Frame.BackStackDepth;

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

@ -2,14 +2,10 @@
//
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
#if WINDOWS_UWP
using Windows.Graphics.DirectX;
#else
using Microsoft.Graphics.Canvas.DirectX;
#endif
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -20,7 +16,9 @@ using System.Reflection;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.DirectX;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.UI;
using Windows.UI.Core;
using Windows.UI.Popups;
@ -28,9 +26,6 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.Storage.Streams;
using Microsoft.Graphics.Canvas.UI.Xaml;
using Microsoft.Graphics.Canvas.UI;
namespace ExampleGallery
{

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

@ -62,17 +62,7 @@ namespace ExampleGallery
var transformedPoints = from point in points
select point * scale + center;
#if WINDOWS_UWP
var convertedPoints = transformedPoints;
#else
// Convert the System.Numerics.Vector2 type that we normally work with to the
// Microsoft.Graphics.Canvas.Numerics.Vector2 struct used by WinRT. These casts
// are usually inserted automatically, but auto conversion does not work for arrays.
var convertedPoints = from point in transformedPoints
select (Microsoft.Graphics.Canvas.Numerics.Vector2)point;
#endif
return CanvasGeometry.CreatePolygon(resourceCreator, convertedPoints.ToArray());
return CanvasGeometry.CreatePolygon(resourceCreator, transformedPoints.ToArray());
}
public static float DegreesToRadians(float angle)

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

@ -27,9 +27,7 @@ namespace ExampleGallery
{
LetterAttack.Game game;
#if WINDOWS_PHONE_APP || WINDOWS_UWP
InputPane inputPane;
#endif
public KeyboardInputExample()
{
@ -42,7 +40,6 @@ namespace ExampleGallery
// Register for keyboard events
Window.Current.CoreWindow.KeyDown += KeyDown_UIThread;
#if WINDOWS_PHONE_APP || WINDOWS_UWP
var keyboardCaps = new Windows.Devices.Input.KeyboardCapabilities();
if (keyboardCaps.KeyboardPresent == 0)
{
@ -52,18 +49,15 @@ namespace ExampleGallery
inputPane.Showing += inputPane_Showing;
inputPane.Hiding += inputPane_Hiding;
}
#endif
}
private void animatedControl_PointerPressed(object sender, PointerRoutedEventArgs e)
{
#if WINDOWS_PHONE_APP || WINDOWS_UWP
// Bring the on-screen keyboard back up when the user taps on the screen.
if (inputPane != null)
{
inputPane.TryShow();
}
#endif
}
private void control_Unloaded(object sender, RoutedEventArgs e)
@ -71,14 +65,12 @@ namespace ExampleGallery
// Unregister keyboard events
Window.Current.CoreWindow.KeyDown -= KeyDown_UIThread;
#if WINDOWS_PHONE_APP || WINDOWS_UWP
if (inputPane != null)
{
inputPane.Showing -= inputPane_Showing;
inputPane.Hiding -= inputPane_Hiding;
inputPane.TryHide();
}
#endif
// Explicitly remove references to allow the Win2D controls to get garbage collected
animatedControl.RemoveFromVisualTree();

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

@ -70,11 +70,7 @@ namespace ExampleGallery
Vector2 translate = baseScale * sender.Size.ToVector2() * new Vector2(-0.75f, -0.5f);
mandelbrotEffect.Properties["scale"] = scale;
#if WINDOWS_UWP
mandelbrotEffect.Properties["translate"] = translate;
#else
mandelbrotEffect.Properties["translate"] = (Microsoft.Graphics.Canvas.Numerics.Vector2)translate;
#endif
// Draw the effect to whatever regions of the CanvasVirtualControl have been invalidated.
foreach (var region in args.InvalidatedRegions)

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

@ -60,11 +60,7 @@ namespace ExampleGallery
if (args.Reason == CanvasCreateResourcesReason.FirstTime)
{
bool spriteBatchSupported = false;
#if WINDOWS_UWP
spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);
#endif
bool spriteBatchSupported = CanvasSpriteBatch.IsSupported(sender.Device);
UseSpriteBatch = spriteBatchSupported;
if (PropertyChanged != null)

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

@ -190,7 +190,6 @@ namespace ExampleGallery
drawingSession.Blend = blendState;
#if WINDOWS_UWP
if (useSpriteBatch)
{
using (var spriteBatch = drawingSession.CreateSpriteBatch())
@ -202,19 +201,12 @@ namespace ExampleGallery
{
Draw(drawingSession, null);
}
#else
Draw(drawingSession);
#endif
drawingSession.Blend = previousBlend;
}
void Draw(CanvasDrawingSession drawingSession
#if WINDOWS_UWP
, CanvasSpriteBatch spriteBatch
#endif
)
void Draw(CanvasDrawingSession drawingSession, CanvasSpriteBatch spriteBatch)
{
// Go through the particles in reverse order, so new ones are drawn underneath
// older ones. This improves visual appearance of effects like smoke plume
@ -244,13 +236,11 @@ namespace ExampleGallery
// They'll start at 75% of their size, and increase to 100% once they're finished.
float scale = particle.Scale * (.75f + .25f * normalizedLifetime);
#if WINDOWS_UWP
if (spriteBatch != null)
{
spriteBatch.Draw(bitmap, particle.Position, new Vector4(1, 1, 1, alpha), bitmapCenter, particle.Rotation, new Vector2(scale), CanvasSpriteFlip.None);
}
else
#endif
{
// Compute a transform matrix for this particle.
var transform = Matrix3x2.CreateRotation(particle.Rotation, bitmapCenter) *

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

@ -3,6 +3,7 @@
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Printing;
using Microsoft.Graphics.Canvas.Text;
using System;
using System.Collections.Generic;
@ -10,40 +11,16 @@ using System.Numerics;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Foundation;
using Windows.Graphics.Printing;
using Windows.Graphics.Printing.OptionDetails;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#if !WINDOWS_PHONE_APP
using Microsoft.Graphics.Canvas.Printing;
using Windows.Graphics.Printing;
using Windows.Graphics.Printing.OptionDetails;
#endif
namespace ExampleGallery
{
public sealed partial class PrintingExample : UserControl
{
public PrintingExample()
{
this.InitializeComponent();
}
#if WINDOWS_PHONE_APP
// This example is disabled for Windows Phone (since it doesn't support printing), so
// we just have empty stubs here to allow compilation to succeed.
void OnPrintClicked(object sender, RoutedEventArgs e)
{
}
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
{
}
#else
CanvasPrintDocument printDocument;
struct BitmapInfo
@ -66,6 +43,12 @@ namespace ExampleGallery
int pageCount = -1;
public PrintingExample()
{
this.InitializeComponent();
}
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
{
if (printDocument != null)
@ -366,8 +349,5 @@ namespace ExampleGallery
ds.FillRectangle(rect, Colors.White);
ds.DrawTextLayout(textLayout, paddedTopLeft, Colors.Black);
}
#endif
}
}

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

@ -37,7 +37,7 @@ goto END
exit /b
:WRONG_COMMAND_PROMPT
echo Please run from a Developer Command Prompt for VS2015.
echo Please run from a Developer Command Prompt for VS2017.
:END
popd

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

@ -1,7 +1,7 @@
This folder contains custom pixel shaders for use by PixelShaderEffect.
The *.hlsl files contain HLSL shader source code. After editing these shaders,
run CompileShaders.cmd from a Developer Command Prompt for VS2015.
run CompileShaders.cmd from a Developer Command Prompt for VS2017.
This will recompile them, generating the *.bin output binaries.
The *.bin files are included as part of Example Gallery.

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

@ -17,11 +17,6 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
#if !WINDOWS_UWP
using Vector2 = Microsoft.Graphics.Canvas.Numerics.Vector2;
using Matrix3x2 = Microsoft.Graphics.Canvas.Numerics.Matrix3x2;
#endif
namespace ExampleGallery
{
//

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

@ -17,10 +17,6 @@ using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#if !WINDOWS_UWP
using Vector2 = Microsoft.Graphics.Canvas.Numerics.Vector2;
#endif
namespace ExampleGallery
{
public sealed partial class TextLayouts : UserControl

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

@ -10,16 +10,9 @@ using System;
using System.Collections.Generic;
using System.Numerics;
using Windows.Foundation;
using Windows.Globalization;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
#if !WINDOWS_UWP
using Vector2 = Microsoft.Graphics.Canvas.Numerics.Vector2;
using Matrix3x2 = Microsoft.Graphics.Canvas.Numerics.Matrix3x2;
#endif
namespace ExampleGallery
{

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

@ -4,7 +4,6 @@
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Brushes;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.Graphics.Canvas.Text;
using Microsoft.Graphics.Canvas.UI;
using Microsoft.Graphics.Canvas.UI.Xaml;
@ -17,12 +16,6 @@ using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
#if !WINDOWS_UWP
using Vector2 = Microsoft.Graphics.Canvas.Numerics.Vector2;
using Matrix3x2 = Microsoft.Graphics.Canvas.Numerics.Matrix3x2;
#endif
namespace ExampleGallery
{
public sealed partial class TypographyExample : UserControl, INotifyPropertyChanged

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

@ -1,3 +1,3 @@
@echo off
msbuild "%~dp0Win2D.proj" /v:n /maxcpucount /nr:false /p:BuildPlatforms="x64;AnyCPU" /p:BuildConfigurations=Debug /p:BuildPhone=false /p:BuildDocs=false %*
msbuild "%~dp0Win2D.proj" /v:n /maxcpucount /nr:false /p:BuildPlatforms="x64;AnyCPU" /p:BuildConfigurations=Debug /p:BuildDocs=false %*

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

@ -1 +1 @@
msbuild %~dp0..\..\win2d.proj /p:BuildPlatforms="Win32;AnyCPU" /p:BuildConfigurations=Release /p:BuildPhone=false /p:BuildWindows=false /p:BuildUAP=true /p:BuildTests=false
msbuild %~dp0..\..\win2d.proj /p:BuildPlatforms="Win32;AnyCPU" /p:BuildConfigurations=Release /p:BuildTests=false

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

@ -12,7 +12,7 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license
<Sample Source="samples\CoreWindowExample" Destination="CoreWindowExample" />
<Sample Source="samples\ExampleGallery" Destination="ExampleGallery" />
<Sample Source="samples\SimpleSample" Destination="SimpleSample" />
<Sample Source="samples\CompositionExample" Destination="CompositionExample\UAP" />
<Sample Source="samples\CompositionExample" Destination="CompositionExample" />
<Property Name="AssetDir" Value="build\assets\" />

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

@ -39,8 +39,8 @@ namespace exportsample
void CleanDestinationDirectory()
{
// Delete all the directories under the sample (leaving any files in the root). This is to allow
// us to catch (re)moved files.
// Delete all the directories and files under the sample (except for the .sln, which is
// unique to the exported samples repro). This is to allow us to catch (re)moved files.
if (!Directory.Exists(sample.Destination))
return;
@ -48,6 +48,14 @@ namespace exportsample
{
Directory.Delete(dir, true);
}
foreach (var file in Directory.EnumerateFiles(sample.Destination))
{
if (Path.GetExtension(file) != ".sln")
{
File.Delete(file);
}
}
}
void ExportSampleProjects()

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

@ -1,6 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "codegen.exe", "codegen\exe\codegen.exe.csproj", "{984ABFAE-12D5-4929-AF2B-A733341BCCCF}"
EndProject

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

@ -473,9 +473,6 @@
<None Include="$(MSBuildThisFileDirectory)effects\generated\OpacityEffect.abi.idl" />
<None Include="$(MSBuildThisFileDirectory)effects\generated\TintEffect.abi.idl" />
</ItemGroup>
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<Import Project="$(MSBuildThisFileDir)..\..\build\midlrt.targets" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\build\Win2D.cpp.targets" />

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

@ -1522,7 +1522,6 @@ public:
virtual IRandomAccessStream^ CloneStream()
{
Assert::Fail(); // Not impl
return nullptr;
}
};
@ -1641,7 +1640,6 @@ public:
virtual IRandomAccessStream^ CloneStream()
{
Assert::Fail(); // Not impl
return nullptr;
}
};
@ -1892,7 +1890,7 @@ public:
, BlocksHigh(Height / 4)
, Data(ref new Platform::Array<uint8_t>(BlocksWide * BlocksHigh * GetBytesPerBlock(Format)))
{
std::fill(begin(Data), end(Data), 0);
std::fill(begin(Data), end(Data), static_cast<uint8_t>(0));
}
CanvasBitmap^ CreateBitmap()

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

@ -210,7 +210,6 @@ TEST_CLASS(CanvasFontFaceTests)
}
Assert::Fail();
return nullptr;
}
TEST_METHOD(CanvasFontFace_Interop)

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

@ -722,8 +722,8 @@ public:
virtual float get() { return m_dpi; }
}
virtual float ConvertPixelsToDips(int pixels) { Assert::Fail(L"Not implemented"); return 0; }
virtual int ConvertDipsToPixels(float dips, CanvasDpiRounding roundingBehavior) { Assert::Fail(L"Not implemented"); return 0; }
virtual float ConvertPixelsToDips(int pixels) { Assert::Fail(L"Not implemented"); }
virtual int ConvertDipsToPixels(float dips, CanvasDpiRounding roundingBehavior) { Assert::Fail(L"Not implemented"); }
};

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

@ -16,9 +16,6 @@
</PropertyGroup>
<Import Project="..\..\build\Win2D.cpp.props" />
<ItemGroup>
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>