imageCache.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef _NULLSOFT_WINAMP_ML_DEVICES_IMAGE_CACHE_HEADER
  2. #define _NULLSOFT_WINAMP_ML_DEVICES_IMAGE_CACHE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. typedef struct DeviceColoredImage DeviceColoredImage;
  7. typedef struct DeviceImage DeviceImage;
  8. typedef struct DeviceImageCache DeviceImageCache;
  9. typedef HBITMAP (*DeviceImageLoader)(const wchar_t* /*path*/, int /*width*/, int /*height*/, void* /*user*/);
  10. typedef BOOL (*DeviceImageFilter)(HBITMAP /*bitmap*/, COLORREF /*color1*/, COLORREF /*color2*/, void* /*user*/);
  11. DeviceImageCache *
  12. DeviceImageCache_Create();
  13. void
  14. DeviceImageCache_Free(DeviceImageCache *self);
  15. DeviceImage *
  16. DeviceImageCache_GetImage(DeviceImageCache *self,
  17. const wchar_t *path,
  18. int width,
  19. int height,
  20. DeviceImageLoader loader,
  21. void *user);
  22. size_t
  23. DeviceImage_AddRef(DeviceImage *self);
  24. size_t
  25. DeviceImage_Release(DeviceImage *self);
  26. BOOL
  27. DeviceImage_GetSize(DeviceImage *self,
  28. int *width,
  29. int *height);
  30. typedef enum DeviceImageFlags
  31. {
  32. DeviceImage_ExactSize = (1 << 0),
  33. DeviceImage_AlignLeft = 0,
  34. DeviceImage_AlignRight = (1 << 1),
  35. DeviceImage_AlignHCenter = (1 << 2),
  36. DeviceImage_AlignTop = 0,
  37. DeviceImage_AlignBottom = (1 << 3),
  38. DeviceImage_AlignVCenter = (1 << 4),
  39. DeviceImage_Normal = (DeviceImage_AlignLeft | DeviceImage_AlignTop),
  40. } DeviceImageFlags;
  41. DEFINE_ENUM_FLAG_OPERATORS(DeviceImageFlags);
  42. HBITMAP
  43. DeviceImage_GetBitmap(DeviceImage *self, DeviceImageFlags flags);
  44. DeviceColoredImage *
  45. DeviceImage_GetColoredImage(DeviceImage *self,
  46. COLORREF color1,
  47. COLORREF color2,
  48. DeviceImageFilter filter,
  49. void *user);
  50. size_t
  51. DeviceColoredImage_AddRef(DeviceColoredImage *self);
  52. size_t
  53. DeviceColoredImage_Release(DeviceColoredImage *self);
  54. HBITMAP
  55. DeviceColoredImage_GetBitmap(DeviceColoredImage *self, DeviceImageFlags flags);
  56. DeviceImage*
  57. DeviceColoredImage_GetBaseImage(DeviceColoredImage *self);
  58. #endif // _NULLSOFT_WINAMP_ML_DEVICES_IMAGE_CACHE_HEADER