Raspberry Pi上UWP中Color类(System.Drawing)的问题

问题描述 投票:1回答:1

我很难在运行Windows 10 IoT的Raspberry Pi上使用Color类实现一些基本操作。在通过rgb数据实例化Color对象之后,基本方法(如GetBrightness()或GetSaturation())会导致SEHException。

Thrown exception: System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.

在调试期间在Visual Studio中的“即时窗口”中键入操作会产生所需的结果。我甚至不知道从哪里开始找到实际问题。

我正在使用带有Windows 10 IoT Core 17763的Raspberry Pi 2b(也是项目构建设置),并尝试在其上运行C#UWP项目。

我尝试了几个目标版本,并更新了我的机器。到目前为止没有帮助。

// using System.Drawing;
Color color1 = Color.FromArgb(x, y, z);                
float brt = color1.GetBrightness(); // <= Not passing this line
float sat = color1.GetSaturation();

如上所述,立即窗口中的结果似乎是合理的,并至少起作用。为什么这也不是在代码中运行。实际处理的代码在哪里,在即时窗口中输入?

c# uwp raspberry-pi windows-10-iot-core
1个回答
0
投票

在Windows Universal app中无法进行System.Drawing,它是用于处理GDI +的.NET命名空间。您可以使用SharpDX,它为Direct2D,DirectWrite和Windows Imaging Component(WIC)提供包装器。 GetHue方法包含在ColorBGRA.cs中。

© www.soinside.com 2019 - 2024. All rights reserved.