api_imgldr.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef __API_IMGLOADER_H
  2. #define __API_IMGLOADER_H
  3. #include <wasabicfg.h>
  4. #include <bfc/dispatch.h>
  5. class RegionServer;
  6. class api_region;
  7. class imgldr_api : public Dispatchable
  8. {
  9. public:
  10. ARGB32 *imgldr_makeBmp(const wchar_t *filename, int *has_alpha, int *w, int *h);
  11. ARGB32 *imgldr_makeBmp(OSMODULEHANDLE hInst, int id, int *has_alpha, int *w, int *h, const wchar_t *colorgroup = NULL);
  12. void imgldr_releaseBmp(ARGB32 *bmpbits);
  13. ARGB32 *imgldr_requestSkinBitmap(const wchar_t *file, int *has_alpha, int *x, int *y, int *subw, int *subh, int *w, int *h, int cached);
  14. RegionServer *imgldr_requestSkinRegion(const wchar_t *id);
  15. void imgldr_cacheSkinRegion(const wchar_t *id, api_region *r);
  16. void imgldr_releaseSkinBitmap(ARGB32 *bmpbits);
  17. DISPATCH_CODES
  18. {
  19. IMGLDR_API_MAKEBMP = 0,
  20. IMGLDR_API_MAKEBMP2 = 10,
  21. IMGLDR_API_RELEASEBMP = 20,
  22. IMGLDR_API_REQUESTSKINBITMAP = 30,
  23. IMGLDR_API_REQUESTSKINREGION = 40,
  24. IMGLDR_API_CACHESKINREGION = 50,
  25. IMGLDR_API_RELEASESKINBITMAP = 60,
  26. };
  27. };
  28. inline ARGB32 *imgldr_api::imgldr_makeBmp(const wchar_t *filename, int *has_alpha, int *w, int *h)
  29. {
  30. return _call(IMGLDR_API_MAKEBMP, (ARGB32 *)NULL, filename, has_alpha, w, h);
  31. }
  32. inline ARGB32 *imgldr_api::imgldr_makeBmp(OSMODULEHANDLE hInst, int id, int *has_alpha, int *w, int *h, const wchar_t *colorgroup)
  33. {
  34. return _call(IMGLDR_API_MAKEBMP2, (ARGB32 *)NULL, hInst, id, has_alpha, w, h, colorgroup);
  35. }
  36. inline void imgldr_api::imgldr_releaseBmp(ARGB32 *bmpbits)
  37. {
  38. _voidcall(IMGLDR_API_RELEASEBMP, bmpbits);
  39. }
  40. #ifdef WASABI_COMPILE_SKIN
  41. inline ARGB32 *imgldr_api::imgldr_requestSkinBitmap(const wchar_t *file, int *has_alpha, int *x, int *y, int *subw, int *subh, int *w, int *h, int cached)
  42. {
  43. return _call(IMGLDR_API_REQUESTSKINBITMAP, (ARGB32 *)NULL, file, has_alpha, x, y, subw, subh, w, h, cached);
  44. }
  45. inline RegionServer *imgldr_api::imgldr_requestSkinRegion(const wchar_t *id)
  46. {
  47. return _call(IMGLDR_API_REQUESTSKINREGION, (RegionServer *)NULL, id);
  48. }
  49. inline void imgldr_api::imgldr_cacheSkinRegion(const wchar_t *id, api_region *r)
  50. {
  51. _voidcall(IMGLDR_API_CACHESKINREGION, id, r);
  52. }
  53. inline void imgldr_api::imgldr_releaseSkinBitmap(ARGB32 *bmpbits)
  54. {
  55. _voidcall(IMGLDR_API_RELEASESKINBITMAP, bmpbits);
  56. }
  57. #endif //WASABI_COMPILE_SKIN
  58. class imgldr_apiI : public imgldr_api
  59. {
  60. public:
  61. virtual ARGB32 *imgldr_makeBmp(const wchar_t *filename, int *has_alpha, int *w, int *h) = 0;
  62. #ifdef _WIN32
  63. virtual ARGB32 *imgldr_makeBmp2(OSMODULEHANDLE hInst, int id, int *has_alpha, int *w, int *h, const wchar_t *colorgroup = NULL) = 0;
  64. #endif
  65. virtual void imgldr_releaseBmp(ARGB32 *bmpbits) = 0;
  66. #ifdef WASABI_COMPILE_SKIN
  67. virtual ARGB32 *imgldr_requestSkinBitmap(const wchar_t *file, int *has_alpha, int *x, int *y, int *subw, int *subh, int *w, int *h, int cached) = 0;
  68. virtual RegionServer *imgldr_requestSkinRegion(const wchar_t *id) = 0;
  69. virtual void imgldr_cacheSkinRegion(const wchar_t *id, api_region *r) = 0;
  70. virtual void imgldr_releaseSkinBitmap(ARGB32 *bmpbits) = 0;
  71. #endif //WASABI_COMPILE_SKIN
  72. protected:
  73. RECVS_DISPATCH;
  74. };
  75. // {703ECC7C-B3D8-4e1e-B8B5-A7563D9D6F30}
  76. static const GUID imgLdrApiServiceGuid =
  77. { 0x703ecc7c, 0xb3d8, 0x4e1e, { 0xb8, 0xb5, 0xa7, 0x56, 0x3d, 0x9d, 0x6f, 0x30 } };
  78. extern imgldr_api *imgLoaderApi;
  79. #endif