Compartir a través de


Viewport Structure

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Defines the window dimensions of a render-target surface onto which a 3D volume projects.

Namespace:  Microsoft.Xna.Framework.Graphics
Assembly:  Microsoft.Xna.Framework.Graphics (in Microsoft.Xna.Framework.Graphics.dll)

Syntax

'Declaration
Public Structure Viewport
public struct Viewport

The Viewport type exposes the following members.

Constructors

  Name Description
Public method Viewport(Rectangle) Creates an instance of this object.
Public method Viewport(Int32, Int32, Int32, Int32) Initializes a new instance of the Viewport class.

Top

Properties

  Name Description
Public property AspectRatio Gets the aspect ratio used by the viewport
Public property Bounds Gets the size of this resource.
Public property Height Gets or sets the height dimension of the viewport on the render-target surface, in pixels.
Public property MaxDepth Gets or sets the maximum depth of the clip volume.
Public property MinDepth Gets or sets the minimum depth of the clip volume.
Public property Width Gets or sets the width dimension of the viewport on the render-target surface, in pixels.
Public property X Gets or sets the pixel coordinate of the upper-left corner of the viewport on the render-target surface.
Public property Y Gets or sets the pixel coordinate of the upper-left corner of the viewport on the render-target surface.

Top

Extension Methods

  Name Description
Public Extension Method Project Projects a 3D vector from object space into screen space. (Defined by ViewportExtensions.)
Public Extension Method Unproject Converts a screen space point into a corresponding point in world space. (Defined by ViewportExtensions.)

Top

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.