IXpsOMObjectFactory::CreateSolidColorBrush method (xpsobjectmodel.h)

Creates an IXpsOMSolidColorBrush interface, which specifies a brush of a single, solid color.

Syntax

HRESULT CreateSolidColorBrush(
  const XPS_COLOR            *color,
  IXpsOMColorProfileResource *colorProfile,
  IXpsOMSolidColorBrush      **solidColorBrush
);

Parameters

color

The XPS_COLOR structure that specifies the brush color.

colorProfile

The IXpsOMColorProfileResource interface. Unless the color type is XPS_COLOR_TYPE_CONTEXT, this value must be NULL.

solidColorBrush

A pointer to the new IXpsOMSolidColorBrush interface.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the table that follows. For information about XPS document API return values that are not listed in this table, see XPS Document Errors.

Return code Description
S_OK
The method succeeded.
E_POINTER
color or solidColorBrush is NULL.
XPS_E_MISSING_COLORPROFILE
colorProfile is NULL when a color profile is expected. A color profile is required when the color type is XPS_COLOR_TYPE_CONTEXT.
XPS_E_NO_CUSTOM_OBJECTS
colorProfile does not point to a recognized interface implementation. Custom implementation of XPS Document API interfaces is not supported.
XPS_E_UNEXPECTED_COLORPROFILE
colorProfile contains a color profile when one is not expected. A color profile is required only when the color type is XPS_COLOR_TYPE_CONTEXT.

Remarks

The code example that follows illustrates how this method is used to create a new interface.


IXpsOMSolidColorBrush             *newInterface;
// The following values are defined outside of 
// this example.
//  XPS_COLOR                     color;
//  IXpsOMColorProfileResource    *colorProfile;

// 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))
{
    hr = xpsFactory->CreateSolidColorBrush (
        &color,
        colorProfile,
        &newInterface);

    if (SUCCEEDED(hr))
    {
        // use newInterface

        newInterface->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 | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header xpsobjectmodel.h

See also

IXpsOMColorProfileResource

IXpsOMObjectFactory

IXpsOMSolidColorBrush

XML Paper Specification

XPS Document Errors

XPS_COLOR