SlaarToolkit - 仅支持32位ARGB像素格式,而不支持Format32bppArgb

时间:2012-06-23 18:45:51

标签: .net windows-phone-7

有没有办法将Format32bppArgb转换为32位argb以及如何?

编辑:好的,我正在加载默认的SlaarToolkit标记:

var marker = Marker.LoadFromResource("/Content/Marker_SLAR_16x16segments_80width.pat", 16, 16, 80);

当我运行应用程序时,我收到InvalidOperationException并显示消息:

Only 32 Bit ARGB pixel format is supported, not Format32bppArgb

1 个答案:

答案 0 :(得分:2)

对于该库,您尝试加载的内容文件或Windows Phone CLR本身而言,这听起来有点不对。

以下是引发该异常的库中的代码:

/// <summary>
/// Invoked when a video device reports a  video format change.
/// </summary>
/// <param name="videoFormat">The new video format.</param>
protected override void OnFormatChange(VideoFormat videoFormat)
{
    if (videoFormat.PixelFormat != PixelFormatType.Format32bppArgb)
    {
        throw new InvalidOperationException(String.Format("Only 32 Bit ARGB pixel format is supported, not {0}.", videoFormat.PixelFormat));
    }

    detector.ChangeFormat(videoFormat.PixelWidth, videoFormat.PixelHeight);
    vidFormat = videoFormat;
}

这是一个非常直接的比较,并且会让我相信videoFormat参数的PixelFormat属性实际上不是PixelFormatType.Format32bppArgb。

如果没有更多细节和更大的代码示例,以及导致问题的文件,几乎不可能分辨出这里发生了什么。

我真的无法想象这是怎么发生的,因为VideoFormat和PixelFormatType都是Windows Phone的内置CLR类型。 PixelFormatType是一个简单的枚举,甚至没有位标记,因此它不会成为重叠位字段的问题。 VideoFormat的PixelFormat属性的类型为PixelFormatType,因此您不应该使用此值抛出此异常。

我会向图书馆的开发者和微软报告这个问题,因为这似乎是以一种看不见的方式出现问题。

当您尝试使用其他内容文件时是否会发生这种情况?