Partager via


IXpsOMTileBrush::GetViewbox method

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

Syntax

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

Parameters

  • viewbox [out, retval]
    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:

SourceLeft = HorizontalImageResolution × viewbox.x / 96

SourceTop = VerticalImageResolution × viewbox.y / 96

SourceWidth = HorizontalImageResolution × viewbox.width / 96

SourceHeight = VerticalImageResolution × viewbox.height / 96

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:

viewbox.x = 48

viewbox.y = 24

viewbox.width = 24

viewbox.height = 48

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

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

IXpsOMTileBrush

XPS_RECT

XML Paper Specification