Bugfix: PGS YVU => YUV
[xy_vsfilter.git] / src / subtitles / xy_overlay_paint_machine.h
blobcd20201e004e9f730974b0b583b48de40bb19858
1 #ifndef __XY_OVERLAY_PAINT_MACHINE_47C522B7_4317_441C_A536_5F667DCB0141_H__
2 #define __XY_OVERLAY_PAINT_MACHINE_47C522B7_4317_441C_A536_5F667DCB0141_H__
4 #include <boost/shared_ptr.hpp>
5 class CWord;
6 typedef ::boost::shared_ptr<CWord> SharedPtrCWord;
8 struct Overlay;
9 typedef ::boost::shared_ptr<Overlay> SharedPtrOverlay;
11 class OverlayPaintMachine;
12 typedef ::boost::shared_ptr<OverlayPaintMachine> SharedPtrOverlayPaintMachine;
14 class OverlayKey;
15 typedef ::boost::shared_ptr<OverlayKey> SharedPtrOverlayKey;
17 class CWordPaintMachine
19 public:
20 enum LAYER
22 SHADOW = 0
23 , OUTLINE
24 , BODY
26 public:
27 static void CreatePaintMachines(const SharedPtrCWord& word
28 , const CPointCoor2& shadow_pos, const CPointCoor2& outline_pos, const CPointCoor2& body_pos
29 , const CPointCoor2& org
30 , SharedPtrOverlayPaintMachine *shadow, SharedPtrOverlayPaintMachine *outline, SharedPtrOverlayPaintMachine *body);
32 static void PaintBody(const SharedPtrCWord& word, const CPointCoor2& p, const CPointCoor2& org, SharedPtrOverlay* overlay);
34 void Paint(LAYER layer, SharedPtrOverlay* overlay);
35 const SharedPtrOverlayKey& GetHashKey(LAYER layer);
36 private:
37 CWordPaintMachine(){}
39 void PaintBody(const SharedPtrCWord& word, const CPointCoor2& p, SharedPtrOverlay* overlay);
40 void PaintOutline(const SharedPtrCWord& word, const CPointCoor2& p, SharedPtrOverlay* overlay);
41 void PaintShadow(const SharedPtrCWord& word, const CPointCoor2& p, SharedPtrOverlay* overlay);
43 OverlayKey* CreateBodyOverlayHashKey(const SharedPtrCWord& word, const CPointCoor2& p);
44 OverlayKey* CreateOutlineOverlayHashKey(const SharedPtrCWord& word, const CPointCoor2& p);
45 OverlayKey* CreateShadowOverlayHashKey(const SharedPtrCWord& word, const CPointCoor2& p);
47 SharedPtrCWord m_word;
48 CPointCoor2 m_shadow_pos, m_outline_pos, m_body_pos;
49 CPointCoor2 m_trans_org;
51 SharedPtrOverlayKey m_shadow_key, m_border_key, m_body_key;
54 typedef ::boost::shared_ptr<CWordPaintMachine> SharedCWordPaintMachine;
56 class OverlayPaintMachine
58 public:
59 OverlayPaintMachine(const SharedCWordPaintMachine& inner_paint_machine, CWordPaintMachine::LAYER layer)
60 : m_inner_paint_machine(inner_paint_machine)
61 , m_layer(layer) {}
63 void Paint(SharedPtrOverlay* overlay);
64 CRectCoor2 CalcDirtyRect();//return a 8x8 supersampled rect
65 const SharedPtrOverlayKey& GetHashKey();
66 private:
67 SharedCWordPaintMachine m_inner_paint_machine;
68 CWordPaintMachine::LAYER m_layer;
70 SharedPtrOverlay m_overlay;
74 #endif // __XY_OVERLAY_PAINT_MACHINE_47C522B7_4317_441C_A536_5F667DCB0141_H__