svvitch
digital signage player
|
00001 #pragma once 00002 00003 #include "Content.h" 00004 00005 #include <gdiplus.h> 00006 00007 00012 class TextContent: public Content { 00013 private: 00014 Poco::FastMutex _lock; 00015 Poco::FastMutex _initializeLock; 00016 00017 LPDIRECT3DTEXTURE9 _texture; 00018 TextContent* _referencedText; 00019 string _text; 00020 string _textFont; 00021 string _textStyle; 00022 int _textHeight; 00023 int _desent; 00024 Gdiplus::Color _c1; 00025 Gdiplus::Color _c2; 00026 Gdiplus::Color _b1; 00027 Gdiplus::REAL _borderSize1; 00028 Gdiplus::Color _b2; 00029 Gdiplus::REAL _borderSize2; 00030 int _ax; 00031 int _tw; 00032 int _th; 00033 int _iw; 00034 int _ih; 00035 int _cx; 00036 int _cy; 00037 int _cw; 00038 int _ch; 00039 int _sx; 00040 int _sy; 00041 string _move; 00042 bool _async; 00043 float _dx; 00044 float _dy; 00045 int _frameWait; 00046 string _align; 00047 bool _fitBounds; 00048 Gdiplus::FontFamily _ff[16]; 00049 00050 void initialize(); 00051 00052 void drawText(string text, Gdiplus::Bitmap& bitmap, Gdiplus::Rect& rect); 00053 00054 public: 00055 TextContent(Renderer& renderer, int splitType, float x = 0, float y = 0, float w = 0, float h = 0); 00056 00057 virtual ‾TextContent(); 00058 00059 bool open(const MediaItemPtr media, const int offset = 0); 00060 00061 void setReference(TextContent* text); 00062 00063 void play(); 00064 00065 void stop(); 00066 00067 const bool finished(); 00068 00070 void close(); 00071 00072 int getTextWidth(); 00073 00074 int getTextHeight(); 00075 00076 void setColor(DWORD c1, DWORD c2); 00077 00078 void setBorder1(int size, DWORD col); 00079 00080 void setBorder2(int size, DWORD col); 00081 00082 void setFont(string font); 00083 00084 void setFontHeight(int height, int desent = 0); 00085 00086 void setTextStyle(string style); 00087 00088 void setAlign(string align); 00089 00090 void setFitBounds(bool fit); 00091 00092 void drawTexture(string text); 00093 00094 00096 void process(const DWORD& frame); 00097 00099 void draw(const DWORD& frame); 00100 }; 00101 00102 typedef TextContent* TextContentPtr;