MythTV master
DynamicLineArt.h
Go to the documentation of this file.
1/* DynamicLineArt.h
2
3 Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18 Or, point your browser to http://www.gnu.org/copyleft/gpl.html
19
20*/
21
22
23#if !defined(DYNAMICLINEART_H)
24#define DYNAMICLINEART_H
25
26#include "Visible.h"
27#include "BaseActions.h"
28
30class MHDLADisplay;
31
33{
34 public:
35 MHDynamicLineArt() = default;
36 ~MHDynamicLineArt() override;
37 const char *ClassName() override // MHLineArt
38 { return "DynamicLineArt"; }
39 void Initialise(MHParseNode *p, MHEngine *engine) override; // MHLineArt
40 void PrintMe(FILE *fd, int nTabs) const override; // MHLineArt
41 void Preparation(MHEngine *engine) override; // MHLineArt
42
43 // Display function.
44 void Display(MHEngine *d) override; // MHLineArt
45 // Get the opaque area. This is only opaque if the background is.
46 QRegion GetOpaqueArea() override; // MHVisible
47
48 // This action also has the effect of clearing the drawing.
49 void SetBoxSize(int nWidth, int nHeight, MHEngine *engine) override; // MHVisible
50
51 // Actions
52 void Clear() override; // MHRoot
53 // These actions set the properties for subsequent drawing but don't affect anything drawn so far.
54 void SetFillColour(const MHColour &colour, MHEngine *engine) override; // MHLineArt
55 void SetLineColour(const MHColour &colour, MHEngine *engine) override; // MHLineArt
56 void SetLineWidth(int nWidth, MHEngine *engine) override; // MHLineArt
57 void SetLineStyle(int nStyle, MHEngine *engine) override; // MHLineArt
58
59 void GetLineWidth(MHRoot *pResult) override // MHRoot
60 { pResult->SetVariableValue(m_nLineWidth); }
61 void GetLineStyle(MHRoot *pResult) override // MHRoot
62 { pResult->SetVariableValue(m_lineStyle); }
63 void GetLineColour(MHRoot *pResult) override; // MHRoot
64 void GetFillColour(MHRoot *pResult) override; // MHRoot
65 void DrawArcSector(bool fIsSector, int x, int y, int width, int height, int start, int arc, MHEngine *engine) override; // MHRoot
66 void DrawLine(int x1, int y1, int x2, int y2, MHEngine *engine) override; // MHRoot
67 void DrawOval(int x1, int y1, int width, int height, MHEngine *engine) override; // MHRoot
68 void DrawRectangle(int x1, int y1, int x2, int y2, MHEngine *engine) override; // MHRoot
69 void DrawPoly(bool fIsPolygon, const MHPointVec& xArray, const MHPointVec& yArray, MHEngine *engine) override; // MHRoot
70
71 protected:
72 MHDLADisplay *m_picture {nullptr}; // The sequence of drawing actions.
73};
74
75// Actions
76// Get Line Width - return the current line width.
78{
79 public:
80 MHGetLineWidth(): MHActionObjectRef(":GetLineWidth") {}
81 void CallAction(MHEngine */*engine*/, MHRoot *pTarget, MHRoot *pResult) override // MHActionObjectRef
82 { pTarget->GetLineWidth(pResult); }
83};
84
85// Get Line Style - return the current line style.
87{
88 public:
89 MHGetLineStyle(): MHActionObjectRef(":GetLineStyle") {}
90 void CallAction(MHEngine */*engine*/, MHRoot *pTarget, MHRoot *pResult) override // MHActionObjectRef
91 { pTarget->GetLineStyle(pResult); }
92};
93// Get Line Colour - return the current line colour.
95{
96 public:
97 MHGetLineColour(): MHActionObjectRef(":GetLineColour") {}
98 void CallAction(MHEngine */*engine*/, MHRoot *pTarget, MHRoot *pResult) override // MHActionObjectRef
99 { pTarget->GetLineColour(pResult); }
100};
101// Get Fill Colour - return the current fill colour.
103{
104 public:
105 MHGetFillColour(): MHActionObjectRef(":GetFillColour") {}
106 void CallAction(MHEngine */*engine*/, MHRoot *pTarget, MHRoot *pResult) override // MHActionObjectRef
107 { pTarget->GetLineWidth(pResult); }
108};
109// Clear - reset the drawing
110class MHClear: public MHElemAction {
111 public:
112 MHClear(): MHElemAction(":Clear") {}
113 void Perform(MHEngine *engine) override // MHElemAction
114 { Target(engine)->Clear(); }
115};
116// Draw an arc or a sector (basically a filled arc).
118 public:
119 MHDrawArcSector(const char *name, bool fIsSector): MHActionInt6(name), m_fIsSector(fIsSector) {}
120 void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4, int nArg5, int nArg6) override // MHActionInt6
121 { pTarget->DrawArcSector(m_fIsSector, nArg1, nArg2, nArg3, nArg4, nArg5, nArg6, engine); }
122 protected:
124};
125// Draw a line.
127 public:
128 MHDrawLine(): MHActionInt4(":DrawLine") {}
129 void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4) override // MHActionInt4
130 { pTarget->DrawLine(nArg1, nArg2, nArg3, nArg4, engine); }
131};
132// Draw an oval.
134 public:
135 MHDrawOval(): MHActionInt4(":DrawOval") {}
136 void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4) override // MHActionInt4
137 { pTarget->DrawOval(nArg1, nArg2, nArg3, nArg4, engine); }
138};
139// Draw a rectangle.
141 public:
142 MHDrawRectangle(): MHActionInt4(":DrawRectangle") {}
143 void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4) override // MHActionInt4
144 { pTarget->DrawRectangle(nArg1, nArg2, nArg3, nArg4, engine); }
145};
146// Polygon and PolyLine
148 public:
149 MHDrawPoly(const char *name, bool fIsPolygon): MHElemAction(name), m_fIsPolygon(fIsPolygon) {}
150 void Initialise(MHParseNode *p, MHEngine *engine) override; // MHElemAction
151 void Perform(MHEngine *engine) override; // MHElemAction
152 protected:
153 void PrintArgs(FILE *fd, int nTabs) const override; // MHElemAction
156};
157
158#endif
std::vector< int > MHPointVec
Definition: BaseClasses.h:31
void Perform(MHEngine *engine) override
MHDrawArcSector(const char *name, bool fIsSector)
void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4, int nArg5, int nArg6) override
void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4) override
void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4) override
MHOwnPtrSequence< MHPointArg > m_points
void Perform(MHEngine *engine) override
MHDrawPoly(const char *name, bool fIsPolygon)
void PrintArgs(FILE *fd, int nTabs) const override
void Initialise(MHParseNode *p, MHEngine *engine) override
void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2, int nArg3, int nArg4) override
void GetLineStyle(MHRoot *pResult) override
void PrintMe(FILE *fd, int nTabs) const override
const char * ClassName() override
MHDLADisplay * m_picture
void SetLineWidth(int nWidth, MHEngine *engine) override
void DrawLine(int x1, int y1, int x2, int y2, MHEngine *engine) override
void Preparation(MHEngine *engine) override
void DrawPoly(bool fIsPolygon, const MHPointVec &xArray, const MHPointVec &yArray, MHEngine *engine) override
void SetBoxSize(int nWidth, int nHeight, MHEngine *engine) override
~MHDynamicLineArt() override
void Display(MHEngine *d) override
void GetFillColour(MHRoot *pResult) override
void SetLineColour(const MHColour &colour, MHEngine *engine) override
void GetLineColour(MHRoot *pResult) override
void GetLineWidth(MHRoot *pResult) override
void Clear() override
void DrawArcSector(bool fIsSector, int x, int y, int width, int height, int start, int arc, MHEngine *engine) override
void DrawOval(int x1, int y1, int width, int height, MHEngine *engine) override
void SetFillColour(const MHColour &colour, MHEngine *engine) override
void DrawRectangle(int x1, int y1, int x2, int y2, MHEngine *engine) override
void Initialise(MHParseNode *p, MHEngine *engine) override
MHDynamicLineArt()=default
void SetLineStyle(int nStyle, MHEngine *engine) override
QRegion GetOpaqueArea() override
MHRoot * Target(MHEngine *engine)
Definition: BaseActions.cpp:46
void CallAction(MHEngine *, MHRoot *pTarget, MHRoot *pResult) override
void CallAction(MHEngine *, MHRoot *pTarget, MHRoot *pResult) override
void CallAction(MHEngine *, MHRoot *pTarget, MHRoot *pResult) override
void CallAction(MHEngine *, MHRoot *pTarget, MHRoot *pResult) override
int m_lineStyle
Definition: Visible.h:117
int m_nLineWidth
Definition: Visible.h:116
Definition: Root.h:45
virtual void Clear()
Definition: Root.h:193
static const iso6937table * d
static int x1
Definition: mythsocket.cpp:50
static int x2
Definition: mythsocket.cpp:51
int FILE
Definition: mythburn.py:138