SbViewportRegion Class Reference
[Basics]

Class for representing a viewport. More...

#include <Inventor/SbViewportRegion.h>

List of all members.

Public Member Functions

 SbViewportRegion ()
 SbViewportRegion (short width, short height, float newScale=1.0)
 SbViewportRegion (SbVec2s winSize, float newScale=1.0)
 SbViewportRegion (SbVec2i32 winSize, float newScale=1.0)
 SbViewportRegion (const SbViewportRegion &vpReg)
void setWindowSize (short width, short height)
void setWindowSize (SbVec2s winSize)
void setWindowSize (SbVec2i32 winSize)
void setViewport (float left, float bottom, float width, float height)
void setViewport (SbVec2f origin, SbVec2f size)
void setViewportPixels (short left, short bottom, short width, short height)
void setViewportPixels (SbVec2s origin, SbVec2s size)
void setViewportPixels (SbVec2i32 origin, SbVec2i32 size)
const SbVec2sgetWindowSize () const
const SbVec2i32getWindowSize_i32 () const
const SbVec2fgetViewportOrigin () const
const SbVec2sgetViewportOriginPixels () const
const SbVec2i32getViewportOriginPixels_i32 () const
const SbVec2fgetViewportSize () const
const SbVec2sgetViewportSizePixels () const
const SbVec2i32getViewportSizePixels_i32 () const
float getViewportAspectRatio () const
void scaleWidth (float ratio)
void scaleHeight (float ratio)
void setPixelsPerInch (float ppi)
float getPixelsPerInch () const
float getPixelsPerPoint () const
SbVec2f normalize (const SbVec2s &position) const

Friends

int operator== (const SbViewportRegion &reg1, const SbViewportRegion &reg2)

Detailed Description

Class for representing a viewport.

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


Constructor & Destructor Documentation

SbViewportRegion::SbViewportRegion (  ) 

Default constructor.

Sets window size to default 100 x 100 pixels.

SbViewportRegion::SbViewportRegion ( short  width,
short  height,
float  newScale = 1.0 
)

Constructor that takes a width and a height in pixels.

SbViewportRegion::SbViewportRegion ( SbVec2s  winSize,
float  newScale = 1.0 
)

Constructor that takes a window size in pixels.

SbViewportRegion::SbViewportRegion ( SbVec2i32  winSize,
float  newScale = 1.0 
)

Constructor that takes a window size in pixels.

SbViewportRegion::SbViewportRegion ( const SbViewportRegion vpReg  ) 

Constructor that takes a viewport region.


Member Function Documentation

float SbViewportRegion::getPixelsPerInch (  )  const [inline]

Returns the pixel-per-inch ratio for the display device the viewport is part of.

float SbViewportRegion::getPixelsPerPoint (  )  const [inline]

Convenience function that returns number of pixels per printer's point.

float SbViewportRegion::getViewportAspectRatio (  )  const

Returns aspect ratio (width/height) of viewport.

const SbVec2f& SbViewportRegion::getViewportOrigin (  )  const [inline]

Returns viewport origin in normalized coordinates.

const SbVec2s& SbViewportRegion::getViewportOriginPixels (  )  const

Returns viewport origin in pixels.

const SbVec2i32& SbViewportRegion::getViewportOriginPixels_i32 (  )  const

Returns viewport origin in pixels.

const SbVec2f& SbViewportRegion::getViewportSize (  )  const [inline]

Returns viewport size in normalized coordinates.

const SbVec2s& SbViewportRegion::getViewportSizePixels (  )  const

Returns viewport size in pixels.

const SbVec2i32& SbViewportRegion::getViewportSizePixels_i32 (  )  const

Returns viewport size in pixels.

const SbVec2s& SbViewportRegion::getWindowSize (  )  const

Returns window size in pixels.

const SbVec2i32& SbViewportRegion::getWindowSize_i32 (  )  const

Returns window size in pixels.

SbVec2f SbViewportRegion::normalize ( const SbVec2s position  )  const

Compute the normalized coordinates of the specified position, relative to this viewport region.

Parameters:
position in pixel coordinates
Returns:
position in normalized coordinates (0 <= x,y <= 1)
void SbViewportRegion::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 SbViewportRegion::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 SbViewportRegion::setPixelsPerInch ( float  ppi  )  [inline]

Sets the pixel-per-inch ratio for the display device the viewport is part of.

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

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

Sets viewport to region with given origin (lower-left corner) and size, given as normalized coordinate vectors.

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

Sets viewport to given region, specified as normalized window coordinates: (0,0) is the lower-left corner, (1,1) is the upper-right.

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

Sets viewport to region with given origin (lower-left corner) and size, given as pixel coordinates.

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

Sets viewport to region with given origin (lower-left corner) and size, given as pixel coordinates.

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

Sets viewport to given region, specified as pixel coordinates in window: (0,0) is the lower-left corner.

void SbViewportRegion::setWindowSize ( SbVec2i32  winSize  ) 

Changes window size to given width and height in pixels, given as SbVec2i32.

void SbViewportRegion::setWindowSize ( SbVec2s  winSize  ) 

Changes window size to given width and height in pixels, given as SbVec2s.

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

Changes window size to given width and height in pixels.


Friends And Related Function Documentation

int operator== ( const SbViewportRegion reg1,
const SbViewportRegion reg2 
) [friend]

Equality comparison operator.


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

Open Inventor by FEI reference manual, generated on 19 Dec 2017
Copyright © FEI S.A.S. All rights reserved.
http://www.openinventor.com/