diff --git a/CHANGELOG.md b/CHANGELOG.md index a92fea8f8..75e54c20b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Win2D Changelog +## Win2D 1.26.0 - Bugfix for Visual Studio 2019 support +_April 23, 2021_ + +This change adds a workaround to avoid failing a Win2DIsPlatformTooOld check when building some projects in Visual Studio 2019. + +--- + ## Win2D 1.25.0 - XAML Islands support _April 2, 2020_ diff --git a/README.md b/README.md index 2e57954d7..5e57a358b 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow. +Visit the [DirectX Landing Page](https://devblogs.microsoft.com/directx/landing-page/) for more resources for DirectX developers. + ##### Where to get it - [NuGet package](http://www.nuget.org/packages/Win2D.uwp) - [Source code](http://github.com/Microsoft/Win2D) 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/build/nuget/VERSION b/build/nuget/VERSION index 5ff8c4f5d..5db08bf2d 100644 --- a/build/nuget/VERSION +++ b/build/nuget/VERSION @@ -1 +1 @@ -1.26.0 +1.27.0 diff --git a/build/nuget/Win2D.common.targets b/build/nuget/Win2D.common.targets index 5e04d9628..49b385e70 100644 --- a/build/nuget/Win2D.common.targets +++ b/build/nuget/Win2D.common.targets @@ -19,7 +19,7 @@ Version actual = Version.Parse(ActualVersion); - Version required = Version.Parse(RequiredVersion); + Version required = Version.Parse("10.0.17134.0"); Result = actual < required; diff --git a/tools/codegen/exe/OutputEffectType.cs b/tools/codegen/exe/OutputEffectType.cs index b69876a10..3643d3c07 100644 --- a/tools/codegen/exe/OutputEffectType.cs +++ b/tools/codegen/exe/OutputEffectType.cs @@ -400,7 +400,11 @@ public static void OutputEffectCpp(Effects.Effect effect, Formatter output) if (effect.Overrides != null && !string.IsNullOrEmpty(effect.Overrides.IsSupportedCheck)) { - output.WriteLine("if (!SharedDeviceState::GetInstance()->Is" + effect.Overrides.IsSupportedCheck + "Supported())"); + if (effect.Overrides.IsSupportedCheck == "Registered") { + output.WriteLine("if (!SharedDeviceState::GetInstance()->IsEffectRegistered(" + effect.ClassName + "::EffectId(), true))"); + } else { + output.WriteLine("if (!SharedDeviceState::GetInstance()->Is" + effect.Overrides.IsSupportedCheck + "Supported())"); + } output.Indent(); output.WriteLine("ThrowHR(E_NOTIMPL, Strings::NotSupportedOnThisVersionOfWindows);"); output.Unindent(); @@ -474,7 +478,11 @@ public static void OutputEffectCpp(Effects.Effect effect, Formatter output) output.WriteLine("{"); output.Indent(); output.WriteLine("CheckInPointer(result);"); - output.WriteLine("*result = SharedDeviceState::GetInstance()->Is" + effect.Overrides.IsSupportedCheck + "Supported();"); + if (effect.Overrides.IsSupportedCheck == "Registered") { + output.WriteLine("*result = SharedDeviceState::GetInstance()->IsEffectRegistered(" + effect.ClassName + "::EffectId(), true);"); + } else { + output.WriteLine("*result = SharedDeviceState::GetInstance()->Is" + effect.Overrides.IsSupportedCheck + "Supported();"); + } output.Unindent(); output.WriteLine("});"); output.Unindent(); diff --git a/tools/codegen/exe/Settings.cs b/tools/codegen/exe/Settings.cs index 19cff4586..93ad82d87 100644 --- a/tools/codegen/exe/Settings.cs +++ b/tools/codegen/exe/Settings.cs @@ -130,6 +130,7 @@ public class Effect [XmlAttributeAttribute] public string WinVer; + //If set to "Registered", this will checck if the effect is registered using its class ID. [XmlAttributeAttribute] public string IsSupportedCheck; diff --git a/tools/codegen/exe/Settings.xml b/tools/codegen/exe/Settings.xml index fc2d59887..aaba3b564 100644 --- a/tools/codegen/exe/Settings.xml +++ b/tools/codegen/exe/Settings.xml @@ -299,5 +299,11 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license + + + + + + diff --git a/tools/codegen/exe/apiref/UpdateApiResourceFiles.cmd b/tools/codegen/exe/apiref/UpdateApiResourceFiles.cmd index 4bd4b5332..cafabaeb8 100644 --- a/tools/codegen/exe/apiref/UpdateApiResourceFiles.cmd +++ b/tools/codegen/exe/apiref/UpdateApiResourceFiles.cmd @@ -97,6 +97,7 @@ SET FILE_LIST=^ GammaTransfer.xml ^ GaussianBlur.xml ^ Grayscale.xml ^ + HDRToneMap.xml ^ HighlightsShadows.xml ^ HueRotation.xml ^ HueToRgb.xml ^ @@ -125,7 +126,8 @@ SET FILE_LIST=^ Tint.xml ^ Turbulence.xml ^ UnPremultiply.xml ^ - Vignette.xml + Vignette.xml ^ + WhiteLevelAdjustment.xml CALL :UPDATE_FILES diff --git a/tools/codegen/exe/apiref/effects/HdrToneMap.xml b/tools/codegen/exe/apiref/effects/HdrToneMap.xml new file mode 100644 index 000000000..d43a07bf6 --- /dev/null +++ b/tools/codegen/exe/apiref/effects/HdrToneMap.xml @@ -0,0 +1,43 @@ + + + + + + <_locDefinition> + <_locDefault _loc="locNone" /> + <_locTag _locAttrData="displayname">Field + <_locTag _locAttrData="name">Input + <_locTag _locAttrData="value">Property + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/codegen/exe/apiref/effects/WhiteLevelAdjustment.xml b/tools/codegen/exe/apiref/effects/WhiteLevelAdjustment.xml new file mode 100644 index 000000000..af6d156a9 --- /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..a15060ea6 100644 --- a/tools/codegen/exe/codegen.exe.csproj +++ b/tools/codegen/exe/codegen.exe.csproj @@ -128,6 +128,8 @@ + + + + + + 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 4000. + + + The MaxCLL supported by the output target, in nits - typically set to the MaxCLL of the display. Default value 300. + + + When set to Hdr, the tone mapping curve is adjusted to better fit the fit the behavior of common HDR displays. Default value Sdr. + + + + The display mode used for the effect. + + + Specifies that the tone mapper algorithm be optimized for best appearance on a standard dynamic range (SDR) display. + + + Specifies that the tone mapper algorithm be optimized for best appearance on a high dynamic range (HDR) display. + + + + + + +
+
diff --git a/winrt/docsrc/effects/OpacityEffect.xml b/winrt/docsrc/effects/OpacityEffect.xml index 2d521a7ba..a7c2a5686 100644 --- a/winrt/docsrc/effects/OpacityEffect.xml +++ b/winrt/docsrc/effects/OpacityEffect.xml @@ -32,7 +32,7 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license - + diff --git a/winrt/docsrc/effects/TintEffect.xml b/winrt/docsrc/effects/TintEffect.xml index d48f95d5c..2ccce468b 100644 --- a/winrt/docsrc/effects/TintEffect.xml +++ b/winrt/docsrc/effects/TintEffect.xml @@ -56,7 +56,7 @@ Licensed under the MIT License. See LICENSE.txt in the project root for license - + diff --git a/winrt/docsrc/effects/WhiteLevelAdjustmentEffect.xml b/winrt/docsrc/effects/WhiteLevelAdjustmentEffect.xml new file mode 100644 index 000000000..6677f6407 --- /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 747cc8a3e..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" @@ -125,3 +126,4 @@ cpp_quote("#endif") #include "effects\generated\TurbulenceEffect.abi.idl" #include "effects\generated\UnPremultiplyEffect.abi.idl" #include "effects\generated\VignetteEffect.abi.idl" +#include "effects\generated\WhiteLevelAdjustmentEffect.abi.idl" diff --git a/winrt/lib/drawing/CanvasDevice.cpp b/winrt/lib/drawing/CanvasDevice.cpp index bb398249e..d927dca5f 100644 --- a/winrt/lib/drawing/CanvasDevice.cpp +++ b/winrt/lib/drawing/CanvasDevice.cpp @@ -323,6 +323,24 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas return !!m_isID2D1Factory5Supported; } + bool SharedDeviceState::IsEffectRegistered(IID const& effectId, bool cacheResult) { + { + RecursiveLock lock(m_mutex); + auto it = m_cachedRegisteredEffects.find(effectId); + if (it != m_cachedRegisteredEffects.end()) { + return it->second; + } + } + auto factory = m_adapter->CreateD2DFactory(CanvasDebugLevel::None); + ComPtr effectProperties; + auto hr = factory->GetEffectProperties(effectId, effectProperties.GetAddressOf()); + bool result = SUCCEEDED(hr); + if (cacheResult){ + RecursiveLock lock(m_mutex); + m_cachedRegisteredEffects.insert_or_assign(effectId, result); + } + return result; + } // // CanvasDeviceFactory diff --git a/winrt/lib/drawing/CanvasDevice.h b/winrt/lib/drawing/CanvasDevice.h index 4d07a0485..219ead385 100644 --- a/winrt/lib/drawing/CanvasDevice.h +++ b/winrt/lib/drawing/CanvasDevice.h @@ -5,6 +5,7 @@ #pragma once #include "DeviceContextPool.h" +#include "Utils/GuidUtilities.h" namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas { @@ -426,6 +427,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas CanvasDebugLevel m_currentDebugLevel; int m_isID2D1Factory5Supported; // negative = not yet checked. + std::map m_cachedRegisteredEffects; std::recursive_mutex m_mutex; @@ -440,6 +442,7 @@ namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas void SetDebugLevel(CanvasDebugLevel const& value); bool IsID2D1Factory5Supported(); + bool IsEffectRegistered(IID const& effectId, bool cacheResult); //Only set cacheResult to true for built-in effects, which cannot be unregistered. CanvasDeviceAdapter* GetAdapter() const { return m_adapter.get(); } diff --git a/winrt/lib/effects/generated/EffectMakers.cpp b/winrt/lib/effects/generated/EffectMakers.cpp index 5f8537267..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" @@ -68,6 +69,7 @@ #include "TemperatureAndTintEffect.h" #include "TintEffect.h" #include "VignetteEffect.h" +#include "WhiteLevelAdjustmentEffect.h" #endif // _WIN32_WINNT_WIN10 @@ -123,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 }, @@ -136,6 +139,7 @@ std::pair CanvasEffect::m_effectMakers[] { TemperatureAndTintEffect::EffectId(), MakeEffect }, { TintEffect::EffectId(), MakeEffect }, { VignetteEffect::EffectId(), MakeEffect }, + { WhiteLevelAdjustmentEffect::EffectId(), MakeEffect }, #endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/effects/generated/HdrToneMapEffect.abi.idl b/winrt/lib/effects/generated/HdrToneMapEffect.abi.idl new file mode 100644 index 000000000..9b3234563 --- /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 + { + [propget] HRESULT IsSupported([out, retval] boolean* value); + } + + [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..abf02d8a4 --- /dev/null +++ b/winrt/lib/effects/generated/HdrToneMapEffect.cpp @@ -0,0 +1,79 @@ +// 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 (!SharedDeviceState::GetInstance()->IsEffectRegistered(HdrToneMapEffect::EffectId(), true)) + ThrowHR(E_NOTIMPL, Strings::NotSupportedOnThisVersionOfWindows); + + 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::get_IsSupported(_Out_ boolean* result) + { + return ExceptionBoundary([&] + { + CheckInPointer(result); + *result = SharedDeviceState::GetInstance()->IsEffectRegistered(HdrToneMapEffect::EffectId(), true); + }); + } + + 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..5198871fe --- /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(get_IsSupported)(boolean* value) override; + }; +}}}}} + +#endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.abi.idl b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.abi.idl new file mode 100644 index 000000000..7eca0ebef --- /dev/null +++ b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.abi.idl @@ -0,0 +1,50 @@ +// 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 +{ + runtimeclass WhiteLevelAdjustmentEffect; + + [version(VERSION), uuid(0B0B945C-96F7-56B4-8317-01DE629FC904), exclusiveto(WhiteLevelAdjustmentEffect)] + interface IWhiteLevelAdjustmentEffect : IInspectable + requires ICanvasEffect + { + [propget] + HRESULT InputWhiteLevel([out, retval] float* value); + + [propput] + HRESULT InputWhiteLevel([in] float value); + + [propget] + HRESULT OutputWhiteLevel([out, retval] float* value); + + [propput] + HRESULT OutputWhiteLevel([in] float value); + + [propget] + HRESULT Source([out, retval] IGRAPHICSEFFECTSOURCE** source); + + [propput] + HRESULT Source([in] IGRAPHICSEFFECTSOURCE* source); + + }; + + [version(VERSION), uuid(58DACBF8-637A-5DA7-9457-1EEEDF5A191C), exclusiveto(WhiteLevelAdjustmentEffect)] + interface IWhiteLevelAdjustmentEffectStatics : IInspectable + { + [propget] HRESULT IsSupported([out, retval] boolean* value); + } + + [STANDARD_ATTRIBUTES, activatable(VERSION), static(IWhiteLevelAdjustmentEffectStatics, VERSION)] + runtimeclass WhiteLevelAdjustmentEffect + { + [default] interface IWhiteLevelAdjustmentEffect; + } +} + +#endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp new file mode 100644 index 000000000..9a9b8e140 --- /dev/null +++ b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.cpp @@ -0,0 +1,71 @@ +// 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 "WhiteLevelAdjustmentEffect.h" + +#if (defined _WIN32_WINNT_WIN10) && (WINVER >= _WIN32_WINNT_WIN10) + +namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas { namespace Effects +{ + WhiteLevelAdjustmentEffect::WhiteLevelAdjustmentEffect(ICanvasDevice* device, ID2D1Effect* effect) + : CanvasEffect(EffectId(), 2, 1, true, device, effect, static_cast(this)) + { + if (!SharedDeviceState::GetInstance()->IsEffectRegistered(WhiteLevelAdjustmentEffect::EffectId(), true)) + ThrowHR(E_NOTIMPL, Strings::NotSupportedOnThisVersionOfWindows); + + if (!effect) + { + // Set default values + SetBoxedProperty(D2D1_WHITELEVELADJUSTMENT_PROP_INPUT_WHITE_LEVEL, 80.0f); + SetBoxedProperty(D2D1_WHITELEVELADJUSTMENT_PROP_OUTPUT_WHITE_LEVEL, 80.0f); + } + } + + IMPLEMENT_EFFECT_PROPERTY(WhiteLevelAdjustmentEffect, + InputWhiteLevel, + float, + float, + D2D1_WHITELEVELADJUSTMENT_PROP_INPUT_WHITE_LEVEL) + + IMPLEMENT_EFFECT_PROPERTY(WhiteLevelAdjustmentEffect, + OutputWhiteLevel, + float, + float, + D2D1_WHITELEVELADJUSTMENT_PROP_OUTPUT_WHITE_LEVEL) + + IMPLEMENT_EFFECT_SOURCE_PROPERTY(WhiteLevelAdjustmentEffect, + Source, + 0) + + IMPLEMENT_EFFECT_PROPERTY_MAPPING(WhiteLevelAdjustmentEffect, + { L"InputWhiteLevel", D2D1_WHITELEVELADJUSTMENT_PROP_INPUT_WHITE_LEVEL, GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT }, + { L"OutputWhiteLevel", D2D1_WHITELEVELADJUSTMENT_PROP_OUTPUT_WHITE_LEVEL, GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT }) + + IFACEMETHODIMP WhiteLevelAdjustmentEffectFactory::ActivateInstance(IInspectable** instance) + { + return ExceptionBoundary([&] + { + auto effect = Make(); + CheckMakeResult(effect); + + ThrowIfFailed(effect.CopyTo(instance)); + }); + } + + IFACEMETHODIMP WhiteLevelAdjustmentEffectFactory::get_IsSupported(_Out_ boolean* result) + { + return ExceptionBoundary([&] + { + CheckInPointer(result); + *result = SharedDeviceState::GetInstance()->IsEffectRegistered(WhiteLevelAdjustmentEffect::EffectId(), true); + }); + } + + ActivatableClassWithFactory(WhiteLevelAdjustmentEffect, WhiteLevelAdjustmentEffectFactory); +}}}}} + +#endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.h b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.h new file mode 100644 index 000000000..579eca0cf --- /dev/null +++ b/winrt/lib/effects/generated/WhiteLevelAdjustmentEffect.h @@ -0,0 +1,47 @@ +// 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 WhiteLevelAdjustmentEffect : public RuntimeClass< + IWhiteLevelAdjustmentEffect, + MixIn>, + public CanvasEffect + { + InspectableClass(RuntimeClass_Microsoft_Graphics_Canvas_Effects_WhiteLevelAdjustmentEffect, BaseTrust); + + public: + WhiteLevelAdjustmentEffect(ICanvasDevice* device = nullptr, ID2D1Effect* effect = nullptr); + + static IID const& EffectId() { return CLSID_D2D1WhiteLevelAdjustment; } + + EFFECT_PROPERTY(InputWhiteLevel, float); + EFFECT_PROPERTY(OutputWhiteLevel, float); + EFFECT_PROPERTY(Source, IGraphicsEffectSource*); + + EFFECT_PROPERTY_MAPPING(); + }; + + class WhiteLevelAdjustmentEffectFactory + : public AgileActivationFactory + , private LifespanTracker + { + InspectableClassStatic(RuntimeClass_Microsoft_Graphics_Canvas_Effects_WhiteLevelAdjustmentEffect, BaseTrust); + + public: + IFACEMETHODIMP ActivateInstance(IInspectable**) override; + IFACEMETHOD(get_IsSupported)(boolean* value) override; + }; +}}}}} + +#endif // _WIN32_WINNT_WIN10 diff --git a/winrt/lib/utils/GuidUtilities.h b/winrt/lib/utils/GuidUtilities.h new file mode 100644 index 000000000..fdd6219e8 --- /dev/null +++ b/winrt/lib/utils/GuidUtilities.h @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See LICENSE.txt in the project root for license information. + +#pragma once + +namespace ABI { namespace Microsoft { namespace Graphics { namespace Canvas +{ + + struct GuidComparer { + bool operator()(GUID const& left, GUID const& right) const { + return memcmp(&left, &right, sizeof(GUID)) < 0; + } + }; + +}}}} \ No newline at end of file diff --git a/winrt/lib/winrt.lib.uap.vcxproj b/winrt/lib/winrt.lib.uap.vcxproj index 0e878a9cf..d063f6950 100644 --- a/winrt/lib/winrt.lib.uap.vcxproj +++ b/winrt/lib/winrt.lib.uap.vcxproj @@ -54,7 +54,8 @@ - + + @@ -87,6 +88,7 @@ + @@ -97,6 +99,7 @@ + @@ -218,6 +221,7 @@ + @@ -246,6 +250,7 @@ + @@ -256,6 +261,7 @@ + Create @@ -434,6 +440,7 @@ + @@ -444,6 +451,7 @@ + @@ -478,4 +486,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..7c01d65c9 100644 --- a/winrt/lib/winrt.lib.uap.vcxproj.filters +++ b/winrt/lib/winrt.lib.uap.vcxproj.filters @@ -319,6 +319,9 @@ effects\generated + + effects\generated + effects\generated @@ -349,6 +352,9 @@ effects\generated + + effects\generated + xaml @@ -784,6 +790,9 @@ effects\generated + + effects\generated + effects\generated @@ -814,6 +823,9 @@ effects\generated + + effects\generated + xaml @@ -943,6 +955,9 @@ svg + + utils + @@ -1117,6 +1132,9 @@ effects\generated + + effects\generated + effects\generated @@ -1147,6 +1165,9 @@ effects\generated + + effects\generated + geometry