From 0bfb08e0a3be52b1effb28b0bb1f55a2539d3fed Mon Sep 17 00:00:00 2001 From: Rodrigo Diaz Date: Mon, 11 May 2020 14:52:25 +0100 Subject: [PATCH 01/10] Fixed typo (#767) --- winrt/docsrc/Interop.aml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winrt/docsrc/Interop.aml b/winrt/docsrc/Interop.aml index c69c7079b..471fecef8 100644 --- a/winrt/docsrc/Interop.aml +++ b/winrt/docsrc/Interop.aml @@ -401,7 +401,7 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license } } - Remember to include the header <unkwn.h> in pch.h before any winrt headers (required in SDK 17763 and later). + Remember to include the header <unknwn.h> in pch.h before any winrt headers (required in SDK 17763 and later). From 5d6ef6bc5c5f46a55d8148f45d57d8ae91a63572 Mon Sep 17 00:00:00 2001 From: benstevens48 Date: Sat, 30 May 2020 19:54:22 +0100 Subject: [PATCH 02/10] add white level adjustment effect --- build/Win2D.cpp.props | 2 +- tools/codegen/exe/OutputEffectType.cs | 31 +++++++-- tools/codegen/exe/Settings.cs | 8 +++ tools/codegen/exe/Settings.xml | 1 + .../apiref/effects/WhiteLevelAdjustment.xml | 36 ++++++++++ tools/codegen/exe/codegen.exe.csproj | 1 + winrt/lib/Canvas.abi.idl | 1 + winrt/lib/drawing/CanvasDevice.cpp | 28 +++++++- winrt/lib/drawing/CanvasDevice.h | 2 + winrt/lib/effects/generated/EffectMakers.cpp | 2 + .../WhiteLevelAdjustmentEffect.abi.idl | 50 ++++++++++++++ .../generated/WhiteLevelAdjustmentEffect.cpp | 69 +++++++++++++++++++ .../generated/WhiteLevelAdjustmentEffect.h | 47 +++++++++++++ winrt/lib/winrt.lib.uap.vcxproj | 8 ++- winrt/lib/winrt.lib.uap.vcxproj.filters | 9 +++ 15 files changed, 287 insertions(+), 8 deletions(-) create mode 100644 tools/codegen/exe/apiref/effects/WhiteLevelAdjustment.xml create mode 100644 winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.abi.idl create mode 100644 winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp create mode 100644 winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.h diff --git a/build/Win2D.cpp.props b/build/Win2D.cpp.props index e9a722282..e1db0bc48 100644 --- a/build/Win2D.cpp.props +++ b/build/Win2D.cpp.props @@ -64,7 +64,7 @@ - /DNTDDI_VERSION=0x0A000003 /Qspectre %(AdditionalOptions) + /DNTDDI_VERSION=0x0A000006 /Qspectre %(AdditionalOptions) diff --git a/tools/codegen/exe/OutputEffectType.cs b/tools/codegen/exe/OutputEffectType.cs index b69876a10..785238512 100644 --- a/tools/codegen/exe/OutputEffectType.cs +++ b/tools/codegen/exe/OutputEffectType.cs @@ -236,7 +236,11 @@ public static void OutputEffectIdl(Effects.Effect effect, Formatter output) output.WriteLine(customIdl.Trim()); } - if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) + if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck)) + { + output.WriteLine("HRESULT IsSupported([in] Microsoft.Graphics.Canvas.CanvasDevice* device, [out, retval] boolean* result);"); + } + else if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) { output.WriteLine("[propget] HRESULT IsSupported([out, retval] boolean* value);"); } @@ -357,7 +361,10 @@ public static void OutputEffectHeader(Effects.Effect effect, Formatter output) output.WriteLine(customDecl.Trim()); } - if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) + if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck)) { + output.WriteLine("IFACEMETHOD(IsSupported)(ICanvasDevice* device, boolean* result) override;"); + } + else if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) { output.WriteLine("IFACEMETHOD(get_IsSupported)(boolean* value) override;"); } @@ -465,7 +472,23 @@ public static void OutputEffectCpp(Effects.Effect effect, Formatter output) output.WriteLine("}"); output.WriteLine(); - if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) + if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck)) { + output.WriteLine("IFACEMETHODIMP " + effect.ClassName + "Factory::IsSupported(ICanvasDevice* device, boolean* result)"); + output.WriteLine("{"); + output.Indent(); + output.WriteLine("return ExceptionBoundary([&]"); + output.WriteLine("{"); + output.Indent(); + output.WriteLine("CheckInPointer(device);"); + output.WriteLine("CheckInPointer(result);"); + output.WriteLine("*result = SharedDeviceState::GetInstance()->IsEffectSupportedOnAnyDevice(device, " + effect.ClassName + "::EffectId(), L\"" + effect.Overrides.IsSupportedOnAnyDeviceCheck + "\");"); + output.Unindent(); + output.WriteLine("});"); + output.Unindent(); + output.WriteLine("}"); + output.WriteLine(); + } + else if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) { output.WriteLine("IFACEMETHODIMP " + effect.ClassName + "Factory::get_IsSupported(_Out_ boolean* result)"); output.WriteLine("{"); @@ -514,7 +537,7 @@ private static bool HasStatics(Effects.Effect effect) return effect.Overrides.CustomStaticMethodIdl.Count > 0 || effect.Overrides.CustomStaticMethodDecl.Count > 0 || - !string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck); + !string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck) || !string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck); } private static void WritePropertyInitialization(Formatter output, Effects.Property property) diff --git a/tools/codegen/exe/Settings.cs b/tools/codegen/exe/Settings.cs index 19cff4586..a4eeaa5d3 100644 --- a/tools/codegen/exe/Settings.cs +++ b/tools/codegen/exe/Settings.cs @@ -133,6 +133,14 @@ public class Effect [XmlAttributeAttribute] public string IsSupportedCheck; + /** + * A non-empty value means that an IsSupported function should be added to the effect which takes a device as a parameter, but it can be any + * device as the check is only OS-version dependent. The value is used as a key to cache the result so can be shared with other effect supported checks. + * By convention it is of the format Win10_17763. + */ + [XmlAttributeAttribute] + public string IsSupportedOnAnyDeviceCheck; + [XmlElement("Input")] public List Inputs { get; set; } diff --git a/tools/codegen/exe/Settings.xml b/tools/codegen/exe/Settings.xml index fc2d59887..c937ba68e 100644 --- a/tools/codegen/exe/Settings.xml +++ b/tools/codegen/exe/Settings.xml @@ -299,5 +299,6 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license + diff --git a/tools/codegen/exe/apiref/effects/WhiteLevelAdjustment.xml b/tools/codegen/exe/apiref/effects/WhiteLevelAdjustment.xml new file mode 100644 index 000000000..3d180fde7 --- /dev/null +++ b/tools/codegen/exe/apiref/effects/WhiteLevelAdjustment.xml @@ -0,0 +1,36 @@ + + + + + + <_locDefinition> + <_locDefault _loc="locNone" /> + <_locTag _locAttrData="displayname">Field + <_locTag _locAttrData="name">Input + <_locTag _locAttrData="value">Property + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/codegen/exe/codegen.exe.csproj b/tools/codegen/exe/codegen.exe.csproj index bbb39fb0c..eeed3cfd8 100644 --- a/tools/codegen/exe/codegen.exe.csproj +++ b/tools/codegen/exe/codegen.exe.csproj @@ -128,6 +128,7 @@ + + + @@ -97,6 +98,7 @@ + @@ -256,6 +258,7 @@ + Create @@ -444,6 +447,7 @@ + @@ -478,4 +482,4 @@ - + \ No newline at end of file diff --git a/winrt/lib/winrt.lib.uap.vcxproj.filters b/winrt/lib/winrt.lib.uap.vcxproj.filters index 79ca8b211..a35f2d80c 100644 --- a/winrt/lib/winrt.lib.uap.vcxproj.filters +++ b/winrt/lib/winrt.lib.uap.vcxproj.filters @@ -349,6 +349,9 @@ effects\generated + + effects\generated + xaml @@ -814,6 +817,9 @@ effects\generated + + effects\generated + xaml @@ -1147,6 +1153,9 @@ effects\generated + + effects\generated + geometry From df5f19db74bd0a6e9de9ec7125ec16f3c9cf4182 Mon Sep 17 00:00:00 2001 From: benstevens48 Date: Sat, 30 May 2020 22:05:29 +0100 Subject: [PATCH 03/10] add hdr tone map and update docs --- tools/codegen/exe/OutputEffectType.cs | 10 +-- tools/codegen/exe/Settings.cs | 2 +- tools/codegen/exe/Settings.xml | 3 +- .../codegen/exe/apiref/effects/HdrToneMap.xml | 44 +++++++++++ tools/codegen/exe/codegen.exe.csproj | 1 + tools/docs/DocPreprocess/Tag.cs | 1 + winrt/docsrc/effects/Effects.xml | 19 +++++ winrt/docsrc/effects/HdrToneMapEffect.xml | 44 +++++++++++ .../effects/WhiteLevelAdjustmentEffect.xml | 41 ++++++++++ winrt/lib/Canvas.abi.idl | 1 + winrt/lib/drawing/CanvasDevice.cpp | 8 +- winrt/lib/drawing/CanvasDevice.h | 2 +- winrt/lib/effects/generated/EffectMakers.cpp | 2 + .../generated/HdrToneMapEffect.abi.idl | 63 +++++++++++++++ .../effects/generated/HdrToneMapEffect.cpp | 77 +++++++++++++++++++ .../lib/effects/generated/HdrToneMapEffect.h | 48 ++++++++++++ .../generated/WhiteLevelAdjustmentEffect.cpp | 2 +- winrt/lib/winrt.lib.uap.vcxproj | 3 + winrt/lib/winrt.lib.uap.vcxproj.filters | 9 +++ 19 files changed, 366 insertions(+), 14 deletions(-) create mode 100644 tools/codegen/exe/apiref/effects/HdrToneMap.xml create mode 100644 winrt/docsrc/effects/HdrToneMapEffect.xml create mode 100644 winrt/docsrc/effects/WhiteLevelAdjustmentEffect.xml create mode 100644 winrt/lib/effects/generated/HdrToneMapEffect.abi.idl create mode 100644 winrt/lib/effects/generated/HdrToneMapEffect.cpp create mode 100644 winrt/lib/effects/generated/HdrToneMapEffect.h diff --git a/tools/codegen/exe/OutputEffectType.cs b/tools/codegen/exe/OutputEffectType.cs index 785238512..b1abe73f7 100644 --- a/tools/codegen/exe/OutputEffectType.cs +++ b/tools/codegen/exe/OutputEffectType.cs @@ -236,7 +236,7 @@ public static void OutputEffectIdl(Effects.Effect effect, Formatter output) output.WriteLine(customIdl.Trim()); } - if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck)) + if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedWithAnyDeviceCheck)) { output.WriteLine("HRESULT IsSupported([in] Microsoft.Graphics.Canvas.CanvasDevice* device, [out, retval] boolean* result);"); } @@ -361,7 +361,7 @@ public static void OutputEffectHeader(Effects.Effect effect, Formatter output) output.WriteLine(customDecl.Trim()); } - if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck)) { + if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedWithAnyDeviceCheck)) { output.WriteLine("IFACEMETHOD(IsSupported)(ICanvasDevice* device, boolean* result) override;"); } else if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) @@ -472,7 +472,7 @@ public static void OutputEffectCpp(Effects.Effect effect, Formatter output) output.WriteLine("}"); output.WriteLine(); - if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck)) { + if (!string.IsNullOrEmpty(effect.Overrides.IsSupportedWithAnyDeviceCheck)) { output.WriteLine("IFACEMETHODIMP " + effect.ClassName + "Factory::IsSupported(ICanvasDevice* device, boolean* result)"); output.WriteLine("{"); output.Indent(); @@ -481,7 +481,7 @@ public static void OutputEffectCpp(Effects.Effect effect, Formatter output) output.Indent(); output.WriteLine("CheckInPointer(device);"); output.WriteLine("CheckInPointer(result);"); - output.WriteLine("*result = SharedDeviceState::GetInstance()->IsEffectSupportedOnAnyDevice(device, " + effect.ClassName + "::EffectId(), L\"" + effect.Overrides.IsSupportedOnAnyDeviceCheck + "\");"); + output.WriteLine("*result = SharedDeviceState::GetInstance()->IsEffectSupportedWithAnyDevice(device, " + effect.ClassName + "::EffectId(), L\"" + effect.Overrides.IsSupportedWithAnyDeviceCheck + "\");"); output.Unindent(); output.WriteLine("});"); output.Unindent(); @@ -537,7 +537,7 @@ private static bool HasStatics(Effects.Effect effect) return effect.Overrides.CustomStaticMethodIdl.Count > 0 || effect.Overrides.CustomStaticMethodDecl.Count > 0 || - !string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck) || !string.IsNullOrEmpty(effect.Overrides.IsSupportedOnAnyDeviceCheck); + !string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck) || !string.IsNullOrEmpty(effect.Overrides.IsSupportedWithAnyDeviceCheck); } private static void WritePropertyInitialization(Formatter output, Effects.Property property) diff --git a/tools/codegen/exe/Settings.cs b/tools/codegen/exe/Settings.cs index a4eeaa5d3..ad9e1695b 100644 --- a/tools/codegen/exe/Settings.cs +++ b/tools/codegen/exe/Settings.cs @@ -139,7 +139,7 @@ public class Effect * By convention it is of the format Win10_17763. */ [XmlAttributeAttribute] - public string IsSupportedOnAnyDeviceCheck; + public string IsSupportedWithAnyDeviceCheck; [XmlElement("Input")] public List Inputs { get; set; } diff --git a/tools/codegen/exe/Settings.xml b/tools/codegen/exe/Settings.xml index c937ba68e..1e6d7611d 100644 --- a/tools/codegen/exe/Settings.xml +++ b/tools/codegen/exe/Settings.xml @@ -299,6 +299,7 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license - + + diff --git a/tools/codegen/exe/apiref/effects/HdrToneMap.xml b/tools/codegen/exe/apiref/effects/HdrToneMap.xml new file mode 100644 index 000000000..b53f905b9 --- /dev/null +++ b/tools/codegen/exe/apiref/effects/HdrToneMap.xml @@ -0,0 +1,44 @@ + + + + + + <_locDefinition> + <_locDefault _loc="locNone" /> + <_locTag _locAttrData="displayname">Field + <_locTag _locAttrData="name">Input + <_locTag _locAttrData="value">Property + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/codegen/exe/codegen.exe.csproj b/tools/codegen/exe/codegen.exe.csproj index eeed3cfd8..a15060ea6 100644 --- a/tools/codegen/exe/codegen.exe.csproj +++ b/tools/codegen/exe/codegen.exe.csproj @@ -128,6 +128,7 @@ + diff --git a/tools/docs/DocPreprocess/Tag.cs b/tools/docs/DocPreprocess/Tag.cs index 12d3f1db2..5a4aee115 100644 --- a/tools/docs/DocPreprocess/Tag.cs +++ b/tools/docs/DocPreprocess/Tag.cs @@ -12,6 +12,7 @@ class Tag new Tag("Win10_10586", "This API is only available when running on Windows 10 build 10586 (released November 2015) or greater.") { PropagateTypeTagsToMembers = true }, new Tag("Win10_14393", "This API is only available when running on Windows 10 build 14393 (Anniversary Update) or greater.") { PropagateTypeTagsToMembers = true }, new Tag("Win10_15063", "This API is only available when running on Windows 10 build 15063 (Creators Update) or greater.") { PropagateTypeTagsToMembers = true }, + new Tag("Win10_17763", "This API is only available when running on Windows 10 build 17763 (October 2018) or greater.") { PropagateTypeTagsToMembers = true }, new Tag("NoComposition", "Supported by Win2D but not Windows.UI.Composition."), }; diff --git a/winrt/docsrc/effects/Effects.xml b/winrt/docsrc/effects/Effects.xml index 2f78e1349..709f0f269 100644 --- a/winrt/docsrc/effects/Effects.xml +++ b/winrt/docsrc/effects/Effects.xml @@ -214,4 +214,23 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license + + diff --git a/winrt/docsrc/effects/HdrToneMapEffect.xml b/winrt/docsrc/effects/HdrToneMapEffect.xml new file mode 100644 index 000000000..3906cb49b --- /dev/null +++ b/winrt/docsrc/effects/HdrToneMapEffect.xml @@ -0,0 +1,44 @@ + + + + + + Microsoft.Graphics.Canvas + + + + + + This effect adjusts the dynamic range of an image to better suit its content to the capability of the output display. + + +

This Windows Runtime type corresponds to the + D2D HDR tone map effect.

+
+
+ + Initializes a new instance of the HdrToneMapEffect class. + + + Gets or sets the input source for the effect. + + + The maximum light level (or MaxCLL) of the image, in nits. Default value 80. + + + The MaxCLL supported by the output target, in nits—typically set to the MaxCLL of the display. Default value 80. + + + When set to Hdr, the tone mapping curve is adjusted to better fit the fit the behavior of common HDR displays. Default value Sdr. + + + + + + +
+
diff --git a/winrt/docsrc/effects/WhiteLevelAdjustmentEffect.xml b/winrt/docsrc/effects/WhiteLevelAdjustmentEffect.xml new file mode 100644 index 000000000..5f83d8bb5 --- /dev/null +++ b/winrt/docsrc/effects/WhiteLevelAdjustmentEffect.xml @@ -0,0 +1,41 @@ + + + + + + Microsoft.Graphics.Canvas + + + + + + This effect allows the white level of an image to be linearly scaled. This is especially helpful when you convert between display-referred luminance space and scene-referred luminance space, or vice versa. + + +

This Windows Runtime type corresponds to the + D2D White level adjustment effect.

+
+
+ + Initializes a new instance of the WhiteLevelAdjustmentEffect class. + + + Gets or sets the input source for the effect. + + + The white level of the input image, in nits. Default value 80. + + + The white level of the output image, in nits. Default value 80. + + + + + + +
+
diff --git a/winrt/lib/Canvas.abi.idl b/winrt/lib/Canvas.abi.idl index 9310ef00e..d09585b95 100644 --- a/winrt/lib/Canvas.abi.idl +++ b/winrt/lib/Canvas.abi.idl @@ -93,6 +93,7 @@ cpp_quote("#endif") #include "effects\generated\GammaTransferEffect.abi.idl" #include "effects\generated\GaussianBlurEffect.abi.idl" #include "effects\generated\GrayscaleEffect.abi.idl" +#include "effects\generated\HdrToneMapEffect.abi.idl" #include "effects\generated\HighlightsAndShadowsEffect.abi.idl" #include "effects\generated\HueRotationEffect.abi.idl" #include "effects\generated\HueToRgbEffect.abi.idl" diff --git a/winrt/lib/drawing/CanvasDevice.cpp b/winrt/lib/drawing/CanvasDevice.cpp index 1225c2c8e..1b5308388 100644 --- a/winrt/lib/drawing/CanvasDevice.cpp +++ b/winrt/lib/drawing/CanvasDevice.cpp @@ -323,7 +323,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas return !!m_isID2D1Factory5Supported; } - bool SharedDeviceState::IsEffectSupportedOnAnyDevice(ICanvasDevice* device, IID const& effectId, std::wstring const& key) { + bool SharedDeviceState::IsEffectSupportedWithAnyDevice(ICanvasDevice* device, IID const& effectId, std::wstring const& key) { CheckInPointer(device); { RecursiveLock lock(m_mutex); @@ -335,10 +335,8 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas auto lease = As(device)->GetResourceCreationDeviceContext(); ComPtr pEffect; auto hr = lease->CreateEffect(effectId, pEffect.GetAddressOf()); - bool result; - if (hr == S_OK) { - result = true; - } else if (hr == E_NOT_SET) { + bool result = true; + if (hr == E_NOT_SET) { result = false; } else { ThrowIfFailed(hr); diff --git a/winrt/lib/drawing/CanvasDevice.h b/winrt/lib/drawing/CanvasDevice.h index da639fe65..7abc0a0e6 100644 --- a/winrt/lib/drawing/CanvasDevice.h +++ b/winrt/lib/drawing/CanvasDevice.h @@ -441,7 +441,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas void SetDebugLevel(CanvasDebugLevel const& value); bool IsID2D1Factory5Supported(); - bool IsEffectSupportedOnAnyDevice(ICanvasDevice* device, IID const& effectId, std::wstring const& key); + bool IsEffectSupportedWithAnyDevice(ICanvasDevice* device, IID const& effectId, std::wstring const& key); CanvasDeviceAdapter* GetAdapter() const { return m_adapter.get(); } diff --git a/winrt/lib/effects/generated/EffectMakers.cpp b/winrt/lib/effects/generated/EffectMakers.cpp index 28363e170..ab592ee8b 100644 --- a/winrt/lib/effects/generated/EffectMakers.cpp +++ b/winrt/lib/effects/generated/EffectMakers.cpp @@ -55,6 +55,7 @@ #include "EmbossEffect.h" #include "ExposureEffect.h" #include "GrayscaleEffect.h" +#include "HdrToneMapEffect.h" #include "HighlightsAndShadowsEffect.h" #include "HueToRgbEffect.h" #include "InvertEffect.h" @@ -124,6 +125,7 @@ std::pair CanvasEffect::m_effectMakers[] { EmbossEffect::EffectId(), MakeEffect }, { ExposureEffect::EffectId(), MakeEffect }, { GrayscaleEffect::EffectId(), MakeEffect }, + { HdrToneMapEffect::EffectId(), MakeEffect }, { HighlightsAndShadowsEffect::EffectId(), MakeEffect }, { HueToRgbEffect::EffectId(), MakeEffect }, { InvertEffect::EffectId(), MakeEffect }, diff --git a/winrt/lib/effects/generated/HdrToneMapEffect.abi.idl b/winrt/lib/effects/generated/HdrToneMapEffect.abi.idl new file mode 100644 index 000000000..5722c0e2b --- /dev/null +++ b/winrt/lib/effects/generated/HdrToneMapEffect.abi.idl @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +// This file was automatically generated. Please do not edit it manually. + +#if (defined _WIN32_WINNT_WIN10) && (WINVER >= _WIN32_WINNT_WIN10) + +namespace Microsoft.Graphics.Canvas.Effects +{ + [version(VERSION)] + typedef enum HdrToneMapEffectDisplayMode + { + Sdr = 0, + Hdr = 1 + } HdrToneMapEffectDisplayMode; + + runtimeclass HdrToneMapEffect; + + [version(VERSION), uuid(2004FAAC-663E-5DF4-B4CD-A5AFBFD9341F), exclusiveto(HdrToneMapEffect)] + interface IHdrToneMapEffect : IInspectable + requires ICanvasEffect + { + [propget] + HRESULT InputMaxLuminance([out, retval] float* value); + + [propput] + HRESULT InputMaxLuminance([in] float value); + + [propget] + HRESULT OutputMaxLuminance([out, retval] float* value); + + [propput] + HRESULT OutputMaxLuminance([in] float value); + + [propget] + HRESULT DisplayMode([out, retval] HdrToneMapEffectDisplayMode* value); + + [propput] + HRESULT DisplayMode([in] HdrToneMapEffectDisplayMode value); + + [propget] + HRESULT Source([out, retval] IGRAPHICSEFFECTSOURCE** source); + + [propput] + HRESULT Source([in] IGRAPHICSEFFECTSOURCE* source); + + }; + + [version(VERSION), uuid(0181F02F-0A7E-55E1-8D2D-42AB99739B27), exclusiveto(HdrToneMapEffect)] + interface IHdrToneMapEffectStatics : IInspectable + { + HRESULT IsSupported([in] Microsoft.Graphics.Canvas.CanvasDevice* device, [out, retval] boolean* result); + } + + [STANDARD_ATTRIBUTES, activatable(VERSION), static(IHdrToneMapEffectStatics, VERSION)] + runtimeclass HdrToneMapEffect + { + [default] interface IHdrToneMapEffect; + } +} + +#endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/effects/generated/HdrToneMapEffect.cpp b/winrt/lib/effects/generated/HdrToneMapEffect.cpp new file mode 100644 index 000000000..9ceefb55d --- /dev/null +++ b/winrt/lib/effects/generated/HdrToneMapEffect.cpp @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +// This file was automatically generated. Please do not edit it manually. + +#include "pch.h" +#include "HdrToneMapEffect.h" + +#if (defined _WIN32_WINNT_WIN10) && (WINVER >= _WIN32_WINNT_WIN10) + +namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas { namespace Effects +{ + HdrToneMapEffect::HdrToneMapEffect(ICanvasDevice* device, ID2D1Effect* effect) + : CanvasEffect(EffectId(), 3, 1, true, device, effect, static_cast(this)) + { + if (!effect) + { + // Set default values + SetBoxedProperty(D2D1_HDRTONEMAP_PROP_INPUT_MAX_LUMINANCE, 4000.0f); + SetBoxedProperty(D2D1_HDRTONEMAP_PROP_OUTPUT_MAX_LUMINANCE, 300.0f); + SetBoxedProperty(D2D1_HDRTONEMAP_PROP_DISPLAY_MODE, HdrToneMapEffectDisplayMode::Sdr); + } + } + + IMPLEMENT_EFFECT_PROPERTY(HdrToneMapEffect, + InputMaxLuminance, + float, + float, + D2D1_HDRTONEMAP_PROP_INPUT_MAX_LUMINANCE) + + IMPLEMENT_EFFECT_PROPERTY(HdrToneMapEffect, + OutputMaxLuminance, + float, + float, + D2D1_HDRTONEMAP_PROP_OUTPUT_MAX_LUMINANCE) + + IMPLEMENT_EFFECT_PROPERTY(HdrToneMapEffect, + DisplayMode, + uint32_t, + HdrToneMapEffectDisplayMode, + D2D1_HDRTONEMAP_PROP_DISPLAY_MODE) + + IMPLEMENT_EFFECT_SOURCE_PROPERTY(HdrToneMapEffect, + Source, + 0) + + IMPLEMENT_EFFECT_PROPERTY_MAPPING(HdrToneMapEffect, + { L"InputMaxLuminance", D2D1_HDRTONEMAP_PROP_INPUT_MAX_LUMINANCE, GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT }, + { L"OutputMaxLuminance", D2D1_HDRTONEMAP_PROP_OUTPUT_MAX_LUMINANCE, GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT }, + { L"DisplayMode", D2D1_HDRTONEMAP_PROP_DISPLAY_MODE, GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT }) + + IFACEMETHODIMP HdrToneMapEffectFactory::ActivateInstance(IInspectable** instance) + { + return ExceptionBoundary([&] + { + auto effect = Make(); + CheckMakeResult(effect); + + ThrowIfFailed(effect.CopyTo(instance)); + }); + } + + IFACEMETHODIMP HdrToneMapEffectFactory::IsSupported(ICanvasDevice* device, boolean* result) + { + return ExceptionBoundary([&] + { + CheckInPointer(device); + CheckInPointer(result); + *result = SharedDeviceState::GetInstance()->IsEffectSupportedWithAnyDevice(device, HdrToneMapEffect::EffectId(), L"Win10_17763"); + }); + } + + ActivatableClassWithFactory(HdrToneMapEffect, HdrToneMapEffectFactory); +}}}}} + +#endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/effects/generated/HdrToneMapEffect.h b/winrt/lib/effects/generated/HdrToneMapEffect.h new file mode 100644 index 000000000..b9a8166b9 --- /dev/null +++ b/winrt/lib/effects/generated/HdrToneMapEffect.h @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +// This file was automatically generated. Please do not edit it manually. + +#pragma once + +#if (defined _WIN32_WINNT_WIN10) && (WINVER >= _WIN32_WINNT_WIN10) + +namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas { namespace Effects +{ + using namespace ::Microsoft::WRL; + using namespace ABI::Microsoft::Graphics::Canvas; + + class HdrToneMapEffect : public RuntimeClass< + IHdrToneMapEffect, + MixIn>, + public CanvasEffect + { + InspectableClass(RuntimeClass_Microsoft_Graphics_Canvas_Effects_HdrToneMapEffect, BaseTrust); + + public: + HdrToneMapEffect(ICanvasDevice* device = nullptr, ID2D1Effect* effect = nullptr); + + static IID const& EffectId() { return CLSID_D2D1HdrToneMap; } + + EFFECT_PROPERTY(InputMaxLuminance, float); + EFFECT_PROPERTY(OutputMaxLuminance, float); + EFFECT_PROPERTY(DisplayMode, HdrToneMapEffectDisplayMode); + EFFECT_PROPERTY(Source, IGraphicsEffectSource*); + + EFFECT_PROPERTY_MAPPING(); + }; + + class HdrToneMapEffectFactory + : public AgileActivationFactory + , private LifespanTracker + { + InspectableClassStatic(RuntimeClass_Microsoft_Graphics_Canvas_Effects_HdrToneMapEffect, BaseTrust); + + public: + IFACEMETHODIMP ActivateInstance(IInspectable**) override; + IFACEMETHOD(IsSupported)(ICanvasDevice* device, boolean* result) override; + }; +}}}}} + +#endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp index 56e6da79e..5faf9a5ab 100644 --- a/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp +++ b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp @@ -59,7 +59,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas { na { CheckInPointer(device); CheckInPointer(result); - *result = SharedDeviceState::GetInstance()->IsEffectSupportedOnAnyDevice(device, WhiteLevelAdjustmentEffect::EffectId(), L"Win10_17763"); + *result = SharedDeviceState::GetInstance()->IsEffectSupportedWithAnyDevice(device, WhiteLevelAdjustmentEffect::EffectId(), L"Win10_17763"); }); } diff --git a/winrt/lib/winrt.lib.uap.vcxproj b/winrt/lib/winrt.lib.uap.vcxproj index 721d4a91a..8f8a69ee2 100644 --- a/winrt/lib/winrt.lib.uap.vcxproj +++ b/winrt/lib/winrt.lib.uap.vcxproj @@ -88,6 +88,7 @@ + @@ -248,6 +249,7 @@ + @@ -437,6 +439,7 @@ + diff --git a/winrt/lib/winrt.lib.uap.vcxproj.filters b/winrt/lib/winrt.lib.uap.vcxproj.filters index a35f2d80c..b14f90133 100644 --- a/winrt/lib/winrt.lib.uap.vcxproj.filters +++ b/winrt/lib/winrt.lib.uap.vcxproj.filters @@ -318,6 +318,9 @@ effects\generated + + + effects\generated effects\generated @@ -786,6 +789,9 @@ effects\generated + + + effects\generated effects\generated @@ -1123,6 +1129,9 @@ effects\generated + + effects\generated + effects\generated From 6380aa8feac3869ce8362d97ee668da206092f96 Mon Sep 17 00:00:00 2001 From: benstevens48 Date: Sat, 30 May 2020 23:14:06 +0100 Subject: [PATCH 04/10] docs fixes --- tools/codegen/test/UnitTests.cs | 2 +- winrt/docsrc/effects/Effects.xml | 2 +- winrt/docsrc/effects/HdrToneMapEffect.xml | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/codegen/test/UnitTests.cs b/tools/codegen/test/UnitTests.cs index 14d783720..d3392e723 100644 --- a/tools/codegen/test/UnitTests.cs +++ b/tools/codegen/test/UnitTests.cs @@ -82,7 +82,7 @@ public void OutputEffectsIsSync() FileInfo[] actualGeneratedFiles = actualDirectoryInfo.GetFiles(); // Ensure the correct number of files was generated. - const int expectedEffectCount = 59; + const int expectedEffectCount = 61; Assert.AreEqual(expectedEffectCount * 3 + 2, expectedGeneratedFiles.Length); Assert.AreEqual(expectedGeneratedFiles.Length, actualGeneratedFiles.Length); diff --git a/winrt/docsrc/effects/Effects.xml b/winrt/docsrc/effects/Effects.xml index 709f0f269..95a7891d7 100644 --- a/winrt/docsrc/effects/Effects.xml +++ b/winrt/docsrc/effects/Effects.xml @@ -215,7 +215,7 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license -