imgldrapi.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include "precomp.h"
  2. #include <api.h>
  3. #include "imgldrapi.h"
  4. #include <api/imgldr/imgldr.h>
  5. #include <api/skin/skinelem.h>
  6. imgldr_api *imgLoaderApi = NULL;
  7. ARGB32 *ImgLdrApi::imgldr_makeBmp(const wchar_t *filename, int *has_alpha, int *w, int *h)
  8. {
  9. if (filename == NULL)
  10. {
  11. DebugString("illegal param : filename == NULL");
  12. return NULL;
  13. }
  14. return imageLoader::makeBmp(filename, NULL, has_alpha, w, h, NULL, TRUE, NULL);
  15. }
  16. #ifdef _WIN32
  17. ARGB32 *ImgLdrApi::imgldr_makeBmp2(HINSTANCE hInst, int id, int *has_alpha, int *w, int *h, const wchar_t *colorgroup)
  18. {
  19. return imageLoader::makeBmp(hInst, id, has_alpha,w,h, colorgroup);
  20. }
  21. #endif
  22. void ImgLdrApi::imgldr_releaseBmp(ARGB32 *bmpbits)
  23. {
  24. if (bmpbits == NULL) {
  25. DebugString("illegal param : bmpbits == NULL");
  26. return;
  27. }
  28. imageLoader::release(bmpbits);
  29. }
  30. #ifdef WASABI_COMPILE_SKIN
  31. ARGB32 *ImgLdrApi::imgldr_requestSkinBitmap(const wchar_t *file, int *has_alpha, int *x, int *y, int *subw, int *subh, int *w, int *h, int cached)
  32. {
  33. if (file == NULL)
  34. {
  35. DebugString("illegal param : file == NULL");
  36. return NULL;
  37. }
  38. return imageLoader::requestSkinBitmap(file, has_alpha, x, y, subw, subh, w, h, cached);
  39. }
  40. void ImgLdrApi::imgldr_releaseSkinBitmap(ARGB32 *bmpbits)
  41. {
  42. if (bmpbits == NULL)
  43. {
  44. DebugString("illegal param : bmpbits == NULL");
  45. return;
  46. }
  47. imageLoader::releaseSkinBitmap(bmpbits);
  48. }
  49. RegionServer *ImgLdrApi::imgldr_requestSkinRegion(const wchar_t *id)
  50. {
  51. if (id == NULL)
  52. {
  53. DebugString("illegal param : id == NULL");
  54. return NULL;
  55. }
  56. return WASABI_API_PALETTE->requestSkinRegion(id);
  57. }
  58. void ImgLdrApi::imgldr_cacheSkinRegion(const wchar_t *id, api_region *r)
  59. {
  60. if (id == NULL)
  61. {
  62. DebugString("illegal param : id == NULL");
  63. }
  64. if (r == NULL)
  65. {
  66. DebugString("illegal param : region == NULL");
  67. }
  68. WASABI_API_PALETTE->cacheSkinRegion(id, r);
  69. }
  70. #endif