00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef COIN_SBVIEWPORTREGION_H
00021 #define COIN_SBVIEWPORTREGION_H
00022 
00023 #include <stdio.h>
00024 #include <Inventor/SbVec2s.h>
00025 #include <Inventor/SbVec2f.h>
00026 
00027 class COIN_DLL_API SbViewportRegion {
00028 public:
00029   SbViewportRegion(void);
00030   SbViewportRegion(short width, short height);
00031   SbViewportRegion(SbVec2s winSize);
00032   SbViewportRegion(const SbViewportRegion & vpReg);
00033 
00034   void setWindowSize(short width, short height);
00035   void setWindowSize(SbVec2s winSize);
00036   void setViewport(float left, float bottom,
00037                    float width, float height);
00038   void setViewport(SbVec2f origin, SbVec2f size);
00039   void setViewportPixels(short left, short bottom,
00040                          short width, short height);
00041   void setViewportPixels(SbVec2s origin, SbVec2s size);
00042   const SbVec2s & getWindowSize(void) const;
00043   const SbVec2f & getViewportOrigin(void) const;
00044   const SbVec2s & getViewportOriginPixels(void) const;
00045   const SbVec2f & getViewportSize(void) const;
00046   const SbVec2s & getViewportSizePixels(void) const;
00047   float getViewportAspectRatio(void) const;
00048   void scaleWidth(float ratio);
00049   void scaleHeight(float ratio);
00050   void setPixelsPerInch(float ppi);
00051   float getPixelsPerInch(void) const;
00052   float getPixelsPerPoint(void) const;
00053   friend COIN_DLL_API int operator ==(const SbViewportRegion & reg1,
00054                          const SbViewportRegion & reg2);
00055 
00056   void print(FILE * file) const;
00057 
00058 private:
00059   SbVec2s winsize;
00060   SbVec2f vporigin;
00061   SbVec2f vpsize;
00062   SbVec2s vporigin_s;
00063   SbVec2s vpsize_s;
00064   float pixperinch;
00065 };
00066 
00067 COIN_DLL_API int operator ==(const SbViewportRegion & reg1, const SbViewportRegion & reg2);
00068 
00069 #endif // !COIN_SBVIEWPORTREGION_H