IXpsOMImageResource 接口 (xpsobjectmodel.h)

提供图像资源的 IStream 接口。

继承

IXpsOMImageResource 接口继承自 IXpsOMResourceIXpsOMImageResource 还具有以下类型的成员:

方法

IXpsOMImageResource 接口具有这些方法。

 
IXpsOMImageResource::GetImageType

获取图像资源的类型。
IXpsOMImageResource::GetStream

获取与此资源关联的流的新只读副本。 (IXpsOMImageResource.GetStream)
IXpsOMImageResource::SetContent

设置要与此资源关联的只读流。 (IXpsOMImageResource.SetContent)

注解

下面的代码示例演示了如何创建此接口的实例。


IXpsOMImageResource    *newInterface;
// The following values are defined outside of 
// this example.
//  IStream            *acquiredStream;
//  XPS_IMAGE_TYPE     contentType;
//  IOpcPartUri        *partUri;
    
// Note the implicit requirement that CoInitializeEx 
//  has previously been called from this thread.

hr = CoCreateInstance(
    __uuidof(XpsOMObjectFactory),
    NULL,
    CLSCTX_INPROC_SERVER,
    _uuidof(IXpsOMObjectFactory),
    reinterpret_cast<LPVOID*>(&xpsFactory)
    );

if (SUCCEEDED(hr))
{
    // The partUriString and acquiredStream variables 
    //   are defined outside of this example.
    hr = xpsFactory->CreatePartUri(partUriString, &partUri);
    if (SUCCEEDED(hr))
    {
        hr = xpsFactory->CreateImageResource (
            acquiredStream,
            contentType,
            partUri,
            &newInterface);
        if (SUCCEEDED(hr))
        {
            // use newInterface

            newInterface->Release();
        }
        partUri->Release();
    }
    xpsFactory->Release();
}
else
{
    // evaluate HRESULT error returned in hr
}

要求

   
最低受支持的客户端 Windows 7、带 SP2 的 Windows Vista 和适用于 Windows Vista 的平台更新 [桌面应用 |UWP 应用]
最低受支持的服务器 Windows Server 2008 R2、Windows Server 2008 SP2 和适用于 Windows Server 2008 的平台更新 [桌面应用 |UWP 应用]
目标平台 Windows
标头 xpsobjectmodel.h

另请参阅

IXpsOMObjectFactory::CreateImageResource

IXpsOMResource

接口

XML 纸张规范