Open Inventor Reference
SbViewportRegion Class Reference

Class for representing a viewport. More...

#include <Inventor/SbViewportRegion.h>

Public Member Functions

 SbViewportRegion ()
 Constructors of various kinds.
 
 SbViewportRegion (short width, short height)
 Constructors of various kinds.
 
 SbViewportRegion (SbVec2s winSize)
 Constructors of various kinds.
 
 SbViewportRegion (const SbViewportRegion &vpReg)
 Constructors of various kinds.
 
void setWindowSize (short width, short height)
 Changes window size to given width and height in pixels.
 
void setWindowSize (SbVec2s winSize)
 Changes window size to given width and height in pixels, given as SbVec2s.
 
void setViewport (float left, float bottom, float width, float height)
 Sets viewport to given region, specified as normalized window coordinates: (0,0) is the lower-left corner, (1,1) is the upper-right.
 
void setViewport (SbVec2f origin, SbVec2f size)
 Sets viewport to region with given origin (lower-left corner) and size, given as normalized coordinate vectors.
 
void setViewportPixels (short left, short bottom, short width, short height)
 Sets viewport to given region, specified as pixel coordinates in window: (0,0) is the lower-left corner.
 
void setViewportPixels (SbVec2s origin, SbVec2s size)
 Sets viewport to region with given origin (lower-left corner) and size, given as pixel coordinates.
 
const SbVec2sgetWindowSize () const
 Returns window size in pixels.
 
const SbVec2fgetViewportOrigin () const
 Returns viewport origin in normalized coordinates.
 
const SbVec2sgetViewportOriginPixels () const
 Returns viewport origin in pixels.
 
const SbVec2fgetViewportSize () const
 Returns viewport size in normalized coordinates.
 
const SbVec2sgetViewportSizePixels () const
 Returns viewport size in pixels.
 
float getViewportAspectRatio () const
 Returns aspect ratio (width/height) of viewport.
 
void scaleWidth (float ratio)
 Scales viewport within window to be the given ratio of its current width, leaving the resulting viewport centered about the same point as the current one.
 
void scaleHeight (float ratio)
 Scales viewport within window to be the given ratio of its current height, leaving the resulting viewport centered about the same point as the current one.
 
void setPixelsPerInch (float ppi)
 Sets/returns the pixel-per-inch ratio for the display device the viewport is part of.
 
float getPixelsPerInch () const
 
float getPixelsPerPoint () const
 Convenience function that returns number of pixels per printer's point.
 

Friends

INVENTOR_API bool operator== (const SbViewportRegion &reg1, const SbViewportRegion &reg2)
 Equality comparison operator.
 

Detailed Description

This class represents the active viewport region in a display window. It contains the screen-space size of the window as well as the origin and size of the viewport within the window. By default, the viewport is the same as the full window. Methods allow the viewport to be set either in terms of screen-space pixels or as normalized coordinates, where (0,0) is the lower-left corner of the window and (1,1) is the upper-right corner.

See Also
SbVec2f, SbVec2s

Definition at line 82 of file SbViewportRegion.h.

Constructor & Destructor Documentation

◆ SbViewportRegion() [1/4]

SbViewportRegion::SbViewportRegion ( )

◆ SbViewportRegion() [2/4]

SbViewportRegion::SbViewportRegion ( short  width,
short  height 
)

◆ SbViewportRegion() [3/4]

SbViewportRegion::SbViewportRegion ( SbVec2s  winSize)

◆ SbViewportRegion() [4/4]

SbViewportRegion::SbViewportRegion ( const SbViewportRegion vpReg)

Member Function Documentation

◆ getPixelsPerInch()

float SbViewportRegion::getPixelsPerInch ( ) const
inline

Definition at line 158 of file SbViewportRegion.h.

◆ getPixelsPerPoint()

float SbViewportRegion::getPixelsPerPoint ( ) const
inline

Definition at line 161 of file SbViewportRegion.h.

◆ getViewportAspectRatio()

float SbViewportRegion::getViewportAspectRatio ( ) const
inline

Definition at line 141 of file SbViewportRegion.h.

◆ getViewportOrigin()

const SbVec2f & SbViewportRegion::getViewportOrigin ( ) const
inline

Definition at line 129 of file SbViewportRegion.h.

◆ getViewportOriginPixels()

const SbVec2s & SbViewportRegion::getViewportOriginPixels ( ) const
inline

Definition at line 132 of file SbViewportRegion.h.

◆ getViewportSize()

const SbVec2f & SbViewportRegion::getViewportSize ( ) const
inline

Definition at line 135 of file SbViewportRegion.h.

◆ getViewportSizePixels()

const SbVec2s & SbViewportRegion::getViewportSizePixels ( ) const
inline

Definition at line 138 of file SbViewportRegion.h.

◆ getWindowSize()

const SbVec2s & SbViewportRegion::getWindowSize ( ) const
inline

Definition at line 126 of file SbViewportRegion.h.

◆ scaleHeight()

void SbViewportRegion::scaleHeight ( float  ratio)

◆ scaleWidth()

void SbViewportRegion::scaleWidth ( float  ratio)

◆ setPixelsPerInch()

void SbViewportRegion::setPixelsPerInch ( float  ppi)
inline

The default value is 72 (1 pixel per printer's point).

Definition at line 157 of file SbViewportRegion.h.

◆ setViewport() [1/2]

void SbViewportRegion::setViewport ( float  left,
float  bottom,
float  width,
float  height 
)
inline

Definition at line 107 of file SbViewportRegion.h.

◆ setViewport() [2/2]

void SbViewportRegion::setViewport ( SbVec2f  origin,
SbVec2f  size 
)

◆ setViewportPixels() [1/2]

void SbViewportRegion::setViewportPixels ( SbVec2s  origin,
SbVec2s  size 
)

◆ setViewportPixels() [2/2]

void SbViewportRegion::setViewportPixels ( short  left,
short  bottom,
short  width,
short  height 
)
inline

Definition at line 117 of file SbViewportRegion.h.

◆ setWindowSize() [1/2]

void SbViewportRegion::setWindowSize ( SbVec2s  winSize)

◆ setWindowSize() [2/2]

void SbViewportRegion::setWindowSize ( short  width,
short  height 
)
inline

Definition at line 98 of file SbViewportRegion.h.

Friends And Related Symbol Documentation

◆ operator==

INVENTOR_API bool operator== ( const SbViewportRegion reg1,
const SbViewportRegion reg2 
)
friend

The documentation for this class was generated from the following file: