Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

textmaster.hh

00001 /*
00002  * PIAVE - PIAVE Is A Video Editor
00003  *
00004  * Copyright (C) 2002 Rolf Dubitzky, rolf@dubitzky.de
00005  */
00006 
00007 /*
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software Foundation,
00020  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00029 #if ! defined( TEXTMASTER_HH )
00030 #define TEXTMASTER_HH
00031 
00032 
00033 //PIAVE 
00034 #include "libpiave/operatorbase.hh"
00035 
00036 // freetype2
00037 #include <ft2build.h>
00038 #include FT_FREETYPE_H
00039 #include FT_GLYPH_H
00040 
00041 namespace PIAVE 
00042 {
00043 
00044     /*
00045      *  \class FreeType is a simple wrapper around freetype
00046      */
00047     struct FreeType 
00048     {
00049         static void init();
00050         static bool is_initialized;
00051         static FT_Library  library;
00052     };
00053 
00054     class TextMaster  : public UnaryOp
00055     {
00056       public:
00057         enum HorizAlign { left, hcenter, right };
00058         enum VertAlign { top, vcenter, bottom };
00059 
00060       public:
00061         TextMaster();
00062      
00063         virtual void renderFrame( Frame & f, Time t );
00064 
00065         virtual PropertyNode * getProperties( PropertyNode * p=0 ) const;
00066 
00067       int fixMe( int fix_lvl );
00068 
00069       private:
00071         void initGlyphs();
00073         void renderGlyphBitmapToFrame( Frame & f, const FT_Bitmap&, 
00074                                        const FT_Vector& pos, const Color color );
00075 
00076       public:  // private: \todo cleanup
00078         bool             _glyphs_initialized;
00080         OpParString      _text;
00082         OpParString      _fontName;
00083         // alignement
00084         HorizAlign       _horizAlign;
00085         VertAlign        _vertAlign;
00086         OpParDouble      _size;
00088         Point _shadow_offset;
00089         OpParBox         _position;
00090         OpParColor       _color;
00091 
00092 
00093         /*
00094          *   FreeType font render caches
00095          */
00096 
00098         std::vector< FT_Glyph >   _glyphs;
00100         std::vector< FT_Vector >  _glyphPos;
00101         // 
00102         FT_Face       _face; 
00103    
00104     };
00105 
00106 
00107     class TextMasterPlugin : public Plugin
00108     {
00109       public:
00110         TextMasterPlugin();
00111         virtual PluginBase * newElement( const PropertyNode *p = 0 );
00112     };
00113 
00114 };
00115 
00116 #endif

Generated on Tue Oct 14 20:45:37 2003 for piave by doxygen1.2.18