Expand Minimize

IXpsOMLinearGradientBrush interface

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

When to implement

Never. Custom implementation of this interface is not supported.

Members

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

Methods

The IXpsOMLinearGradientBrush interface has these methods.

MethodDescription
Clone

Makes a deep copy of the interface.

GetEndPoint

Gets the end point of the gradient.

GetStartPoint

Gets the start point of the gradient.

SetEndPoint

Sets the end point of the gradient.

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

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

IXpsOMObjectFactory::CreateLinearGradientBrush
IXpsOMGradientStop
IXpsOMRadialGradientBrush
Interfaces
XML Paper Specification

 

 

Community Additions

ADD
Show:
© 2014 Microsoft