4 #include "../interfaces.h"
9 class MRoot
: public IRoot
{
12 DECLARE_TypeInfo( MRoot
, "Root"
13 , "Standard root module"
15 label
: "Maximal number of threads",
16 desc
: "Note: the actual number of threads is bound by\n"
17 "(the number of parts)*(the number of color planes)",
18 type
: settingInt(1,1,1) // abs(QThread::idealThreadCount())
20 label
: "Color transformer",
21 desc
: "The module that will be used to transform colors",
22 type
: settingModule
<IColorTransformer
>()
24 label
: "Pixel-shape transformer",
25 desc
: "The module that is responsible for shape-transformation\n"
26 "of the pixels and for further (de)compression",
27 type
: settingModule
<IShapeTransformer
>()
29 label
: "Encoding quality",
30 desc
: "Quality - how much accurate the mappings have to be",
31 type
: settingInt(0,90,100)
33 label
: "Quality converter",
34 desc
: "For given quality and size computes maximum square error allowed",
35 type
: settingModule
<IQuality2SquareError
>()
37 label
: "Maximum domain count",
38 desc
: "Maximum domain count for level 2 range blocks\n"
39 "(for this purpose are different rotations\n"
40 "of one domain counted as different domains)",
41 type
: settingInt(0,15,24,IntLog2
)
45 /** Indices for settings */
46 enum Settings
{ MaxThreads
, ModuleColor
, ModuleShape
, Quality
, ModuleQuality
48 // Settings-retrieval methods
49 int maxThreads() const
50 { return settingsInt(MaxThreads
); }
51 IColorTransformer
* moduleColor() const
52 { return debugCast
<IColorTransformer
*>(settings
[ModuleColor
].m
); }
53 IShapeTransformer
* moduleShape() const
54 { return debugCast
<IShapeTransformer
*>(settings
[ModuleShape
].m
); }
56 { return settingsInt(Quality
)/100.0; }
57 IQuality2SquareError
* moduleQuality() const
58 { return debugCast
<IQuality2SquareError
*>(settings
[ModuleQuality
].m
); }
60 typedef IColorTransformer::PlaneSettings PlaneSettings
;
61 typedef IColorTransformer::PlaneList PlaneList
;
66 int width
, height
, zoom
;
69 // Construction and destruction
70 MRoot(): myMode(Clear
), width(0), height(0), zoom(-1) {}
73 /** \name IRoot interface
75 Mode
getMode() { return myMode
; }
78 bool encode(const QImage
&toEncode
,const UpdateInfo
&updateInfo
);
79 void decodeAct(DecodeAct action
,int count
=1);
81 bool toStream(std::ostream
&file
);
82 bool fromStream(std::istream
&file
,int zoom
);
86 #endif // ROOT_HEADER_