Adjusted Doxyfile to scan less files.
[fic.git] / modules / root.h
blob89b2433ec4a7c31ef42e478b66b941cf641420e9
1 #ifndef ROOT_HEADER_
2 #define ROOT_HEADER_
4 #include "../interfaces.h"
6 #include <QThread> // ::idealThreadCount
8 /** The root module implementation. Controls the number of encoding threads,
9 * the color-transforming module (IColorTransformer)
10 * the pixel-shape-transforming module (IShapeTransformer), quality 0-100%,
11 * the module for quality conversion (IQuality2SE) and the maximum domain count. */
12 class MRoot: public IRoot {
13 DECLARE_debugModule;
15 DECLARE_TypeInfo( MRoot, "Root"
16 , "Standard root module"
17 , {
18 label: "Maximal number of threads",
19 desc: "Note: the actual number of threads is bound by\n"
20 "(the number of parts)*(the number of color planes)",
21 type: settingInt(1,QThread::idealThreadCount(),16)
22 }, {
23 label: "Color transformer",
24 desc: "The module that will be used to transform colors",
25 type: settingModule<IColorTransformer>()
26 }, {
27 label: "Pixel-shape transformer",
28 desc: "The module that is responsible for shape-transformation\n"
29 "of the pixels and for further (de)compression",
30 type: settingModule<IShapeTransformer>()
31 }, {
32 label: "Encoding quality (%)",
33 desc: "Quality - how much accurate the mappings have to be",
34 type: settingInt(0,90,100)
35 }, {
36 label: "Quality converter",
37 desc: "For given quality and size computes maximum square error allowed",
38 type: settingModule<IQuality2SE>()
39 }, {
40 label: "Maximum domain count",
41 desc: "Maximum domain count for level 2 range blocks\n"
42 "(for this purpose are different rotations\n"
43 "of one domain counted as different domains)",
44 type: settingInt(0,15,24,IntLog2)
45 } )
47 private:
48 /** Indices for settings */
49 enum Settings { MaxThreads, ModuleColor, ModuleShape, Quality, ModuleQuality
50 , DomainCountLog2 };
51 // Settings-retrieval methods
52 int maxThreads() const
53 { return settingsInt(MaxThreads); }
54 IColorTransformer* moduleColor() const
55 { return debugCast<IColorTransformer*>(settings[ModuleColor].m); }
56 IShapeTransformer* moduleShape() const
57 { return debugCast<IShapeTransformer*>(settings[ModuleShape].m); }
58 float quality()
59 { return settingsInt(Quality)/100.0; }
60 IQuality2SE* moduleQuality() const
61 { return debugCast<IQuality2SE*>(settings[ModuleQuality].m); }
63 typedef IColorTransformer::PlaneSettings PlaneSettings;
64 typedef IColorTransformer::PlaneList PlaneList;
66 private:
67 // Module's data
68 Mode myMode;///< the mode of the tree, returned by ::getMode
69 int width /// zoomed width of the image
70 , height /// zoomed height of the image
71 , zoom; ///< the zoom used (dimensions multiplied by 2^\p zoom)
73 protected:
74 // Construction and destruction
75 MRoot(): myMode(Clear), width(0), height(0), zoom(-1) {}
77 public:
78 /** \name IRoot interface
79 * @{ */
80 Mode getMode() { return myMode; }
81 QImage toImage();
83 bool encode(const QImage &toEncode,const UpdateInfo &updateInfo);
84 void decodeAct(DecodeAct action,int count=1);
86 bool toStream(std::ostream &file);
87 bool fromStream(std::istream &file,int zoom);
88 /// @}
91 #endif // ROOT_HEADER_