MythTV  master
Bitmap.h
Go to the documentation of this file.
1 /* Bitmap.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(BITMAP_H)
24 #define BITMAP_H
25 
26 #include "Visible.h"
27 #include "BaseActions.h"
28 // Dependencies
29 #include "Presentable.h"
30 #include "Ingredients.h"
31 #include "Root.h"
32 #include "BaseClasses.h"
33 
34 class MHBitmapDisplay;
35 
36 class MHBitmap : public MHVisible
37 {
38  public:
39  MHBitmap() = default;
40  MHBitmap(const MHBitmap &ref)
41  : MHVisible(ref), m_fTiling(ref.m_fTiling),
43  const char *ClassName() override // MHRoot
44  { return "Bitmap"; }
45  ~MHBitmap() override;
46  void Initialise(MHParseNode *p, MHEngine *engine) override; // MHVisible
47  void PrintMe(FILE *fd, int nTabs) const override; // MHVisible
48 
49  void Preparation(MHEngine *engine) override; // MHVisible
50  void ContentPreparation(MHEngine *engine) override; // MHIngredient
51  void ContentArrived(const unsigned char *data, int length, MHEngine *engine) override; // MHIngredient
52 
53  // Actions.
54  void SetTransparency(int nTransPerCent, MHEngine *engine) override; // MHRoot
55  void ScaleBitmap(int xScale, int yScale, MHEngine *engine) override; // MHRoot
56  void SetBitmapDecodeOffset(int newXOffset, int newYOffset, MHEngine *engine) override; // MHRoot
57  void GetBitmapDecodeOffset(MHRoot *pXOffset, MHRoot *pYOffset) override; // MHRoot
58  MHIngredient *Clone(MHEngine */*engine*/) override // MHRoot
59  { return new MHBitmap(*this); } // Create a clone of this ingredient.
60 
61  // Display function.
62  void Display(MHEngine *d) override; // MHVisible
63  QRegion GetVisibleArea() override; // MHVisible
64  QRegion GetOpaqueArea() override; // MHVisible
65 
66  protected:
67  bool m_fTiling {false};
69 
70  // Internal attributes
71  int m_nTransparency {0};
72  // Added in UK MHEG
75 
76  MHBitmapDisplay *m_pContent {nullptr}; // Pointer to current image if any.
77 
78  void CreateContent(const unsigned char *data, int length, MHEngine *engine);
79 };
80 
81 // Actions.
83  public:
84  MHSetTransparency(): MHActionInt(":SetTransparency") {}
85  void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg) override // MHActionInt
86  { pTarget->SetTransparency(nArg, engine); }
87 };
88 
90  public:
91  MHScaleBitmap(): MHActionIntInt(":ScaleBitmap") {}
92  void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2) override // MHActionIntInt
93  { pTarget->ScaleBitmap(nArg1, nArg2, engine); }
94 };
95 
96 // Actions added in the UK MHEG profile.
98 {
99  public:
100  MHSetBitmapDecodeOffset(): MHActionIntInt(":SetBitmapDecodeOffset") {}
101  void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2) override // MHActionIntInt
102  { pTarget->SetBitmapDecodeOffset(nArg1, nArg2, engine); }
103 };
104 
106 {
107  public:
108  MHGetBitmapDecodeOffset(): MHActionObjectRef2(":GetBitmapDecodeOffset") {}
109  void CallAction(MHEngine */*engine*/, MHRoot *pTarget, MHRoot *pArg1, MHRoot *pArg2) override // MHActionObjectRef2
110  { pTarget->GetBitmapDecodeOffset(pArg1, pArg2); }
111 };
112 
113 
114 #endif
MHSetTransparency::CallAction
void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg) override
Definition: Bitmap.h:85
Presentable.h
MHBitmap::ClassName
const char * ClassName() override
Definition: Bitmap.h:43
MHBitmap::Preparation
void Preparation(MHEngine *engine) override
Definition: Bitmap.cpp:90
MHEngine
Definition: Engine.h:72
MHBitmap::CreateContent
void CreateContent(const unsigned char *data, int length, MHEngine *engine)
Definition: Bitmap.cpp:128
MHGetBitmapDecodeOffset::CallAction
void CallAction(MHEngine *, MHRoot *pTarget, MHRoot *pArg1, MHRoot *pArg2) override
Definition: Bitmap.h:109
MHScaleBitmap
Definition: Bitmap.h:89
MHGetBitmapDecodeOffset
Definition: Bitmap.h:105
Visible.h
MHBitmap::ContentPreparation
void ContentPreparation(MHEngine *engine) override
Definition: Bitmap.cpp:102
MHBitmap::SetBitmapDecodeOffset
void SetBitmapDecodeOffset(int newXOffset, int newYOffset, MHEngine *engine) override
Definition: Bitmap.cpp:180
MHBitmap::m_nTransparency
int m_nTransparency
Definition: Bitmap.h:71
mythburn.FILE
int FILE
Definition: mythburn.py:139
MHScaleBitmap::MHScaleBitmap
MHScaleBitmap()
Definition: Bitmap.h:91
MHSetTransparency::MHSetTransparency
MHSetTransparency()
Definition: Bitmap.h:84
MHBitmap::ContentArrived
void ContentArrived(const unsigned char *data, int length, MHEngine *engine) override
Definition: Bitmap.cpp:116
hardwareprofile.config.p
p
Definition: config.py:33
MHSetBitmapDecodeOffset::CallAction
void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2) override
Definition: Bitmap.h:101
MHBitmap::Clone
MHIngredient * Clone(MHEngine *) override
Definition: Bitmap.h:58
MHBitmap::SetTransparency
void SetTransparency(int nTransPerCent, MHEngine *engine) override
Definition: Bitmap.cpp:161
MHSetTransparency
Definition: Bitmap.h:82
MHBitmapDisplay
Definition: freemheg.h:211
MHActionIntInt
Definition: BaseActions.h:65
MHSetBitmapDecodeOffset
Definition: Bitmap.h:97
MHBitmap::Initialise
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Bitmap.cpp:46
Ingredients.h
MHBitmap::ScaleBitmap
void ScaleBitmap(int xScale, int yScale, MHEngine *engine) override
Definition: Bitmap.cpp:171
MHActionInt
Definition: BaseActions.h:51
MHIngredient
Definition: Ingredients.h:33
MHActionObjectRef2
Definition: BaseActions.h:133
MHBitmap::GetOpaqueArea
QRegion GetOpaqueArea() override
Definition: Bitmap.cpp:226
MHBitmap
Definition: Bitmap.h:36
Root.h
MHGetBitmapDecodeOffset::MHGetBitmapDecodeOffset
MHGetBitmapDecodeOffset()
Definition: Bitmap.h:108
MHVisible
Definition: Visible.h:35
MHSetBitmapDecodeOffset::MHSetBitmapDecodeOffset
MHSetBitmapDecodeOffset()
Definition: Bitmap.h:100
MHBitmap::m_nYDecodeOffset
int m_nYDecodeOffset
Definition: Bitmap.h:74
MHScaleBitmap::CallAction
void CallAction(MHEngine *engine, MHRoot *pTarget, int nArg1, int nArg2) override
Definition: Bitmap.h:92
BaseClasses.h
MHBitmap::~MHBitmap
~MHBitmap() override
Definition: Bitmap.cpp:41
MHBitmap::m_nOrigTransparency
int m_nOrigTransparency
Definition: Bitmap.h:68
MHParseNode
Definition: ParseNode.h:38
MHBitmap::MHBitmap
MHBitmap(const MHBitmap &ref)
Definition: Bitmap.h:40
MHBitmap::MHBitmap
MHBitmap()=default
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
MHBitmap::Display
void Display(MHEngine *d) override
Definition: Bitmap.cpp:196
MHBitmap::PrintMe
void PrintMe(FILE *fd, int nTabs) const override
Definition: Bitmap.cpp:68
BaseActions.h
MHBitmap::GetBitmapDecodeOffset
void GetBitmapDecodeOffset(MHRoot *pXOffset, MHRoot *pYOffset) override
Definition: Bitmap.cpp:190
MHBitmap::GetVisibleArea
QRegion GetVisibleArea() override
Definition: Bitmap.cpp:209
MHBitmap::m_nXDecodeOffset
int m_nXDecodeOffset
Definition: Bitmap.h:73
MHBitmap::m_pContent
MHBitmapDisplay * m_pContent
Definition: Bitmap.h:76
MHBitmap::m_fTiling
bool m_fTiling
Definition: Bitmap.h:67
MHRoot
Definition: Root.h:44