Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

SoOffscreenRenderer.h

00001 #ifndef COIN_SOOFFSCREENRENDERER_H
00002 #define COIN_SOOFFSCREENRENDERER_H
00003 
00004 /**************************************************************************\
00005  *
00006  *  This file is part of the Coin 3D visualization library.
00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
00008  *
00009  *  This library is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public License
00011  *  ("GPL") version 2 as published by the Free Software Foundation.
00012  *  See the file LICENSE.GPL at the root directory of this source
00013  *  distribution for additional information about the GNU GPL.
00014  *
00015  *  For using Coin with software that can not be combined with the GNU
00016  *  GPL, and for taking advantage of the additional benefits of our
00017  *  support services, please contact Systems in Motion about acquiring
00018  *  a Coin Professional Edition License.
00019  *
00020  *  See <URL:http://www.coin3d.org> for  more information.
00021  *
00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
00023  *  <URL:http://www.sim.no>.
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/SbViewportRegion.h>
00028 #include <Inventor/SbColor.h>
00029 #include <Inventor/lists/SbList.h>
00030 #include <Inventor/SbString.h>
00031 #include <Inventor/SbName.h>
00032 
00033 #include <stdio.h>
00034 
00035 class SoBase;
00036 class SoGLRenderAction;
00037 class SoNode;
00038 class SoPath;
00039 
00040 // This shouldn't strictly be necessary, but the OSF1/cxx compiler
00041 // complains if this is left out, while using the "friend class
00042 // SoExtSelectionP" statement in the class definition.
00043 class SoOffscreenRendererP;
00044 
00045 
00046 class COIN_DLL_API SoOffscreenRenderer {
00047 public:
00048   enum Components {
00049     LUMINANCE = 1,
00050     LUMINANCE_TRANSPARENCY = 2,
00051     RGB = 3,
00052     RGB_TRANSPARENCY = 4
00053   };
00054 
00055   SoOffscreenRenderer(const SbViewportRegion & viewportregion);
00056   SoOffscreenRenderer(SoGLRenderAction * action);
00057   ~SoOffscreenRenderer();
00058 
00059   static float getScreenPixelsPerInch(void);
00060   static SbVec2s getMaximumResolution(void);
00061   void setComponents(const Components components);
00062   Components getComponents(void) const;
00063   void setViewportRegion(const SbViewportRegion & region);
00064   const SbViewportRegion & getViewportRegion(void) const;
00065   void setBackgroundColor(const SbColor & color);
00066   const SbColor & getBackgroundColor(void) const;
00067   void setGLRenderAction(SoGLRenderAction * action);
00068   SoGLRenderAction * getGLRenderAction(void) const;
00069   SbBool render(SoNode * scene);
00070   SbBool render(SoPath * scene);
00071   unsigned char * getBuffer(void) const;
00072 
00073   SbBool writeToRGB(FILE * fp) const;
00074   SbBool writeToPostScript(FILE * fp) const;
00075   SbBool writeToPostScript(FILE * fp, const SbVec2f & printsize) const;
00076 
00077   SbBool writeToRGB(const char * filename) const;
00078   SbBool writeToPostScript(const char * filename) const;
00079   SbBool writeToPostScript(const char * filename, const SbVec2f & printsize) const;
00080   
00081   SbBool isWriteSupported(const SbName & filetypeextension) const;
00082   int getNumWriteFiletypes(void) const;
00083   void getWriteFiletypeInfo(const int idx,
00084                             SbList <SbName> & extlist,
00085                             SbString & fullname,
00086                             SbString & description);
00087   SbBool writeToFile(const SbString & filename, const SbName & filetypeextension) const; 
00088 
00089 private:
00090   friend class SoOffscreenRendererP;
00091   class SoOffscreenRendererP * pimpl;
00092 };
00093 
00094 #endif // !COIN_SOOFFSCREENRENDERER_H

Generated on Fri Oct 15 05:50:30 2004 for Coin by doxygen 1.3.6