共用方式為


IXpsOMImageResource interface

Provides an IStream interface to an image resource.

When to implement

Never. Custom implementation of this interface is not supported.

Members

The IXpsOMImageResource interface inherits from IXpsOMResource. IXpsOMImageResource also has these types of members:

  • Methods

Methods

The IXpsOMImageResource interface has these methods.

Method Description
GetImageType

Gets the type of image resource.

GetStream

Gets a new, read-only copy of the stream that is associated with this resource.

SetContent

Sets the read-only stream to be associated with this resource.

 

Remarks

The code example that follows illustrates how to create an instance of this interface.

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
}

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Header

Xpsobjectmodel.h

IDL

XpsObjectModel.idl

See also

IXpsOMResource

IXpsOMObjectFactory::CreateImageResource

Interfaces

XML Paper Specification