| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2002 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 // $Id: animatedgifmaker.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00019 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00020 // $Revision: 6014 $ 00021 // $State$ 00022 // $Author: Konstantin_Baumann $ 00023 // 00024 // $Log$ 00025 // Revision 1.9 2005/01/03 01:43:08 klimetschek 00026 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00027 // - removed vrs.vcproj 00028 // minor things: 00029 // - added all glutexamples to vrs4glut.sln 00030 // - fixed some problems in glutexamples 00031 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00032 // 00033 // Revision 1.8 2004/11/03 11:20:07 saar 00034 // Class comment changed (Doxygen style) 00035 // 00036 // Revision 1.7 2004/03/12 16:28:40 baumann 00037 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00038 // 00039 // Revision 1.6 2003/11/07 14:19:24 kirsch 00040 // removed leading underscore from include guards 00041 // 00042 // Revision 1.5 2003/06/23 09:47:42 baumann 00043 // - new compile time switch VRS_HAS_WSTRING added 00044 // - renamed macros VRS_HAVE_* to VRS_HAS_* 00045 // - removed "typedef std::string String;" 00046 // - Font uses ImageTexture2D instead of ImageTexture2DGL 00047 // 00048 // Revision 1.4 2003/02/24 10:05:57 baumann 00049 // changed return type of BehaviorNode::handle() and Manipulator::drag*() 00050 // from "int" to "BehaviorNode::InvalidationHint" 00051 // 00052 // Revision 1.3 2002/11/13 22:12:02 lorenz 00053 // changed base class to LeafBehavior, can set TimeRequirement now 00054 // 00055 // Revision 1.2 2002/11/04 08:53:41 lorenz 00056 // changed framerate from int to float 00057 // 00058 // Revision 1.1 2002/11/03 22:12:09 lorenz 00059 // easy possibility to create animated gif 00060 // 00061 00062 #ifndef VRS_ANIMATEDGIFMAKER_H_ 00063 #define VRS_ANIMATEDGIFMAKER_H_ 00064 00065 #include <vrs/sg/leafbehavior.h> 00066 #include <vrs/opengl/glcanvas.h> 00067 #include <vrs/image/image.h> 00068 #include <vrs/image/paletteimage.h> 00069 00070 namespace VRS { 00071 00072 class AnimatedGifEncoder; 00073 00075 class VRS_CORE_API AnimatedGifMaker : public LeafBehavior { 00076 public: 00077 AnimatedGifMaker(GLCanvas* masterCanvas); 00078 AnimatedGifMaker(GLCanvas* masterCanvas, const std::string& filename, float frameRate = 5); 00079 virtual ~AnimatedGifMaker(); 00089 virtual BehaviorNode::InvalidationHint handle(Event* event); 00091 00092 void open(const std::string& filename, float frameRate = 5); 00094 00101 void close(); 00103 00107 bool isOpen() const; 00109 00110 // record options 00111 void setConstantPalette(ColorPalette* tab = 0); 00113 00119 void setConstantPalette(int numColors); 00121 00133 void useDynamicPalette(int numColors = 256); 00135 00139 void useConstantPalette(); 00141 00145 void setSize(int width, int height); 00147 00154 void setRepeatCount(int repeat = 0); 00156 00160 // properties 00161 GLCanvas* canvas() const; 00162 const std::string& filename() const; 00163 float frameRate() const; 00164 int currentFrameNo() const; 00165 00166 VRS_TYPEINFO(AnimatedGifMaker, BehaviorNode); 00167 00168 private: 00169 std::string filename_; 00170 float frameRate_; 00171 int frameNo_; 00172 bool open_; 00173 00174 SO<ColorPalette> constantPal_; 00175 int constantPalSize_; 00176 int dynamicPalSize_; 00177 int width_; 00178 int height_; 00179 00180 double lastRecording_; 00181 double delta_; 00182 SO<GLCanvas> canvas_; 00183 SO<Image> tmpImage_; 00184 SO<Image> tmpImage1_; 00185 00186 AnimatedGifEncoder* enc_; 00187 00188 }; 00189 00190 inline const std::string& AnimatedGifMaker::filename() const { return filename_; } 00191 inline int AnimatedGifMaker::currentFrameNo() const { return frameNo_; } 00192 inline float AnimatedGifMaker::frameRate() const { return frameRate_; } 00193 inline GLCanvas* AnimatedGifMaker::canvas() const { return canvas_; } 00194 00195 } // namespace VRS 00196 00197 #endif // VRS_ANIMATEDGIFMAKER_H_