Coin Logo http://www.sim.no
http://www.coin3d.org

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-2007 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 http://www.coin3d.org/ for more information.
00021  *
00022  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00023  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00024  *
00025 \**************************************************************************/
00026 
00027 #include <Inventor/SbViewportRegion.h>
00028 #include <Inventor/SbColor.h>
00029 #include <Inventor/lists/SbList.h>
00030 #include <Inventor/lists/SbPList.h>
00031 #include <Inventor/SbString.h>
00032 #include <Inventor/SbName.h>
00033 
00034 #include <stdio.h>
00035 
00036 class SoBase;
00037 class SoGLRenderAction;
00038 class SoNode;
00039 class SoPath;
00040 
00041 // This shouldn't strictly be necessary, but the OSF1/cxx compiler
00042 // complains if this is left out, while using the "friend class
00043 // SoExtSelectionP" statement in the class definition.
00044 class SoOffscreenRendererP;
00045 
00046 
00047 class COIN_DLL_API SoOffscreenRenderer {
00048 public:
00049   enum Components {
00050     LUMINANCE = 1,
00051     LUMINANCE_TRANSPARENCY = 2,
00052     RGB = 3,
00053     RGB_TRANSPARENCY = 4
00054   };
00055 
00056   SoOffscreenRenderer(const SbViewportRegion & viewportregion);
00057   SoOffscreenRenderer(SoGLRenderAction * action);
00058   ~SoOffscreenRenderer();
00059 
00060   static float getScreenPixelsPerInch(void);
00061   static SbVec2s getMaximumResolution(void);
00062   void setComponents(const Components components);
00063   Components getComponents(void) const;
00064   void setViewportRegion(const SbViewportRegion & region);
00065   const SbViewportRegion & getViewportRegion(void) const;
00066   void setBackgroundColor(const SbColor & color);
00067   const SbColor & getBackgroundColor(void) const;
00068   void setGLRenderAction(SoGLRenderAction * action);
00069   SoGLRenderAction * getGLRenderAction(void) const;
00070   SbBool render(SoNode * scene);
00071   SbBool render(SoPath * scene);
00072   unsigned char * getBuffer(void) const;
00073 
00074   SbBool writeToRGB(FILE * fp) const;
00075   SbBool writeToPostScript(FILE * fp) const;
00076   SbBool writeToPostScript(FILE * fp, const SbVec2f & printsize) const;
00077 
00078   SbBool writeToRGB(const char * filename) const;
00079   SbBool writeToPostScript(const char * filename) const;
00080   SbBool writeToPostScript(const char * filename, const SbVec2f & printsize) const;
00081   
00082   SbBool isWriteSupported(const SbName & filetypeextension) const;
00083   int getNumWriteFiletypes(void) const;
00084   void getWriteFiletypeInfo(const int idx,
00085                             SbPList & extlist,
00086                             SbString & fullname,
00087                             SbString & description);
00088   SbBool writeToFile(const SbString & filename, const SbName & filetypeextension) const; 
00089 
00090   // Please stop using this function. It will be removed in 
00091   // Coin 3.0. Use the SbPList version instead.
00092   void getWriteFiletypeInfo(const int idx,
00093                             SbList <SbName> & extlist,
00094                             SbString & fullname,
00095                             SbString & description);
00096 
00097 private:
00098   friend class SoOffscreenRendererP;
00099   class SoOffscreenRendererP * pimpl;
00100 };
00101 
00102 #endif // !COIN_SOOFFSCREENRENDERER_H

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Mon Feb 23 16:33:25 2009 for Coin by Doxygen. 1.5.8