如何在基于相机的应用程序上为Windows Phone 8.1 WinRT应用色彩效果?

时间:2015-07-02 16:54:37

标签: c# windows xaml windows-runtime windows-phone-8.1

我正在开发适用于视觉障碍用户的Windows Phone 8.1 WinRT上的放大应用程序,并且在放大页面(基于相机)中,我想应用色彩效果和对比度以获得更多可访问性(黑色为白色,黄色为蓝色,黄色为黑色,黑色白色,......)

http://www.1800pocketpc.com/wp-content/uploads/2014/10/Microsoft-Pocket-Magnifier-700x437.jpg

有谁知道如何处理?

1 个答案:

答案 0 :(得分:1)

我认为最简单的方法是使用适用于WinRT平台的Lumia Imaging SDK(https://msdn.microsoft.com/en-us/library/dn859593.aspx)。例如,ContrastFilter类可能非常适合你。以下是如何使用它:

using (var filterEffect = new FilterEffect(source))
{
    // Initialize the filter and add the filter to the FilterEffect collection
    var filter = new ContrastFilter(0.5);

    filterEffect.Filters = new IFilter[] { filter };

    // Create a target where the filtered image will be rendered to
    var target = new WriteableBitmap(width, height);

    // Create a new renderer which outputs WriteableBitmaps
    using (var renderer = new WriteableBitmapRenderer(filterEffect, target))
    {
        // Render the image with the filter(s)
        await renderer.RenderAsync();

        // Set the output image to Image control as a source
        ImageControl.Source = target;
    }

    await SaveEffectAsync(filterEffect, "ContrastFilter.jpg", outputImageSize);
}

在有人说它是sdk文档的副本/粘贴之前 - 没关系,因为我已将该示例写入原始文档:)