svc_imggen.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef _SVC_IMGGEN_H
  2. #define _SVC_IMGGEN_H
  3. #include <bfc/dispatch.h>
  4. #include <api/service/services.h>
  5. class NOVTABLE svc_imageGenerator : public Dispatchable
  6. {
  7. public:
  8. static FOURCC getServiceType() { return WaSvc::IMAGEGENERATOR; }
  9. int testDesc(const wchar_t *desc);
  10. ARGB32 *genImage(const wchar_t *desc, int *has_alpha, int *w, int *h, ifc_xmlreaderparams *params = NULL);
  11. int outputCacheable();
  12. enum {
  13. TESTDESC = 10,
  14. GENIMAGE = 30,
  15. OUTPUTCACHEABLE = 40,
  16. };
  17. };
  18. inline int svc_imageGenerator::testDesc(const wchar_t *desc)
  19. {
  20. return _call(TESTDESC, 0, desc);
  21. }
  22. inline ARGB32 *svc_imageGenerator::genImage(const wchar_t *desc, int *has_alpha, int *w, int *h, ifc_xmlreaderparams *params)
  23. {
  24. return _call(GENIMAGE, (ARGB32 *)0, desc, has_alpha, w, h, params);
  25. }
  26. inline int svc_imageGenerator::outputCacheable()
  27. {
  28. return _call(OUTPUTCACHEABLE, 0);
  29. }
  30. // derive from this one
  31. class NOVTABLE svc_imageGeneratorI : public svc_imageGenerator
  32. {
  33. public:
  34. virtual int testDesc(const wchar_t *desc) = 0;
  35. virtual ARGB32 *genImage(const wchar_t *desc, int *has_alpha, int *w, int *h, ifc_xmlreaderparams *params = NULL) = 0;
  36. virtual int outputCacheable() { return 0; }
  37. protected:
  38. RECVS_DISPATCH;
  39. };
  40. #include <api/service/svc_enum.h>
  41. #include <bfc/string/StringW.h>
  42. class ImgGeneratorEnum : public SvcEnumT<svc_imageGenerator>
  43. {
  44. public:
  45. ImgGeneratorEnum(const wchar_t *_desc) : desc(_desc) { }
  46. protected:
  47. virtual int testService(svc_imageGenerator *svc)
  48. {
  49. return svc->testDesc(desc);
  50. }
  51. private:
  52. StringW desc;
  53. };
  54. #endif