From 1c09a7c90e413c6897b97aa77af28dfdcc180e1b Mon Sep 17 00:00:00 2001 From: Alexandre Mutel Date: Wed, 19 Mar 2014 00:11:35 +0900 Subject: [PATCH] [Samples] Fix issue #307. Add XAML SurfaceImageSource DirectX interop sample (WIP) --- .../Properties/AssemblyInfo.cs | 29 + .../Scenario1Component.csproj | 132 + .../Scenario1ImageSource.cs | 205 + .../C#/Scenario2Component/CompileShaders.bat | 2 + .../Properties/AssemblyInfo.cs | 29 + .../Scenario2Component.csproj | 148 + .../Scenario2ImageSource.cs | 376 ++ .../Scenario2Component/SimplePixelShader.cso | Bin 0 -> 576 bytes .../Scenario2Component/SimplePixelShader.hlsl | 19 + .../Scenario2Component/SimpleVertexShader.cso | Bin 0 -> 1548 bytes .../SimpleVertexShader.hlsl | 45 + .../C#/SurfaceImageSource.sln | 80 + .../C#/SurfaceImageSource/App.xaml | 23 + .../C#/SurfaceImageSource/App.xaml.cs | 93 + .../Assets/placeholder-sdk.png | Bin 0 -> 8991 bytes .../Assets/smallTile-sdk.png | Bin 0 -> 1248 bytes .../SurfaceImageSource/Assets/splash-sdk.png | Bin 0 -> 5068 bytes .../Assets/squareTile-sdk.png | Bin 0 -> 2482 bytes .../Assets/storeLogo-sdk.png | Bin 0 -> 1550 bytes .../C#/SurfaceImageSource/Assets/tile-sdk.png | Bin 0 -> 2665 bytes .../SurfaceImageSource/Assets/windows-sdk.png | Bin 0 -> 2997 bytes .../C#/SurfaceImageSource/Constants.cs | 46 + .../C#/SurfaceImageSource/MainPage.xaml | 144 + .../C#/SurfaceImageSource/MainPage.xaml.cs | 294 ++ .../SurfaceImageSource/Package.appxmanifest | 28 + .../Properties/AssemblyInfo.cs | 29 + .../C#/SurfaceImageSource/Scenario1.xaml | 55 + .../C#/SurfaceImageSource/Scenario1.xaml.cs | 86 + .../C#/SurfaceImageSource/Scenario2.xaml | 56 + .../C#/SurfaceImageSource/Scenario2.xaml.cs | 96 + .../SurfaceImageSource.csproj | 179 + .../SurfaceImageSource_TemporaryKey.pfx | Bin 0 -> 2512 bytes .../common/LayoutAwarePage.cs | 542 +++ .../common/StandardStyles.xaml | 967 +++++ .../sample-utils/SampleTemplateStyles.xaml | 41 + .../sample-utils/SuspensionManager.cs | 255 ++ .../description.html | 213 + ...ffc16-8ecc-4161-a697-6a5fd8338d8dBrand.css | 311 ++ .../description/Brand.css | 3615 +++++++++++++++++ .../description/Combined.css | 0 .../description/Galleries.css | 417 ++ .../description/Layout.css | 147 + ...3f-24e4-42dc-8672-b8aca0037fdbCombined.css | 0 .../description/iframedescription.css | 179 + .../description/offline.js | 52 + .../license.rtf | 25 + Samples/Windows 8.1 app samples/fxc.bat | 5 + 47 files changed, 8963 insertions(+) create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Properties/AssemblyInfo.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1Component.csproj create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1ImageSource.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/CompileShaders.bat create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Properties/AssemblyInfo.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2Component.csproj create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2ImageSource.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimplePixelShader.cso create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimplePixelShader.hlsl create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimpleVertexShader.cso create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimpleVertexShader.hlsl create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource.sln create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/placeholder-sdk.png create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/smallTile-sdk.png create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/splash-sdk.png create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/squareTile-sdk.png create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/storeLogo-sdk.png create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/tile-sdk.png create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/windows-sdk.png create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Constants.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Package.appxmanifest create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Properties/AssemblyInfo.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Scenario1.xaml create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Scenario1.xaml.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Scenario2.xaml create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Scenario2.xaml.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/SurfaceImageSource.csproj create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/SurfaceImageSource_TemporaryKey.pfx create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/common/LayoutAwarePage.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/common/StandardStyles.xaml create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/sample-utils/SampleTemplateStyles.xaml create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/sample-utils/SuspensionManager.cs create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description.html create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/0b1ffc16-8ecc-4161-a697-6a5fd8338d8dBrand.css create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/Brand.css create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/Combined.css create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/Galleries.css create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/Layout.css create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/a026343f-24e4-42dc-8672-b8aca0037fdbCombined.css create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/iframedescription.css create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/description/offline.js create mode 100644 Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/license.rtf create mode 100644 Samples/Windows 8.1 app samples/fxc.bat diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Properties/AssemblyInfo.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..56c650e91 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Scenario1Component")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Scenario1Component")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1Component.csproj b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1Component.csproj new file mode 100644 index 000000000..d655355a0 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1Component.csproj @@ -0,0 +1,132 @@ + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E} + Library + Properties + Scenario1Component + Scenario1Component + en-US + 8.1 + 12 + 512 + {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + DEBUG;TRACE;NETFX_CORE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE;NETFX_CORE + prompt + 4 + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + ARM + false + prompt + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + x64 + false + prompt + true + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + x86 + false + prompt + true + + + + + + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.dll + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.Direct2D1.dll + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.Direct3D11.dll + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.DXGI.dll + + + + 12.0 + + + + \ No newline at end of file diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1ImageSource.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1ImageSource.cs new file mode 100644 index 000000000..71346e42e --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario1Component/Scenario1ImageSource.cs @@ -0,0 +1,205 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* +using Windows.UI.Xaml; +using SharpDX; +using SharpDX.Direct2D1; +using SharpDX.Direct3D; +using SharpDX.Direct3D11; +using SharpDX.DXGI; +using Device = SharpDX.Direct3D11.Device; +using FeatureLevel = SharpDX.Direct3D.FeatureLevel; + +namespace Scenario1Component +{ + public sealed class Scenario1ImageSource : Windows.UI.Xaml.Media.Imaging.SurfaceImageSource + { + private Device d3dDevice; + private SharpDX.Direct2D1.Device d2dDevice; + private SharpDX.Direct2D1.DeviceContext d2dContext; + private readonly int width; + private readonly int height; + + public Scenario1ImageSource(int pixelWidth, int pixelHeight, bool isOpaque) + : base(pixelWidth, pixelHeight, isOpaque) + { + width = pixelWidth; + height = pixelHeight; + + CreateDeviceResources(); + + Application.Current.Suspending += OnSuspending; + } + + public void BeginDraw(Windows.Foundation.Rect updateRect) + { + // Express target area as a native RECT type. + var updateRectNative = new Rectangle + { + Left = (int) updateRect.Left, + Top = (int) updateRect.Top, + Right = (int) updateRect.Right, + Bottom = (int) updateRect.Bottom + }; + + // Query for ISurfaceImageSourceNative interface. + using (var sisNative = ComObject.QueryInterface(this)) + { + // Begin drawing - returns a target surface and an offset to use as the top left origin when drawing. + try + { + Point offset; + using (var surface = sisNative.BeginDraw(updateRectNative, out offset)) + { + + // Create render target. + using (var bitmap = new Bitmap1(d2dContext, surface)) + { + // Set context's render target. + d2dContext.Target = bitmap; + } + + // Begin drawing using D2D context. + d2dContext.BeginDraw(); + + // Apply a clip and transform to constrain updates to the target update area. + // This is required to ensure coordinates within the target surface remain + // consistent by taking into account the offset returned by BeginDraw, and + // can also improve performance by optimizing the area that is drawn by D2D. + // Apps should always account for the offset output parameter returned by + // BeginDraw, since it may not match the passed updateRect input parameter's location. + d2dContext.PushAxisAlignedClip( + new RectangleF( + (offset.X), + (offset.Y), + (offset.X + (float) updateRect.Width), + (offset.Y + (float) updateRect.Height) + ), + AntialiasMode.Aliased + ); + + d2dContext.Transform = Matrix3x2.Translation(offset.X, offset.Y); + } + } + catch (SharpDXException ex) + { + if (ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceRemoved || + ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceReset) + { + // If the device has been removed or reset, attempt to recreate it and continue drawing. + CreateDeviceResources(); + BeginDraw(updateRect); + } + else + { + throw; + } + } + } + } + + public void BeginDraw() + { + BeginDraw(new Windows.Foundation.Rect(0, 0, width, height)); + } + + public void EndDraw() + { + // Remove the transform and clip applied in BeginDraw since + // the target area can change on every update. + d2dContext.Transform = SharpDX.Matrix3x2.Identity; + d2dContext.PopAxisAlignedClip(); + + // Remove the render target and end drawing. + d2dContext.EndDraw(); + + d2dContext.Target = null; + + // Query for ISurfaceImageSourceNative interface. + using (var sisNative = ComObject.QueryInterface(this)) + sisNative.EndDraw(); + } + + public void Clear(Windows.UI.Color color) + { + d2dContext.Clear(ConvertToColorF(color)); + } + + public void FillSolidRect(Windows.UI.Color color, Windows.Foundation.Rect rect) + { + // Create a solid color D2D brush. + using (var brush = new SolidColorBrush(d2dContext, ConvertToColorF(color))) + { + // Draw a filled rectangle. + d2dContext.FillRectangle(ConvertToRectF(rect), brush); + } + } + + private void OnSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e) + { + // Hints to the driver that the app is entering an idle state and that its memory can be used temporarily for other apps. + using (var dxgiDevice = d3dDevice.QueryInterface()) + dxgiDevice.Trim(); + } + + // Initialize hardware-dependent resources. + private void CreateDeviceResources() + { + // This flag adds support for surfaces with a different color channel ordering + // than the API default. It is required for compatibility with Direct2D. + var creationFlags = DeviceCreationFlags.BgraSupport; + +#if DEBUG + // If the project is in a debug build, enable debugging via SDK Layers. + creationFlags |= DeviceCreationFlags.Debug; +#endif + + // This array defines the set of DirectX hardware feature levels this app will support. + // Note the ordering should be preserved. + // Don't forget to declare your application's minimum required feature level in its + // description. All applications are assumed to support 9.1 unless otherwise stated. + FeatureLevel[] featureLevels = + { + FeatureLevel.Level_11_1, + FeatureLevel.Level_11_0, + FeatureLevel.Level_10_1, + FeatureLevel.Level_10_0, + FeatureLevel.Level_9_3, + FeatureLevel.Level_9_2, + FeatureLevel.Level_9_1, + }; + + // Create the Direct3D 11 API device object. + d3dDevice = new Device(DriverType.Hardware, creationFlags, featureLevels); + + // Get the Direct3D 11.1 API device. + using (var dxgiDevice = d3dDevice.QueryInterface()) + { + // Create the Direct2D device object and a corresponding context. + d2dDevice = new SharpDX.Direct2D1.Device(dxgiDevice); + + d2dContext = new SharpDX.Direct2D1.DeviceContext(d2dDevice, DeviceContextOptions.None); + + // Query for ISurfaceImageSourceNative interface. + var sisNative = ComObject.QueryInterface(this); + sisNative.Device = dxgiDevice; + } + } + + private static SharpDX.Color ConvertToColorF(Windows.UI.Color color) + { + return new Color(color.R, color.G, color.B, color.A); + } + + private static SharpDX.RectangleF ConvertToRectF(Windows.Foundation.Rect rect) + { + return new RectangleF((float) rect.X, (float) rect.Y, (float) rect.Width, (float) rect.Height); + } + } +} diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/CompileShaders.bat b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/CompileShaders.bat new file mode 100644 index 000000000..82ee03d4a --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/CompileShaders.bat @@ -0,0 +1,2 @@ +call "%~dp0..\..\..\fxc.bat" /Tvs_4_0_level_9_1 /Emain /FoSimpleVertexShader.cso SimpleVertexShader.hlsl +call "%~dp0..\..\..\fxc.bat" /Tps_4_0_level_9_1 /Emain /FoSimplePixelShader.cso SimplePixelShader.hlsl \ No newline at end of file diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Properties/AssemblyInfo.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b4fbad3b3 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Scenario2Component")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Scenario2Component")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2Component.csproj b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2Component.csproj new file mode 100644 index 000000000..daa2df4b3 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2Component.csproj @@ -0,0 +1,148 @@ + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {47F7619B-E641-4D80-8167-DAED43E66C86} + Library + Properties + Scenario2Component + Scenario2Component + en-US + 8.1 + 12 + 512 + {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + DEBUG;TRACE;NETFX_CORE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE;NETFX_CORE + prompt + 4 + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + ARM + false + prompt + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + x64 + false + prompt + true + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + TRACE;NETFX_CORE + true + ;2008 + pdbonly + x86 + false + prompt + true + + + + + + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.dll + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.D3DCompiler.dll + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.Direct2D1.dll + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.Direct3D11.dll + + + ..\..\..\..\..\Bin\DirectX11_2-winrt\SharpDX.DXGI.dll + + + + + + PreserveNewest + + + PreserveNewest + + + + + + + + 12.0 + + + + \ No newline at end of file diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2ImageSource.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2ImageSource.cs new file mode 100644 index 000000000..f9c1c680f --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/Scenario2ImageSource.cs @@ -0,0 +1,376 @@ +using System.IO; +using System.Runtime.InteropServices; +using Windows.ApplicationModel; +using Windows.UI.Xaml; +using SharpDX; +using SharpDX.Direct3D; +using SharpDX.Direct3D11; +using SharpDX.DXGI; +using SharpDX.IO; +using Device = SharpDX.Direct3D11.Device; +using DeviceContext = SharpDX.Direct3D11.DeviceContext; +using FeatureLevel = SharpDX.Direct3D.FeatureLevel; +using InputElement = SharpDX.Direct3D11.InputElement; + +namespace Scenario2Component +{ + [StructLayout(LayoutKind.Sequential)] + internal struct ModelViewProjectionConstantBuffer + { + public Matrix model; + public Matrix view; + public Matrix projection; + }; + + [StructLayout(LayoutKind.Sequential)] + internal struct VertexPositionColor + { + public VertexPositionColor(Vector3 pos, Vector3 color) + { + this.pos = pos; + this.color = color; + } + + public Vector3 pos; + public Vector3 color; + }; + + public sealed class Scenario2ImageSource : Windows.UI.Xaml.Media.Imaging.SurfaceImageSource + { + // Direct3D objects + private Device d3dDevice; + private DeviceContext d3dContext; + private RenderTargetView renderTargetView; + private DepthStencilView depthStencilView; + private VertexShader vertexShader; + private PixelShader pixelShader; + private InputLayout inputLayout; + private SharpDX.Direct3D11.Buffer vertexBuffer; + private SharpDX.Direct3D11.Buffer indexBuffer; + private SharpDX.Direct3D11.Buffer constantBuffer; + + private ModelViewProjectionConstantBuffer constantBufferData; + + private int indexCount; + + private int width; + private int height; + + private float frameCount; + + public Scenario2ImageSource(int pixelWidth, int pixelHeight, bool isOpaque) + : base(pixelWidth, pixelHeight, isOpaque) + { + width = pixelWidth; + height = pixelHeight; + + CreateDeviceResources(); + + Application.Current.Suspending += OnSuspending; + } + + public void BeginDraw() + { + // Express target area as a native RECT type. + var updateRectNative = new Rectangle(0, 0, width, height); + + // Query for ISurfaceImageSourceNative interface. + using (var sisNative = ComObject.QueryInterface(this)) + { + // Begin drawing - returns a target surface and an offset to use as the top left origin when drawing. + try + { + Point offset; + using (var surface = sisNative.BeginDraw(updateRectNative, out offset)) + { + // QI for target texture from DXGI surface. + using (var d3DTexture = surface.QueryInterface()) + { + Utilities.Dispose(ref renderTargetView); + renderTargetView = new RenderTargetView(d3dDevice, d3DTexture); + } + + // Set viewport to the target area in the surface, taking into account the offset returned by BeginDraw. + var viewport = new ViewportF(offset.X, offset.Y, width, height); + d3dContext.Rasterizer.SetViewport(viewport); + + // Get the surface description in order to determine its size. The size of the depth/stencil buffer and the RenderTargetView must match, so the + // depth/stencil buffer must be the same size as the surface. Since the whole surface returned by BeginDraw can potentially be much larger than + // the actual update rect area passed into BeginDraw, it may be preferable for some apps to include an intermediate step which instead creates a + // separate smaller D3D texture and renders into it before calling BeginDraw, then simply copies that texture into the surface returned by BeginDraw. + // This would prevent needing to create a depth/stencil buffer which is potentially much larger than required, thereby saving memory at the cost of + // additional overhead due to the copy operation. + var surfaceDesc = surface.Description; + + // Create depth/stencil buffer descriptor. + var depthStencilDesc = new Texture2DDescription() + { + Format = Format.D24_UNorm_S8_UInt, + Width = surfaceDesc.Width, + Height = surfaceDesc.Height, + ArraySize = 1, + MipLevels = 1, + BindFlags = BindFlags.DepthStencil, + SampleDescription = new SampleDescription(1, 0), + Usage = ResourceUsage.Default, + }; + + // Allocate a 2-D surface as the depth/stencil buffer. + using (var depthStencil = new Texture2D(d3dDevice, depthStencilDesc)) + { + Utilities.Dispose(ref depthStencilView); + depthStencilView = new DepthStencilView(d3dDevice, depthStencil); + } + } + } + catch (SharpDXException ex) + { + if (ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceRemoved || + ex.ResultCode == SharpDX.DXGI.ResultCode.DeviceReset) + { + // If the device has been removed or reset, attempt to recreate it and continue drawing. + CreateDeviceResources(); + BeginDraw(); + } + else + { + throw; + } + } + } + } + + public void EndDraw() + { + // Query for ISurfaceImageSourceNative interface. + using (var sisNative = ComObject.QueryInterface(this)) + sisNative.EndDraw(); + } + + public void Clear(Windows.UI.Color color) + { + // Clear render target view with given color. + d3dContext.ClearRenderTargetView(renderTargetView, ConvertToColorF(color)); + } + + public void RenderNextAnimationFrame() + { + var eye = new Vector3(0.0f, 0.7f, 1.5f); // Define camera position. + var at = new Vector3(0.0f, -0.1f, 0.0f); // Define focus position. + var up = new Vector3(0.0f, 1.0f, 0.0f); // Define up direction. + + if (frameCount >= float.MaxValue) + { + frameCount = 0; + } + + // Set view based on camera position, focal point, and up direction. + constantBufferData.view = Matrix.Transpose(Matrix.LookAtRH(eye, at, up)); + + // Rotate around Y axis by (pi/4) * 16ms per elapsed frame. + constantBufferData.model = Matrix.Transpose(Matrix.RotationY(frameCount++*0.016f*MathUtil.PiOverFour)); + + // Clear depth/stencil view. + //d3dContext.ClearDepthStencilView(depthStencilView, DepthStencilClearFlags.Depth, 1.0f, 0); + + // Set render target. + //d3dContext.OutputMerger.SetRenderTargets(depthStencilView, renderTargetView); + d3dContext.OutputMerger.SetRenderTargets(renderTargetView); + + // Map update to constant buffer. + d3dContext.UpdateSubresource(ref constantBufferData, constantBuffer); + + // Set vertex buffer. + int stride = Utilities.SizeOf(); + d3dContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, stride, 0)); + + // Set index buffer. + d3dContext.InputAssembler.SetIndexBuffer(indexBuffer, Format.R16_UInt, 0); + + // Set topology to triangle list. + d3dContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; + + // Set input layout. + d3dContext.InputAssembler.InputLayout = inputLayout; + + // Set vertex shader. + d3dContext.VertexShader.Set(vertexShader); + + // Set constant buffer. + d3dContext.VertexShader.SetConstantBuffer(0, constantBuffer); + + // Set pixel shader. + d3dContext.PixelShader.Set(pixelShader); + + // Draw cube faces. + d3dContext.DrawIndexed(indexCount, 0, 0); + } + + private void OnSuspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e) + { + // Hints to the driver that the app is entering an idle state and that its memory can be used temporarily for other apps. + using (var dxgiDevice = d3dDevice.QueryInterface()) + dxgiDevice.Trim(); + } + + // Initialize hardware-dependent resources. + private void CreateDeviceResources() + { + // This flag adds support for surfaces with a different color channel ordering + // than the API default. It is required for compatibility with Direct2D. + var creationFlags = DeviceCreationFlags.BgraSupport; + +#if DEBUG + // If the project is in a debug build, enable debugging via SDK Layers. + creationFlags |= DeviceCreationFlags.Debug; +#endif + + // This array defines the set of DirectX hardware feature levels this app will support. + // Note the ordering should be preserved. + // Don't forget to declare your application's minimum required feature level in its + // description. All applications are assumed to support 9.1 unless otherwise stated. + FeatureLevel[] featureLevels = + { + FeatureLevel.Level_11_1, + FeatureLevel.Level_11_0, + FeatureLevel.Level_10_1, + FeatureLevel.Level_10_0, + FeatureLevel.Level_9_3, + FeatureLevel.Level_9_2, + FeatureLevel.Level_9_1, + }; + + // Create the Direct3D 11 API device object. + Utilities.Dispose(ref d3dDevice); + d3dDevice = new Device(DriverType.Hardware, creationFlags, featureLevels); + d3dContext = d3dDevice.ImmediateContext; + + // Get the Direct3D 11.1 API device. + using (var dxgiDevice = d3dDevice.QueryInterface()) + { + // Query for ISurfaceImageSourceNative interface. + using (var sisNative = ComObject.QueryInterface(this)) + { + sisNative.Device = dxgiDevice; + } + } + + // Load the vertex shader. + var vsBytecode = + NativeFile.ReadAllBytes(Path.Combine(Package.Current.InstalledLocation.Path, + "Scenario2Component\\SimpleVertexShader.cso")); + Utilities.Dispose(ref vertexShader); + vertexShader = new VertexShader(d3dDevice, vsBytecode); + + // Create input layout for vertex shader. + var vertexDesc = new [] + { + new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0), + new InputElement("COLOR", 0, Format.R32G32B32_Float, 12, 0, InputClassification.PerVertexData, 0), + }; + + Utilities.Dispose(ref inputLayout); + inputLayout = new InputLayout(d3dDevice, vsBytecode, vertexDesc); + + // Load the pixel shader. + var psBytecode = + NativeFile.ReadAllBytes(Path.Combine(Package.Current.InstalledLocation.Path, "Scenario2Component\\SimplePixelShader.cso")); + Utilities.Dispose(ref pixelShader); + pixelShader = new PixelShader(d3dDevice, psBytecode); + + // Create the constant buffer. + var constantBufferDesc = new BufferDescription() + { + SizeInBytes = Utilities.SizeOf(), + BindFlags = BindFlags.ConstantBuffer + }; + Utilities.Dispose(ref constantBuffer); + constantBuffer = new Buffer(d3dDevice, constantBufferDesc); + + // Describe the vertices of the cube. + var cubeVertices = new [] + { + new VertexPositionColor(new Vector3(-0.5f, -0.5f, -0.5f), new Vector3(0.0f, 0.0f, 0.0f)), + new VertexPositionColor(new Vector3(-0.5f, -0.5f, 0.5f), new Vector3(0.0f, 0.0f, 1.0f)), + new VertexPositionColor(new Vector3(-0.5f, 0.5f, -0.5f), new Vector3(0.0f, 1.0f, 0.0f)), + new VertexPositionColor(new Vector3(-0.5f, 0.5f, 0.5f), new Vector3(0.0f, 1.0f, 1.0f)), + new VertexPositionColor(new Vector3(0.5f, -0.5f, -0.5f), new Vector3(1.0f, 0.0f, 0.0f)), + new VertexPositionColor(new Vector3(0.5f, -0.5f, 0.5f), new Vector3(1.0f, 0.0f, 1.0f)), + new VertexPositionColor(new Vector3(0.5f, 0.5f, -0.5f), new Vector3(1.0f, 1.0f, 0.0f)), + new VertexPositionColor(new Vector3(0.5f, 0.5f, 0.5f), new Vector3(1.0f, 1.0f, 1.0f)), + }; + + var vertexBufferDesc = new BufferDescription() + { + SizeInBytes = Utilities.SizeOf()*cubeVertices.Length, + BindFlags = BindFlags.VertexBuffer + }; + Utilities.Dispose(ref vertexBuffer); + vertexBuffer = Buffer.Create(d3dDevice, cubeVertices, vertexBufferDesc); + + // Describe the cube indices. + var cubeIndices = new ushort[] + { + 0, 2, 1, // -x + 1, 2, 3, + + 4, 5, 6, // +x + 5, 7, 6, + + 0, 1, 5, // -y + 0, 5, 4, + + 2, 6, 7, // +y + 2, 7, 3, + + 0, 4, 6, // -z + 0, 6, 2, + + 1, 3, 7, // +z + 1, 7, 5, + }; + indexCount = cubeIndices.Length; + + // Create the index buffer. + var indexBufferDesc = new BufferDescription() + { + SizeInBytes = sizeof(ushort) * cubeIndices.Length, + BindFlags = BindFlags.IndexBuffer + }; + Utilities.Dispose(ref indexBuffer); + indexBuffer = Buffer.Create(d3dDevice, cubeIndices, indexBufferDesc); + + // Calculate the aspect ratio and field of view. + float aspectRatio = (float) width/(float) height; + + float fovAngleY = 70.0f*MathUtil.Pi/180.0f; + if (aspectRatio < 1.0f) + { + fovAngleY /= aspectRatio; + } + + // Set right-handed perspective projection based on aspect ratio and field of view. + constantBufferData.projection = Matrix.Transpose( + Matrix.PerspectiveFovRH( + fovAngleY, + aspectRatio, + 0.01f, + 100.0f + ) + ); + + // Start animating at frame 0. + frameCount = 0; + } + + private static SharpDX.Color ConvertToColorF(Windows.UI.Color color) + { + return new Color(color.R, color.G, color.B, color.A); + } + + private static SharpDX.RectangleF ConvertToRectF(Windows.Foundation.Rect rect) + { + return new RectangleF((float) rect.X, (float) rect.Y, (float) rect.Width, (float) rect.Height); + } + } +} diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimplePixelShader.cso b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimplePixelShader.cso new file mode 100644 index 0000000000000000000000000000000000000000..02805a08d3fde10870255878ec830c73080dab0d GIT binary patch literal 576 zcmb7Ay-LGi6g_FwWDr_)70e)5K}w|(+CiJzUm;peg1Cu46${l!EaDi%$*1V#(#1jF z!NJ|d(I@Z);<+`&A}Dy^IC7zdI)AS_DP5OYjZhk*9LPg85u@3GdY z(Hr=BQv5KA0Jl+bY!)nXhCEC`4N@s8parNO#+NpEXAtY!^tX2tdx|BAu($>&u2=G8 z7geknGT10M$G`A1|6ACpRBQ78MlmZdW89XPir#D=1^%Uf(lye~qS3Hj+i*`0j$46I z_RlWb9SSp(%M{FPHnVKz@+;`~H{AMGnpv4!Ck=9l;hvfXl$&h($ literal 0 HcmV?d00001 diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimplePixelShader.hlsl b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimplePixelShader.hlsl new file mode 100644 index 000000000..e73c525b4 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimplePixelShader.hlsl @@ -0,0 +1,19 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +struct PixelShaderInput +{ + float3 color : COLOR0; +}; + +float4 main(PixelShaderInput input) : SV_TARGET +{ + return float4(input.color,1.0f); +} diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimpleVertexShader.cso b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimpleVertexShader.cso new file mode 100644 index 0000000000000000000000000000000000000000..3190b8baf4927e650070e9aa32168b9d31af3abd GIT binary patch literal 1548 zcmb7EO;1xn6uqx~rRB?FqlpWmFNB3|NC~8YM5SL=h=pPwA-X~WMQWgrl=`u=A#rQ? z0WP|5SNFPP$xm=&;(|mH7bdO^^_+S0CN5r$-t;o}oHKLpo!cqJNBP3F)gR~YUSI!p z=i~Rzw+HX1EfEN%XZ`4^cEI*#5(pjIz`f8u9j~Sc#VR}sKtRJTHHxSeh)8krCIpO^! zv_8>C#~W7p^L_LotsnK#hoRraSLv?h)>?>p3(kzjyYpQH#<~2Dakl?r)#AOC4`BZEw9^d%4>5p4GNmb+1wI8i%dTMl1h(XQ$SbZkIXO z(<}H1Jg^fTWU=z@ry768n$`X%{{>t-gx_Zms1rpMTTKs}U@y>?9GJdjxxUr(4!xb0 zbF+HOSuDF{$KBoBt~H&4w|`LILy(!8nVQd}(^J!#nYmfyTypQPEFu^C;G5w8)xd%| z$MKkQ0g077XG4Cq;x4T%RaT@>DOak}tsq|++F$db5Z;C|<_Yp85&LP}^$nA_+x-m( Cskn6j literal 0 HcmV?d00001 diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimpleVertexShader.hlsl b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimpleVertexShader.hlsl new file mode 100644 index 000000000..6f4274154 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/Scenario2Component/SimpleVertexShader.hlsl @@ -0,0 +1,45 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +cbuffer ModelViewProjectionConstantBuffer : register(b0) +{ + matrix model; + matrix view; + matrix projection; +}; + +struct VertexShaderInput +{ + float3 pos : POSITION; + float3 color : COLOR0; +}; + +struct VertexShaderOutput +{ + float3 color : COLOR0; + float4 pos : SV_POSITION; +}; + +VertexShaderOutput main(VertexShaderInput input) +{ + VertexShaderOutput output; + float4 pos = float4(input.pos, 1.0f); + + // Transform the vertex position into projected space. + pos = mul(pos, model); + pos = mul(pos, view); + pos = mul(pos, projection); + output.pos = pos; + + // Pass through the color without modification. + output.color = input.color; + + return output; +} diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource.sln b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource.sln new file mode 100644 index 000000000..e6f5ff54e --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource.sln @@ -0,0 +1,80 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30110.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SurfaceImageSource", "SurfaceImageSource\SurfaceImageSource.csproj", "{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scenario1Component", "Scenario1Component\Scenario1Component.csproj", "{A98E21E7-F972-4284-B151-D35E9F3A2D9E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scenario2Component", "Scenario2Component\Scenario2Component.csproj", "{47F7619B-E641-4D80-8167-DAED43E66C86}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|ARM.ActiveCfg = Debug|ARM + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|ARM.Build.0 = Debug|ARM + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|ARM.Deploy.0 = Debug|ARM + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x64.ActiveCfg = Debug|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x86.ActiveCfg = Debug|x86 + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x86.Build.0 = Debug|x86 + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x86.Deploy.0 = Debug|x86 + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|Any CPU.Build.0 = Release|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|Any CPU.Deploy.0 = Release|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|ARM.ActiveCfg = Release|ARM + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|ARM.Build.0 = Release|ARM + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|ARM.Deploy.0 = Release|ARM + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x64.ActiveCfg = Release|Any CPU + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x86.ActiveCfg = Release|x86 + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x86.Build.0 = Release|x86 + {CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x86.Deploy.0 = Release|x86 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|ARM.ActiveCfg = Debug|ARM + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|ARM.Build.0 = Debug|ARM + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|x64.ActiveCfg = Debug|x64 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|x64.Build.0 = Debug|x64 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|x86.ActiveCfg = Debug|x86 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Debug|x86.Build.0 = Debug|x86 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|Any CPU.Build.0 = Release|Any CPU + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|ARM.ActiveCfg = Release|ARM + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|ARM.Build.0 = Release|ARM + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|x64.ActiveCfg = Release|x64 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|x64.Build.0 = Release|x64 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|x86.ActiveCfg = Release|x86 + {A98E21E7-F972-4284-B151-D35E9F3A2D9E}.Release|x86.Build.0 = Release|x86 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|ARM.ActiveCfg = Debug|ARM + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|ARM.Build.0 = Debug|ARM + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|x64.ActiveCfg = Debug|x64 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|x64.Build.0 = Debug|x64 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|x86.ActiveCfg = Debug|x86 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Debug|x86.Build.0 = Debug|x86 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|Any CPU.Build.0 = Release|Any CPU + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|ARM.ActiveCfg = Release|ARM + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|ARM.Build.0 = Release|ARM + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|x64.ActiveCfg = Release|x64 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|x64.Build.0 = Release|x64 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|x86.ActiveCfg = Release|x86 + {47F7619B-E641-4D80-8167-DAED43E66C86}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml new file mode 100644 index 000000000..1fa1b6de1 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml.cs new file mode 100644 index 000000000..b75fcbff9 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/App.xaml.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft. All rights reserved. +using System; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Navigation; +using SDKTemplate; + +namespace SDKTemplate +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + sealed partial class App : Application + { + /// + /// 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(). + /// + public App() + { + this.InitializeComponent(); + this.Suspending += OnSuspending; + } + + /// + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used when the application is launched to open a specific file, to display + /// search results, and so forth. + /// + /// Details about the launch request and process. + protected override async void OnLaunched(LaunchActivatedEventArgs args) + { + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + + if (rootFrame == null) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + // Associate the frame with a SuspensionManager key + SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); + + if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + // Restore the saved session state only when appropriate + try + { + await SuspensionManager.RestoreAsync(); + } + catch (SuspensionManagerException) + { + //Something went wrong restoring state. + //Assume there is no state and continue + } + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + if (rootFrame.Content == null || !String.IsNullOrEmpty(args.Arguments)) + { + // When the navigation stack isn't restored or there are launch arguments + // indicating an alternate launch (e.g.: via toast or secondary tile), + // navigate to the appropriate page, configuring the new page by passing required + // information as a navigation parameter + if (!rootFrame.Navigate(typeof(MainPage), args.Arguments)) + { + throw new Exception("Failed to create initial page"); + } + } + // Ensure the current window is active + Window.Current.Activate(); + } + + /// + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// + /// The source of the suspend request. + /// Details about the suspend request. + private async void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + await SuspensionManager.SaveAsync(); + deferral.Complete(); + } + } +} diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/placeholder-sdk.png b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/placeholder-sdk.png new file mode 100644 index 0000000000000000000000000000000000000000..01b3138cf8c040c54f3a200b2052f94a10240ded GIT binary patch literal 8991 zcmd6Nc|6qJ-#(KTZA4N@+E597$&zgpB@wcXeYqo*J;vCFN|9_KA%yH($TovpDVowAA+PKDwKQg=L@m4OLwh z7FK`ob8^=X@QEkv^Dy{_)lFCJDobJeu^I3mHoGgguCTBaN9>_nZwLQpce!Eg#=^3{ z9{OR871__n!gA_^y6P2uPm2Y-qk}syl2;iuI5B$Y9`!J zKd5~?lB?{2NoclbkFqD;r^+#H?|?Pz0D9~(xP8_p`JGHXA2^k_Z?gVAxavZ|xfXn5Qz zbz!igproYh&;=u_Qo9ZhT%S*oMa_f9j~_c(4(K}(hpL>=JUl!^l#KJRd($y~e$n$; z)V35j&ZTv(uV`@MbDTNF9e+^8(a|w==*yQ#c_&>Izgus-ndm&QJnXr}YeCphNIk#%+5^#xS^e&4xIhE>y!!sdT3R8^ zN#xlXiY{-Qh+)3V<-##LIISN$SmBInE-o(aG#{Ni^Zs7vDRTNFs$|W%`04t$A{v6P zgZA)Z;IW)v8S*+325FtN*dHmLW9&Z5&B6saIXTlU1|fPOQkM%`a>V2=zbne+dBXM9 z5{}w|^)V<=Eu@|c$$K-Kc}FDt%x#fFJ-37--Vv#K69!sMH>Az|^7hL;9n-<_YOkqBmR{06=BM{qSD#L!r3OwRQQ3nk3{h(p7V!Bl z?U9c`dkR0x9l5}rGj1sZRpb$i52{aCV7pF?5cfR@2;K4K-sc7cJ!tezGpF(!PG#`5 zk39c0q$?5kezRk4a&`}^6YQ{$;-=s3VjvK+-j&qQXWP8@OUT3usZ$dU`|ep$ymU@-@~^UEQY`O$2G+AGyA<8 zb|rLW&y(B-z#%%rFq466>C(}HE~glpI>QR85y0Rl!Xw(<$aL=*`jMU^7I&B{PXyXD zQ*5G|%!X!C;4UKpruW_O806WL0bo6w&|5*T_9Xc!%xW2z2zMpS-s??*L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kF$(-++&~F0RhBw@6 zgNh`dRgcx~yX879d8OL5GmJJYAEUzLw|LEZBePv^M;{rQ)qy$mmk(8bp(R^$aE_ z=>vQteC?eg#b1j-Cf)WeBF2fJ88iY`fw8fOCOqfDas3l#=|962`ZDunc<(HFG>CV1 zh!91?*|`YFUf6f(XL3|CZPsV=icB;#G*anJ0%!-U$HGH~;md>dV-2ATZ8C%p;5{Ep znERe;dm0FqL(R$p%CV;4F{EaxkuS(5N#WvpeF%49cy3CvV3q6mb)Sh?#O~%*QU|=E zyj(htZXgre**u;RXHhbh>{F;C!|x2n84<~k5I&fsY=PcDnwC8r^4W-f%5V<~7I^6t}-gWzNT4R3@@PaM;G2|k)3Cskjxe@Iep7Rj3(HcU2GcCI8 zcSk=45w!*DR~Vcznn>jZ6?V%eFYwZh|I)b2|g*>AW z3#6W=I{pK^A;&XX#4$-HwjPO0=@xZ0q}XWqZeW@bjxi44&ms(cLy87&H{IIoOT(Po zA?Qay*dle`Dc;wvO+k6{WRhrh271{RT{kE3<0M`#?6n~7&Q2!78dnu LTB?Ottseaktfbe2 literal 0 HcmV?d00001 diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/smallTile-sdk.png b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/smallTile-sdk.png new file mode 100644 index 0000000000000000000000000000000000000000..5546e8b24a69738114bc17b2b2d493a6872d67ad GIT binary patch literal 1248 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1|+Qw)-3{3k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m{T%CB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!ux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zamEmP#-v^oIY;GJrcGr_YyWP$|7PL>Nd~R3E+*rLwl`M(?ya};313mc{QT!#{=kD~ z*_z*~*>3GM0X=d#Wzp$P!Xu`&Pv literal 0 HcmV?d00001 diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/tile-sdk.png b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/tile-sdk.png new file mode 100644 index 0000000000000000000000000000000000000000..cdec0dbdccad7ae5dd0e92e3c3015449fffb7450 GIT binary patch literal 2665 zcma)8dpwj`AD^(gN@_z1&pSR_@0Ph|CX;bDv1_Dpuf%xfF$Ocwm>HL$5^q~u7S+3& zTD-Ok5}6Q6nB-Pe79nQGbi)dHH^jK^u&Le8=e6%Xf1Kx>^ZS0kzu!6M_xYW3%GG6$ z)~d~`5D0{plcPNyfmlXV_0O-+RJHCMS4UL8O+p86p&J}1jAZa3gbfo8fB+{Bg9Xtc z22&LF5VAlZ)B(1;x6qsBOa@^NnlX<-M{#&6HUeQ`6~$wKA&?LVfLLrU1vz|IiUin9 z3ewArhNbcBpdhwmG#_${c5w%zLqKyT(#jIBh$5>5IFOJ5L~%m70&)}uxu8o{_2;KC zNMHdX451)@56YY73fRGX2rxrqQ6QFx1&BB_j|#1#k`To7`yryx~)G@H#N6A9)HW;k;^k$|?KuS)BlTqYX-%Ae=h|P1LEg9mWlnv{$CwipSRw5W!7=Gl{Lv|$c&&wI(fkRs zU|z&5m=`hsM?z)(;O1{jWK<1uq7yUx#%3OaYE=>Oc0k_VAnz%Ys)BE!w}l;RWk)8z z(VENsO!gwpvfivAyHe0KY8rXrP=K=c_{hkX#>B^dA*a(?jrF?TX05mq{A2T$rv-;I z$g)GLQthe-50+`?nAorF8~K&f1xcDT?^m3L8awoS^t+|B+_)o2M|S0bvx#3RHK)Q97{jhg}3G8uH@@X&CJqU`E#W{P30#``^{%(OwJD-=-tyauopL0;VGqI3c5q4 z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vMI zW0MyJYI6zx>iRu%7OIN=he92%^@l>eWF=PB=s(r^zbEmR*TvEjf4XsIX4m^8zOJ*{ V^V80WL-UV6CkGe%d|Utc-vFTWTn+#L literal 0 HcmV?d00001 diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/windows-sdk.png b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Assets/windows-sdk.png new file mode 100644 index 0000000000000000000000000000000000000000..67268021df6fbd0dfdd5220f669db5e07d83f620 GIT binary patch literal 2997 zcmV;m3rh5fP);00009a7bBm000id z000id0mpBsWB>pPPiaF#P*7-ZbZ>KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV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dF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0002sNkl}=C$qwI-NYOoT~TF4nB*YE@uK^dDB zWR30ww$s-POn&BXW+rPygeRt``M?BN0aGCJxdu1^r8s+Rdsm!&%k_ve0V-e%jKx_a z&Kh6@6u`k0^$aBgg{A`b{%e|-{MpA6H~>atXo8lmfjMc|h_j1WOH-MBto3b%xo=ah zD6ZCiGu#1JA7iMs;nIYI&w#sfAynGXP=aR{pby*>2XE7wE-hUGLmy+Pwc&3e3AYq~ rL3F-plJa|oO~TqubZP!GOu=ISd<8xF6%`=M00000NkvXXu0mjfiA9h! literal 0 HcmV?d00001 diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Constants.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Constants.cs new file mode 100644 index 000000000..00a62e4ff --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Constants.cs @@ -0,0 +1,46 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +using System.Collections.Generic; +using System; +using SurfaceImageSource; + +namespace SDKTemplate +{ + public partial class MainPage : SDKTemplate.Common.LayoutAwarePage + { + // Change the string below to reflect the name of your sample. + // This is used on the main page as the title of the sample. + public const string FEATURE_NAME = "XAML and DirectX interop with SurfaceImageSource"; + + // Change the array below to reflect the name of your scenarios. + // This will be used to populate the list of scenarios on the main page with + // which the user will choose the specific scenario that they are interested in. + // These should be in the form: "Navigating to a web page". + // The code in MainPage will take care of turning this into: "1) Navigating to a web page" + List scenarios = new List + { + new Scenario() { Title = "Using Direct2D", ClassType = typeof(Scenario1) }, + new Scenario() { Title = "Using Direct3D", ClassType = typeof(Scenario2) } + }; + } + + public class Scenario + { + public string Title { get; set; } + + public Type ClassType { get; set; } + + public override string ToString() + { + return Title; + } + } +} diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml new file mode 100644 index 000000000..481e93b88 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20,20,20,20 + + + + + + + + Left + + + + + + + + + + diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml.cs new file mode 100644 index 000000000..282d143e1 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/MainPage.xaml.cs @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft. All rights reserved. +using System; +using Windows.UI.ViewManagement; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Markup; +using Windows.UI.Xaml.Navigation; + + +namespace SDKTemplate +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class MainPage : SDKTemplate.Common.LayoutAwarePage + { + public event System.EventHandler ScenarioLoaded; + public event EventHandler MainPageResized; + + public static MainPage Current; + + private Frame HiddenFrame = null; + + public MainPage() + { + this.InitializeComponent(); + + // This is a static public property that will allow downstream pages to get + // a handle to the MainPage instance in order to call methods that are in this class. + Current = this; + + // This frame is hidden, meaning it is never shown. It is simply used to load + // each scenario page and then pluck out the input and output sections and + // place them into the UserControls on the main page. + HiddenFrame = new Windows.UI.Xaml.Controls.Frame(); + HiddenFrame.Visibility = Windows.UI.Xaml.Visibility.Collapsed; + ContentRoot.Children.Add(HiddenFrame); + + // Populate the sample title from the constant in the Constants.cs file. + SetFeatureName(FEATURE_NAME); + Scenarios.SelectionChanged += Scenarios_SelectionChanged; + SizeChanged += MainPage_SizeChanged; + } + + void MainPage_SizeChanged(object sender, SizeChangedEventArgs e) + { + InvalidateSize(); + if (MainPageResized != null) + { + MainPageSizeChangedEventArgs args = new MainPageSizeChangedEventArgs(); + args.Width = this.ActualWidth; + MainPageResized(this, args); + } + } + + /// + /// Invoked when this page is about to be displayed in a Frame. + /// + /// Event data that describes how this page was reached. The Parameter + /// property is typically used to configure the page. + protected override void OnNavigatedTo(NavigationEventArgs e) + { + PopulateScenarios(); + InvalidateLayout(); + } + + private void InvalidateSize() + { + // Get the window width + double windowWidth = this.ActualWidth; + if (windowWidth != 0.0) + { + // Get the width of the ListBox. + double listBoxWidth = Scenarios.ActualWidth; + + // Is the ListBox using any margins that we need to consider? + double listBoxMarginLeft = Scenarios.Margin.Left; + double listBoxMarginRight = Scenarios.Margin.Right; + + // Figure out how much room is left after considering the list box width + double availableWidth = windowWidth - listBoxWidth; + + // Is the top most child using margins? + double layoutRootMarginLeft = ContentRoot.Margin.Left; + double layoutRootMarginRight = ContentRoot.Margin.Right; + + // We have different widths to use depending on the view state + if (this.ActualWidth >= 768) + { + // Make us as big as the the left over space, factoring in the ListBox width, the ListBox margins. + // and the LayoutRoot's margins + InputSection.Width = availableWidth - (layoutRootMarginLeft + layoutRootMarginRight + listBoxMarginLeft + listBoxMarginRight); + } + else + { + // Make us as big as the left over space, factoring in just the LayoutRoot's margins. + InputSection.Width = windowWidth - (layoutRootMarginLeft + layoutRootMarginRight); + + } + } + InvalidateLayout(); + } + + private void InvalidateLayout() + { + if (this.ActualWidth < 768) + { + Grid.SetRow(DescriptionText, 3); + Grid.SetColumn(DescriptionText, 0); + + Grid.SetRow(InputSection, 4); + Grid.SetColumn(InputSection, 0); + } + else + { + Grid.SetRow(DescriptionText, 1); + Grid.SetColumn(DescriptionText, 1); + + Grid.SetRow(InputSection, 2); + Grid.SetColumn(InputSection, 1); + } + + // Since we don't load the scenario page in the traditional manner (we just pluck out the + // input and output sections from the page) we need to ensure that any VSM code used + // by the scenario's input and output sections is fired. + VisualStateManager.GoToState((Control)InputSection, "Input" + DetermineVisualState(this.ActualWidth), false); + VisualStateManager.GoToState((Control)OutputSection, "Output" + DetermineVisualState(this.ActualWidth), false); + } + + private void PopulateScenarios() + { + System.Collections.ObjectModel.ObservableCollection ScenarioList = new System.Collections.ObjectModel.ObservableCollection(); + int i = 0; + + // Populate the ListBox with the list of scenarios as defined in Constants.cs. + foreach (Scenario s in scenarios) + { + ListBoxItem item = new ListBoxItem(); + s.Title = (++i).ToString() + ") " + s.Title; + item.Content = s; + item.Name = s.ClassType.FullName; + ScenarioList.Add(item); + } + + // Bind the ListBox to the scenario list. + Scenarios.ItemsSource = ScenarioList; + + // Starting scenario is the first or based upon a previous selection. + int startingScenarioIndex = -1; + + if (SuspensionManager.SessionState.ContainsKey("SelectedScenarioIndex")) + { + int selectedScenarioIndex = Convert.ToInt32(SuspensionManager.SessionState["SelectedScenarioIndex"]); + startingScenarioIndex = selectedScenarioIndex; + } + Scenarios.SelectedIndex = startingScenarioIndex != -1 ? startingScenarioIndex : 0; + Scenarios.ScrollIntoView(Scenarios.SelectedItem); + } + + /// + /// This method is responsible for loading the individual input and output sections for each scenario. This + /// is based on navigating a hidden Frame to the ScenarioX.xaml page and then extracting out the input + /// and output sections into the respective UserControl on the main page. + /// + /// + public void LoadScenario(Type scenarioClass) + { + + // Load the ScenarioX.xaml file into the Frame. + HiddenFrame.Navigate(scenarioClass, this); + + // Get the top element, the Page, so we can look up the elements + // that represent the input and output sections of the ScenarioX file. + Page hiddenPage = HiddenFrame.Content as Page; + + // Get each element. + UIElement input = hiddenPage.FindName("Input") as UIElement; + UIElement output = hiddenPage.FindName("Output") as UIElement; + + if (input == null) + { + // Malformed input section. + NotifyUser(String.Format( + "Cannot load scenario input section for {0}. Make sure root of input section markup has x:Name of 'Input'", + scenarioClass.Name), NotifyType.ErrorMessage); + return; + } + + if (output == null) + { + // Malformed output section. + NotifyUser(String.Format( + "Cannot load scenario output section for {0}. Make sure root of output section markup has x:Name of 'Output'", + scenarioClass.Name), NotifyType.ErrorMessage); + return; + } + + // Find the LayoutRoot which parents the input and output sections in the main page. + Panel panel = hiddenPage.FindName("LayoutRoot") as Panel; + + if (panel != null) + { + // Get rid of the content that is currently in the intput and output sections. + panel.Children.Remove(input); + panel.Children.Remove(output); + + // Populate the input and output sections with the newly loaded content. + InputSection.Content = input; + OutputSection.Content = output; + } + else + { + // Malformed Scenario file. + NotifyUser(String.Format( + "Cannot load scenario: '{0}'. Make sure root tag in the '{0}' file has an x:Name of 'LayoutRoot'", + scenarioClass.Name), NotifyType.ErrorMessage); + } + } + + void Scenarios_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (Scenarios.SelectedItem != null) + { + NotifyUser("", NotifyType.StatusMessage); + + ListBoxItem selectedListBoxItem = Scenarios.SelectedItem as ListBoxItem; + SuspensionManager.SessionState["SelectedScenarioIndex"] = Scenarios.SelectedIndex; + + Scenario scenario = selectedListBoxItem.Content as Scenario; + LoadScenario(scenario.ClassType); + InvalidateSize(); + + // Fire the ScenarioLoaded event since we know that everything is loaded now. + if (ScenarioLoaded != null) + { + ScenarioLoaded(this, new EventArgs()); + } + } + } + + public void NotifyUser(string strMessage, NotifyType type) + { + switch (type) + { + // Use the status message style. + case NotifyType.StatusMessage: + StatusBlock.Style = Resources["StatusStyle"] as Style; + break; + // Use the error message style. + case NotifyType.ErrorMessage: + StatusBlock.Style = Resources["ErrorStyle"] as Style; + break; + } + StatusBlock.Text = strMessage; + + // Collapse the StatusBlock if it has no text to conserve real estate. + if (StatusBlock.Text != String.Empty) + { + StatusBlock.Visibility = Windows.UI.Xaml.Visibility.Visible; + } + else + { + StatusBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed; + } + } + + async void Footer_Click(object sender, RoutedEventArgs e) + { + await Windows.System.Launcher.LaunchUriAsync(new Uri(((HyperlinkButton)sender).Tag.ToString())); + } + + private void SetFeatureName(string str) + { + FeatureName.Text = str; + } + } + + public class MainPageSizeChangedEventArgs : EventArgs + { + private double width; + + public double Width + { + get { return width; } + set { width = value; } + } + } + + public enum NotifyType + { + StatusMessage, + ErrorMessage + }; +} diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Package.appxmanifest b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Package.appxmanifest new file mode 100644 index 000000000..906ac62a3 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Package.appxmanifest @@ -0,0 +1,28 @@ + + + + + SurfaceImageSource C# sample + SharpDX + Assets\storeLogo-sdk.png + + + 6.3.0 + 6.3.0 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Properties/AssemblyInfo.cs b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..315337f7a --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SurfaceImageSource CS sample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] diff --git a/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Scenario1.xaml b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Scenario1.xaml new file mode 100644 index 000000000..87323ff96 --- /dev/null +++ b/Samples/Windows 8.1 app samples/XAML SurfaceImageSource DirectX interop sample/C#/SurfaceImageSource/Scenario1.xaml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + The demonstration below shows how to use a SurfaceImageSource to include C++ DirectX content in a XAML application. + Each time the button below is clicked a SurfaceImageSource is filled with randomly generated rectangles drawn using Direct2D. + The XAML Image control and Ellipse shape below are then both filled using the SurfaceImageSource. + +