App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

TFInterpolator.hpp
Go to the documentation of this file.
1 namespace app {
2 template<typename TPIXEL, typename TCHANNEL> class TFInterpolator;
3 }
4
5 #ifndef TFINTERPOLATOR_HPP_
6 #define TFINTERPOLATOR_HPP_
7
8 #include <cstdlib>
9 #include "../typedefs.hpp"
10 #include "../bitmaps/TBitmap.hpp"
11 #include "../filters/TGaussianBlur.hpp"
12
13 namespace app {
14
15 typedef enum {
16 INVALID_TYPE = 0,
17 NEAREST_NEIGHBOUR = 1,
18 LINEAR = 2,
19 CUBIC = 3
20 } InterpolatorNativeType;
21
22
23 template<typename TPIXEL, typename TCHANNEL>
24 class TFInterpolator {
25 protected:
26
27 virtual int resampleTo_4ch(TBitmap<TPIXEL, TCHANNEL> &dst) const = 0;
28 virtual int resampleTo_1ch(TBitmap<TPIXEL, TCHANNEL> &dst) const = 0;
29
30 virtual TFInterpolator<TPIXEL, TCHANNEL> * newInstance(const TBitmap<TPIXEL, TCHANNEL> &over) const = 0;
31
32 public:
33 static const unsigned chCount;
34 static const TCHANNEL maxVal;
35
36 TFInterpolator() {
37 }
38 virtual ~TFInterpolator();
39
40 // Neni dobre reseni, ale vyzaduje mene prepisovani a komplikaci nez pristup pres this-> v kazde odvozene tride, navic pristup pres pointer by mohl byt pomalejsi.
41 virtual TPIXEL * getSrcData() const = 0;
42 virtual unsigned getSrcWidth() const = 0;
43 virtual unsigned getSrcHeight() const = 0;
44
45 virtual int isInitOk() const = 0;
46
47 virtual int resampleTo(TBitmap<TPIXEL, TCHANNEL> &dst) const;
48 virtual int resampleTo_aliased(TBitmap<TPIXEL, TCHANNEL> &dst, double force = 1) const;
49
50 };
51
52 template<typename TPIXEL, typename TCHANNEL>
53 const unsigned TFInterpolator<TPIXEL, TCHANNEL>::chCount = sizeof(TPIXEL) / sizeof(TCHANNEL);
54
55 template<typename TPIXEL, typename TCHANNEL>
56 const TCHANNEL TFInterpolator<TPIXEL, TCHANNEL>::maxVal = ~0;
57
58 } /* namespace app */
59 #endif /* TFINTERPOLATOR_HPP_ */