此主题尚未评级 - 评价此主题

DisplayProperties.GetColorProfileAsync | getColorProfileAsync Method

异步获取与实际显示关联的默认国际色彩联合会 (ICC) 颜色配置文件。

语法


public static IAsyncOperation<IRandomAccessStream> GetColorProfileAsync()

参数

此 方法 没有参数。

返回值

类型: IAsyncOperation<IRandomAccessStream>

管理颜色配置文件的异步检索的对象。

备注

如果没有实际显示器连接到运行该应用程序的计算机(例如,通过远程桌面连接运行应用程序),没有颜色配置文件与显示器关联,或者配置文件与 ICC 颜色配置文件的签名不匹配,异步操作会失败。

有关如何使用 GetColorProfileAsync 的信息,请参见 Direct2D 图形影响照片调整示例。

Windows Phone 8

此 API 不实现,并且在调用时会引发异常。

示例


task<IRandomAccessStream^> getProfileTask(DisplayProperties::GetColorProfileAsync());

getProfileTask.then([=](task<IRandomAccessStream^> profileTask) {
    try
    {
        IRandomAccessStream^ profileStream = profileTask.get();

        DataReader^ profileReader = ref new DataReader(profileStream);

        task<unsigned int> loadTask(profileReader->LoadAsync(profileStream->Size));
        loadTask.then([=] (task<unsigned int> readTask) {
            unsigned int readBytes = readTask.get();
            // The data reader can be used to provide the profile bytes to an API
            // such as ID2D1ColorContext.
        });
    }
    catch (Platform::Exception^ e)
    {
        if (e->HResult == 0x80070002) // ERROR_FILE_NOT_FOUND
        {
            // The display does not have a color profile associated with it
            // or there is no physical display.
        }
        else if (e->HResult == 0x800707db) // ERROR_INVALID_PROFILE
        {
            // The color profile does not match the signature of a valid ICC profile.
        }
        else
        {
            throw;
        }
    }
});


要求

最低受支持的客户端

Windows 8

最低受支持的服务器

Windows Server 2012

最低受支持的电话

Windows Phone 8

命名空间

Windows.Graphics.Display
Windows::Graphics::Display [C++]

元数据

Windows.winmd

另请参阅

DisplayProperties::ColorProfileChanged
DisplayProperties

 

 

本文是否对您有所帮助?
(1500 个剩余字符)
© 2013 Microsoft. 版权所有。