App
PointerArea.hpp
Go to the documentation of this file.
1 
6 // forward declaration
7 namespace app {
8  class PointerArea;
9 }
10 
11 
12 #ifndef POINTERAREA_HPP_
13 #define POINTERAREA_HPP_
14 
15 #include "Geometry.hpp"
16 #include "../typedefs.hpp"
17 #include <cstdarg>
18 #include <cstring>
19 
20 namespace app {
21 
32 class PointerArea {
36 public:
37  const unsigned int bpp;
38 
40 
50  PointerArea(void * pStart, Rect origDim, unsigned int bpp) : bpp(bpp) { this->pStart = (byte *) pStart; this->origDim = origDim; this->areaDim = origDim; /*this->bpp = bpp;*/ }
51 
53 
67  PointerArea(void * pStart, Rect origDim, Rect areaDim, unsigned int bpp);
68 
70 
74  PointerArea(const PointerArea &other) : bpp(other.bpp) { pStart = other.pStart; origDim = other.origDim; areaDim = other.areaDim; /*this->bpp = bpp;*/ }
75 
77  Rect getOrig() const {return origDim;}
78 
80  Rect getArea() const {return areaDim;}
81 
83  unsigned int getAreaWidth() const { return areaDim.getWidth(); }
84 
86  unsigned int getOrigWidth() const { return origDim.getWidth(); }
87 
89  unsigned int getAreaHeight() const { return areaDim.getHeight(); }
90 
92  unsigned int getOrigHeight() const { return origDim.getHeight(); }
93 
95  unsigned int getAreaByteWidth() const {return areaDim.getWidth() * bpp;}
96 
98  unsigned int getOrigByteWidth() const {return origDim.getWidth() * bpp;}
99 
101  unsigned int getOrigSize() const {return origDim.getWidth() * origDim.getHeight() * bpp;}
102 
104  unsigned int getAreaSize() const {return areaDim.getWidth() * areaDim.getHeight() * bpp;}
105 
107 
113  unsigned int getByteOffset() const {return getOrigByteWidth() - getAreaByteWidth();}
114 
116 
122  unsigned int getOffset() const { return getOrigWidth() - getAreaWidth(); }
123 
125  void * getOrigBgn() const {return pStart;}
126 
128  void * getAreaBgn() const {return pStart + areaDim.tl.y * getOrigByteWidth() + areaDim.tl.x * bpp;}
129 
131  void * getAreaRowEnd() const { return pStart + areaDim.tl.y * getOrigByteWidth() + areaDim.br.x * bpp;} // NETESTOVANO V DEMU
132 
134  void * getOrigEnd() const {return pStart + origDim.br.y * getOrigByteWidth();}
135 
137  void * getOrigRowEnd() const { return pStart + getOrigByteWidth();} // NETESTOVANO V DEMU
138 
140  void * getAreaEnd() const {return pStart + (areaDim.br.y - 1) * getOrigByteWidth() + (areaDim.br.x - 1) * bpp;}
141 
143 
151  static int makeCommon(PointerArea &dst, PointerArea &src, Point srcOrig);
152 
154 
164  static int makeCommon(PointerArea &dst, PointerArea &src1, Point src1Orig, PointerArea &src2, Point src2Orig);
165 
167 
174  static int copy(PointerArea dst, PointerArea src, Point srcOrig);
175 
177 
183  static int fill(PointerArea dst, void * src);
184 };
185 
186 }
187 
188 #endif /* POINTERAREA_HPP_ */