IXpsOMLinearGradientBrush interface (xpsobjectmodel.h)

Specifies a linear gradient, which is the color gradient along a vector.

Inheritance

The IXpsOMLinearGradientBrush interface inherits from IXpsOMGradientBrush. IXpsOMLinearGradientBrush also has these types of members:

Methods

The IXpsOMLinearGradientBrush interface has these methods.

 
IXpsOMLinearGradientBrush::Clone

Makes a deep copy of the interface. (IXpsOMLinearGradientBrush.Clone)
IXpsOMLinearGradientBrush::GetEndPoint

Gets the end point of the gradient.
IXpsOMLinearGradientBrush::GetStartPoint

Gets the start point of the gradient.
IXpsOMLinearGradientBrush::SetEndPoint

Sets the end point of the gradient.
IXpsOMLinearGradientBrush::SetStartPoint

Sets the start point of the gradient.

Remarks

In the illustration that follows, the start and end points of a linear gradient are also the start and end points of the gradient path, which is the straight line that connects those points.

The gradient region of a linear gradient is the area between and including the start and end points and extending in both directions at a right angle to the gradient path. The spread area is the area of the geometry that lies outside the gradient region.

Gradient stops are used to define the color at specific locations along the gradient path. In the illustration, gradient stop 0 is located at the start point of the gradient path, and gradient stop 1 is at the end point. The XPS_SPREAD_METHOD_PAD spread method is used to fill the spread area.

A figure that shows the terms used in a linear gradient The code example that follows illustrates how to create an instance of this interface.

IXpsOMLinearGradientBrush    *newInterface;
// The following values are defined outside of 
// this example.
//  IXpsOMGradientStop       *gradStop1, *gradStop2;
//  XPS_POINT                startPoint, endPoint;

// 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->CreateLinearGradientBrush (
        gradStop1,
        gradStop2,
        &startPoint,
        &endPoint,
        &newInterface);

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

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

Requirements

Requirement Value
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

IXpsOMGradientBrush

IXpsOMGradientStop

IXpsOMObjectFactory::CreateLinearGradientBrush

IXpsOMRadialGradientBrush

Interfaces

XML Paper Specification