Coin
4.0.3
Coin3D core library
|
The SbViewportRegion class is a viewport within a full window. More...
#include <Inventor/SbViewportRegion.h>
Public Member Functions | |
SbViewportRegion (const SbViewportRegion &vpReg) | |
SbViewportRegion (SbVec2s winSize) | |
SbViewportRegion (short width, short height) | |
SbViewportRegion (void) | |
float | getPixelsPerInch (void) const |
float | getPixelsPerPoint (void) const |
float | getViewportAspectRatio (void) const |
const SbVec2f & | getViewportOrigin (void) const |
const SbVec2s & | getViewportOriginPixels (void) const |
const SbVec2f & | getViewportSize (void) const |
const SbVec2s & | getViewportSizePixels (void) const |
const SbVec2s & | getWindowSize (void) const |
void | print (FILE *file) const |
void | scaleHeight (float ratio) |
void | scaleWidth (float ratio) |
void | setPixelsPerInch (float ppi) |
void | setViewport (float left, float bottom, float width, float height) |
void | setViewport (SbVec2f origin, SbVec2f size) |
void | setViewportPixels (SbVec2s origin, SbVec2s size) |
void | setViewportPixels (short left, short bottom, short width, short height) |
void | setWindowSize (SbVec2s winSize) |
void | setWindowSize (short width, short height) |
Related Symbols | |
(Note that these are not member symbols.) | |
int | operator!= (const SbViewportRegion ®1, const SbViewportRegion ®2) |
int | operator== (const SbViewportRegion ®1, const SbViewportRegion ®2) |
The SbViewportRegion class is a viewport within a full window.
The SbViewportRegion class contains information to represent a subview within a window. It stores information about the origin and size of the subview, as well as the size of the underlying "full" window.
Available methods include inquiries and manipulation in both normalized coordinates and pixel coordinates.
Below is a small example showing how the viewport of a viewer class can be modified, within a "proper" Coin and window system context. Hit 'D' or 'U' to move the viewport region 40 pixels down or up, respectively. Click 'Esc' and zoom with left + middle mouse buttons, to see how the region is defined, where no 3D geometry will be visible outside it. Click 'Esc' again to use 'U' and 'D'.
SbViewportRegion::SbViewportRegion | ( | void | ) |
The default SbViewportRegion constructor initializes the viewport to fully cover a [100, 100] size window with 72 pixels per inch resolution.
SbViewportRegion::SbViewportRegion | ( | short | width, |
short | height ) |
Construct and initialize an SbViewportRegion instance with the given pixel value window dimensions. The viewport within this window will be set to cover the window completely.
SbViewportRegion::SbViewportRegion | ( | SbVec2s | winsizearg | ) |
Construct and initialize an SbViewportRegion instance with the given pixel value window dimensions. The viewport within this window will be set to cover the window completely.
SbViewportRegion::SbViewportRegion | ( | const SbViewportRegion & | vpReg | ) |
Copy constructor.
float SbViewportRegion::getPixelsPerInch | ( | void | ) | const |
Get pixels per inch.
float SbViewportRegion::getPixelsPerPoint | ( | void | ) | const |
Get pixels per point. A point is defined as something you can put 72 of per inch...
float SbViewportRegion::getViewportAspectRatio | ( | void | ) | const |
Returns the aspect ratio of the viewport region. The aspect ratio is calculated as pixelwidth divided on pixelheight.
Return normalized viewport origin coordinates.
Return viewport origin coordinates in pixel values.
Returns the normalized viewport size.
Returns viewport size in pixel coordinates.
Returns window dimensions (which are in absolute (i.e. pixel) coordinates).
Dump the state of this object to the fp file stream. Only works in debug version of library, method does nothing in an optimized build.
void SbViewportRegion::scaleHeight | ( | float | ratio | ) |
Scale the height of the viewport region.
The scale factor should not make the viewport larger than the window. If this happens, the viewport will be clamped.
The scaling will be done around the viewport region center point, but if this causes the viewport origin to be moved below (0,0), the origin coordinates will be clamped.
void SbViewportRegion::scaleWidth | ( | float | ratio | ) |
Scale the width of the viewport region.
The scale factor should not make the viewport larger than the window. If this happens, the viewport will be clamped.
The scaling will be done around the viewport region center point, but if this causes the viewport origin to be moved below (0,0), the origin coordinates will be clamped.
void SbViewportRegion::setPixelsPerInch | ( | float | ppi | ) |
Set pixels per inch. Default value is 72.
void SbViewportRegion::setViewport | ( | float | left, |
float | bottom, | ||
float | width, | ||
float | height ) |
Set up the origin and size of the viewport region in normalized coordinates.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void SbViewportRegion::setViewportPixels | ( | short | left, |
short | bottom, | ||
short | width, | ||
short | height ) |
Set up the origin and size of the viewport region in pixel coordinates.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void SbViewportRegion::setWindowSize | ( | short | width, |
short | height ) |
Set the window size in pixels. The viewport rectangle dimensions will stay intact.
|
related |
Compares two SbViewportRegion instances for inequality.
|
related |
Compares two SbViewportRegion instances for equality.