xingzilong
2017-08-18 9e5babf9db52e64bdae60137be7696e56241fca6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef _PL_PAINT_H_
#define _PL_PAINT_H_
 
#include "PipeLine.h"
#include "GraphicHelper.h"
 
#define ENABLE_WTEXT
 
/*
PLPaint Language:
COLOR F/B,R,G,B,A
FILL 0/1
PEN TYPE,WIDTH
RECT LTX,LTY,RBX,RBY
TEXT LTX,LTY,"STRING"
*/
 
enum PLPLCmd
{
    PLPLC__FIRST,
    
    PLPLC_COLOR,
    PLPLC_FILL,
    PLPLC_PEN,
    PLPLC_RECT,
    PLPLC_TEXT,
    PLPLC_WTEXT,
 
    PLPLC__LAST
};
 
union PLPLType
{
    int val_i;
    float val_f;
    char val_s[20];
 
    PLPLType() : val_i(0) {}
    PLPLType(int _val_i) : val_i(_val_i) {}
    PLPLType(float _val_f) : val_f(_val_f) {}
    PLPLType(const char* _val_s);
    PLPLType(const wchar_t* _val_s);
};
 
typedef std::vector<PLPLCmd> plplc_vec_t;
typedef std::vector<PLPLType> plplt_vec_t;
 
struct PLPLContext
{
    plplc_vec_t cmds;
    plplt_vec_t params;
 
    PLGH_Color_RGBA color_front;
    PLGH_Color_RGBA color_back;
    int fill;
    PLGH_Pen pen;
    void* cvxText;
 
    PLPLContext() :
        cmds(), params(), color_front(), color_back(), fill(0), pen(0, 0), cvxText(nullptr)
    {}
 
    ~PLPLContext();
 
    void clear();
};
 
struct PL_Paint_Config
{
    bool copyData;
    PLPLContext* plplCtx;
    std::string fontPath;
    
    PL_Paint_Config() : 
        copyData(false), plplCtx(nullptr), fontPath()
    { }
};
 
class PL_Paint : public PipeLineElem
{
public:
    PL_Paint();
    virtual ~PL_Paint();
 
    virtual bool init(void* args);
    virtual void finit();
 
    virtual bool pay(const PipeMaterial& pm);
    virtual bool gain(PipeMaterial& pm);
    
private:
    static bool pay_breaker_MBFT(const PipeMaterial* pm, void* args);
 
private:
    void* internal;
};
 
PipeLineElem* create_PL_Paint();
 
#endif