00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00029 #if ! defined( TEXTMASTER_HH )
00030 #define TEXTMASTER_HH
00031 
00032 
00033 
00034 #include "libpiave/operatorbase.hh"
00035 
00036 
00037 #include <ft2build.h>
00038 #include FT_FREETYPE_H
00039 #include FT_GLYPH_H
00040 
00041 namespace PIAVE 
00042 {
00043 
00044     
00045 
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:  
00078 
00080 
00082 
00083         
00084         HorizAlign       _horizAlign;
00085         VertAlign        _vertAlign;
00086         OpParDouble      _size;
00088         Point _shadow_offset;
00089         OpParBox         _position;
00090         OpParColor       _color;
00091 
00092 
00093         
00094 
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