Is Win2D yet available in C++/WinRt?

2019-06-07 04:28发布

I need to use win2D in my cppwinrt project. Using the Win2D sample file as a model I’ve tried to mimic its setup, putting in the package file for win2d from that project, duplicating the custom build step, but I can’t get it to compile. I remember some talk about Win2D being added soon to the standard cppwinrt headers so that it could be accessed like others of these wonderful cppwinrt interfaces. Is this something that might happen soon? Or does anyone have some really specific instructions for using Win2D in the current Visual Studio 2017 environment? I’m in the Insider preview program but haven’t seen anything come up. Thanks.

2条回答
地球回转人心会变
2楼-- · 2019-06-07 05:07

As of the recent update, using Newget to install Win2D into a C++/WinRT project will automatically generate the headers and install them in "GeneratedFiles\winrt\"

查看更多
冷血范
3楼-- · 2019-06-07 05:12

Once you have downloaded Win2D and assuming you have the latest RS4 Windows SDK installed, you can simply use cppwinrt to generate the Win2D headers for consumption:

cppwinrt -in lib\uap10.0\Microsoft.Graphics.Canvas.winmd -ref sdk

This will generate a winrt folder that contains the headers that you need to include in order to use Win2D. You will then need to add the parent folder to your include paths and ensure that the Win2D DLL is copied to your package or build output folder.

查看更多
登录 后发表回答