| 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: textrenderergl.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.2 2006/03/17 16:36:04 buchholz 00026 // missing public keyword added 00027 // 00028 // Revision 1.1 2005/11/10 15:38:03 baumann 00029 // added new class TextRendererGL 00030 // 00031 00032 #ifndef VRS_OPENGL_TEXTRENDERERGL_H 00033 #define VRS_OPENGL_TEXTRENDERERGL_H 00034 00035 #include <vrs/text/vrs_textprerequisites.h> 00036 #include <vrs/sharedobj.h> 00037 00038 namespace VRS { 00039 class PBufferCanvasGL; 00040 class SceneThing; 00041 class Image; 00042 00044 class VRS_CORE_API TextRendererGL : 00045 public SharedObj 00046 { 00047 public: 00048 VRS_TYPEINFO(TextRendererGL, SharedObj); 00049 00050 TextRendererGL(const std::string& filename, int size); 00051 virtual ~TextRendererGL(); 00057 void setFont(const std::string& filename, int size); 00058 /*<! Allows changings the font settings. See consturctor for details */ 00059 00060 00061 SO<Image> renderHaloedText( 00062 const std::string& text, 00063 int bordersize, 00064 const Color& foreground, 00065 const Color& background 00066 ); 00067 /*<! Renders a text in the given foreground color with a smooth out-fading 00068 border of the givven size an color */ 00069 00070 private: 00071 SO<SceneThing> scene; 00072 SO<PBufferCanvasGL> canvas; 00073 00074 int getStringWidth(const std::string& text); 00075 int getStringMaxNegBearing(const std::string& text); 00076 00077 SO<Image> renderText(const std::string& text, const Color& color, int bordersize = 0); 00078 void renderTextToImage(SO<Image> image, const std::string& text, const Color& color, int bordersize); 00079 00080 SO<Image> createAlphaBrush(int size); 00081 00082 private: 00083 class Impl; 00084 SO<Impl> m_impl; 00085 int fontsize; 00086 }; // class TextRenderer 00087 00088 } // namespace VRS 00089 00090 #endif // VRS_OPENGL_TEXTRENDERERGL_H