IXpsOMObjectFactory::CreateSolidColorBrush method
Creates an IXpsOMSolidColorBrush interface, which specifies a brush of a single, solid color.
Syntax
HRESULT CreateSolidColorBrush(
[in] const XPS_COLOR *color,
[in] IXpsOMColorProfileResource *colorProfile,
[out, retval] IXpsOMSolidColorBrush **solidColorBrush
);
Parameters
color [in]
The XPS_COLOR structure that specifies the brush color.colorProfile [in]
The IXpsOMColorProfileResource interface. Unless the color type is XPS_COLOR_TYPE_CONTEXT, this value must be NULL.solidColorBrush [out, retval]
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 | 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 |