1
0

gammamgr.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef _GAMMAMGR_H
  2. #define _GAMMAMGR_H
  3. #include <api/xml/xmlreader.h>
  4. #include <api/service/svcs/svc_skinfilter.h>
  5. #include <bfc/string/StringW.h>
  6. #include <api/skin/colorthemes.h>
  7. class ColorThemeGroupI : public ColorThemeGroup
  8. {
  9. public:
  10. ColorThemeGroupI(const wchar_t *pname, int pred, int pgreen, int pblue, int pgray, int pboost)
  11. : name(pname), red(pred), green(pgreen), blue(pblue), make_grayscale(pgray), boost_levels(pboost) { }
  12. ColorThemeGroupI(ColorThemeGroup &copy_group)
  13. {
  14. name = copy_group.getName();
  15. red = copy_group.getRed();
  16. green = copy_group.getGreen();
  17. blue = copy_group.getBlue();
  18. make_grayscale = copy_group.getGray();
  19. boost_levels = copy_group.getBoost();
  20. }
  21. virtual const wchar_t *getName() { return name; }
  22. virtual int getRed() { return red; }
  23. virtual int getGreen() { return green; }
  24. virtual int getBlue() { return blue; }
  25. virtual int getGray() { return make_grayscale; }
  26. virtual int getBoost() { return boost_levels; }
  27. virtual void setName(const wchar_t *pname) { name = pname; }
  28. virtual void setRed(int r) { red = r; }
  29. virtual void setGreen(int g) { green = g; }
  30. virtual void setBlue(int b) { blue = b; }
  31. virtual void setGray(int g) { make_grayscale = g; }
  32. virtual void setBoost(int b) { boost_levels = b; }
  33. protected:
  34. RECVS_DISPATCH;
  35. StringW name;
  36. int red;
  37. int green;
  38. int blue;
  39. int make_grayscale;
  40. int boost_levels;
  41. };
  42. class GammaMgrXmlReader : public XmlReaderCallbackI
  43. {
  44. public:
  45. void xmlReaderOnStartElementCallback(const wchar_t *xmltag, skin_xmlreaderparams *params);
  46. };
  47. class GammaMgr
  48. {
  49. public:
  50. static void init();
  51. static void deinit();
  52. static void onBeforeLoadingGammaGroups();
  53. static void onAfterLoadingGammaGroups();
  54. static int gammaEqual(const wchar_t *id1, const wchar_t *id2);
  55. static void xmlReaderOnStartElementCallback(const wchar_t *xmltag, skin_xmlreaderparams *params);
  56. static int filterBitmap(uint8_t *bits, int w, int h, int bpp, const wchar_t *element_id, const wchar_t *forcegroup=NULL);
  57. static ARGB32 filterColor(ARGB32 color, const wchar_t *element_id, const wchar_t *forcegroup=NULL);
  58. /*
  59. static void setGammaSet(const wchar_t *set);
  60. static int getNumGammaSets();
  61. static const wchar_t *enumGammaSet(int n);
  62. static int getNumGammaGroups(const wchar_t *gammaset);
  63. static const wchar_t *enumGammaGroup(const wchar_t *gammaset, int n);
  64. static ColorThemeGroup *enumColorThemeGroup(int colorset, int colorgroup);
  65. static ColorThemeGroup *getColorThemeGroup(const wchar_t *colorset, const wchar_t *colorgroup);
  66. static void newGammaSet(const wchar_t *set);
  67. static void updateGammaSet(const wchar_t *set);
  68. static void renameGammaSet(const wchar_t *set, const wchar_t *newname);
  69. static void deleteGammaSet(const wchar_t *set);*/
  70. static void loadDefault();
  71. private:
  72. static void onGammaSet();
  73. static GammaMgrXmlReader xmlreader;
  74. static int curset; // current while parsing xml
  75. };
  76. #endif