image.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. #ifndef _NULLSOFT_WINAMP_ML_DEVICES_IMAGE_HEADER
  2. #define _NULLSOFT_WINAMP_ML_DEVICES_IMAGE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #define IMAGE_FILTER_NORMAL 0x00000000
  7. #define IMAGE_FILTER_GRAYSCALE 0x00010000
  8. #define IMAGE_FILTER_BLEND 0x00020000
  9. #define IMAGE_FILTER_MASK 0xFFFF0000
  10. typedef struct ImageInfo
  11. {
  12. unsigned int width;
  13. unsigned int height;
  14. const wchar_t *path;
  15. } ImageInfo;
  16. HBITMAP
  17. Image_Load(const wchar_t *path,
  18. unsigned int type,
  19. unsigned int flags,
  20. int width,
  21. int height);
  22. HBITMAP
  23. Image_LoadEx(HINSTANCE instance,
  24. const wchar_t *path,
  25. unsigned int type,
  26. unsigned int flags,
  27. int width,
  28. int height);
  29. HBITMAP
  30. Image_LoadSkinned(const wchar_t *path,
  31. unsigned int type,
  32. unsigned int flags, //ISF_XXX + IMAGE_FILTER_XXX
  33. int width,
  34. int height,
  35. COLORREF backColor,
  36. COLORREF frontColor,
  37. COLORREF blendColor); // only valid if IMAGE_FILTER_BLEND set
  38. HBITMAP
  39. Image_LoadSkinnedEx(HINSTANCE instance,
  40. const wchar_t *path,
  41. unsigned int type,
  42. unsigned int flags, //ISF_XXX + IMAGE_FILTER_XXX
  43. int width,
  44. int height,
  45. COLORREF backColor,
  46. COLORREF frontColor,
  47. COLORREF blendColor); // only valid if IMAGE_FILTER_BLEND set
  48. BOOL
  49. Image_FilterEx(void *pixelData,
  50. long width,
  51. long height,
  52. unsigned short bpp,
  53. unsigned int flags,
  54. COLORREF backColor,
  55. COLORREF frontColor,
  56. COLORREF blendColor);
  57. BOOL
  58. Image_Filter(HBITMAP bitmap,
  59. unsigned int flags,
  60. COLORREF backColor,
  61. COLORREF frontColor,
  62. COLORREF blendColor);
  63. BOOL
  64. Image_BlendEx(void *pixelData,
  65. long width,
  66. long height,
  67. unsigned short bpp,
  68. COLORREF blendColor);
  69. BOOL
  70. Image_Blend(HBITMAP bitmap,
  71. COLORREF blendColor);
  72. HBITMAP
  73. Image_DuplicateDib(HBITMAP source);
  74. BOOL
  75. Image_ColorOver(HBITMAP hbmp,
  76. const RECT *prcPart,
  77. BOOL premult,
  78. COLORREF rgb);
  79. BOOL
  80. Image_ColorOverEx(unsigned char *pPixels,
  81. int bitmapCX,
  82. int bitmapCY,
  83. long x,
  84. long y,
  85. long cx,
  86. long cy,
  87. unsigned short bpp,
  88. BOOL premult,
  89. COLORREF rgb);
  90. BOOL
  91. Image_Premultiply(HBITMAP hbmp,
  92. const RECT *prcPart);
  93. BOOL
  94. Image_PremultiplyEx(unsigned char *pPixels,
  95. int bitmapCX,
  96. int bitmapCY,
  97. long x,
  98. long y,
  99. long cx,
  100. long cy,
  101. unsigned short bpp);
  102. BOOL
  103. Image_Demultiply(HBITMAP hbmp,
  104. const RECT *prcPart);
  105. BOOL
  106. Image_DemultiplyEx(unsigned char *pPixels,
  107. int bitmapCX,
  108. int bitmapCY,
  109. long x,
  110. long y,
  111. long cx,
  112. long cy,
  113. unsigned short bpp);
  114. BOOL
  115. Image_Saturate(HBITMAP hbmp,
  116. const RECT *prcPart,
  117. int n,
  118. BOOL fScale);
  119. BOOL
  120. Image_SaturateEx(unsigned char *pPixels,
  121. int bitmapCX,
  122. int bitmapCY,
  123. long x,
  124. long y,
  125. long cx,
  126. long cy,
  127. unsigned short bpp,
  128. int n,
  129. BOOL fScale);
  130. BOOL
  131. Image_AdjustAlpha(HBITMAP hbmp,
  132. const RECT *prcPart,
  133. int n,
  134. BOOL fScale);
  135. BOOL
  136. Image_AdjustAlphaEx(unsigned char *pPixels,
  137. int bitmapCX,
  138. int bitmapCY,
  139. long x,
  140. long y,
  141. long cx,
  142. long cy,
  143. unsigned short bpp,
  144. int n,
  145. BOOL fScale);
  146. BOOL
  147. Image_AdjustSaturationAlpha(HBITMAP hbmp,
  148. const RECT *prcPart,
  149. int nSaturation,
  150. int nAlpha);
  151. BOOL
  152. Image_AdjustSaturationAlphaEx(unsigned char *pPixels,
  153. int bitmapCX,
  154. int bitmapCY,
  155. long x,
  156. long y,
  157. long cx,
  158. long cy,
  159. unsigned short bpp,
  160. int nSaturation,
  161. int nAlpha);
  162. BOOL
  163. Image_FillBorder(HDC targetDC,
  164. const RECT *targetRect,
  165. HDC sourceDC,
  166. const RECT *sourceRect,
  167. BOOL fillCenter,
  168. BYTE alphaConstant);
  169. const ImageInfo *
  170. Image_GetBestFit(const ImageInfo *images,
  171. size_t count,
  172. unsigned int width,
  173. unsigned int height);
  174. typedef enum AlphaBlendFlags
  175. {
  176. AlphaBlend_Normal = 0,
  177. AlphaBlend_ScaleSource = (1 << 0),
  178. AlphaBlend_AlignLeft = (1 << 1),
  179. AlphaBlend_AlignRight = (1 << 2),
  180. AlphaBlend_AlignCenter = 0,
  181. AlphaBlend_AlignTop = (1 << 3),
  182. AlphaBlend_AlignBottom = (1 << 4),
  183. AlphaBlend_AlignVCenter = 0,
  184. }AlphaBlendFlags;
  185. DEFINE_ENUM_FLAG_OPERATORS(AlphaBlendFlags);
  186. BOOL
  187. Image_AlphaBlend(HDC targetDC,
  188. const RECT *targetRect,
  189. HDC sourceDC,
  190. const RECT *sourceRect,
  191. BYTE sourceAlpha,
  192. HBITMAP sourceBitmap,
  193. const RECT *paintRect,
  194. AlphaBlendFlags flags,
  195. RECT *rectOut);
  196. #endif //_NULLSOFT_WINAMP_ML_DEVICES_IMAGE_HEADER