IXpsOMTileBrush::GetViewbox method (xpsobjectmodel.h)

Gets the portion of the source image to be used by the tile.

Syntax

HRESULT GetViewbox(
  [out, retval] XPS_RECT *viewbox
);

Parameters

[out, retval] viewbox

The XPS_RECT structure that describes the area of the source content to be used by the tile.

Return value

If the method succeeds, it returns S_OK; otherwise, it returns an HRESULT error code.

Return code Description
S_OK
The method succeeded.
E_POINTER
viewbox is NULL.

Remarks

The brush's viewbox specifies the portion of a source image or visual to be used as the tile image.

The coordinates of the brush's viewbox are relative to the source content, such that (0,0) specifies the upper-left corner of the source content. For images, dimensions specified by the brush's viewbox are expressed in the units of 1/96". The corresponding pixel coordinates in the source image are calculated as follows:

In the illustration that follows, the image on the left is an example of a source image, the image in the center shows the selected viewbox, and the image on the right shows the resulting brush.

An illustration that shows a viewbox example If the source image resolution is 96 by 96 dots per inch and image dimensions are 96 by 96 pixels, the values of fields in the viewbox parameter would be:

The preceding parameter values correspond to the source image as:

SourceLeft = 96 × 48 / 96 = 48 pixels from the left side
SourceTop = 96 × 4 / 96 = 24 pixels from the top
SourceWidth = 96 × 24 / 96 = 24 pixels wide
SourceHeight = 96 × 48 / 96 = 48 pixels high

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

IXpsOMTileBrush

XML Paper Specification

XPS_RECT