graphics.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _NULLSOFT_WINAMP_ML_PORTABLES_GRAPHICS_HEADER
  2. #define _NULLSOFT_WINAMP_ML_PORTABLES_GRAPHICS_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #ifndef SelectBitmap
  7. #define SelectBitmap(_hdc, _bitmap) ((HBITMAP)SelectObject(_hdc, _bitmap))
  8. #endif
  9. #ifndef SelectFont
  10. #define SelectFont(_hdc, _font) ((HFONT)SelectObject(_hdc, _font))
  11. #endif
  12. #ifndef SelectBrush
  13. #define SelectBrush(_hdc, _brush) ((HBRUSH)SelectObject(_hdc, _brush))
  14. #endif
  15. #ifndef GetCurrentBitmap
  16. #define GetCurrentBitmap(_hdc) ((HBITMAP)GetCurrentObject(_hdc, OBJ_BITMAP))
  17. #endif
  18. #ifndef GetCurrentFont
  19. #define GetCurrentFont(_hdc) ((HFONT)GetCurrentObject(_hdc, OBJ_FONT))
  20. #endif
  21. #ifndef GetCurrentBrush
  22. #define GetCurrentBrush(_hdc) ((HBRUSH)GetCurrentObject(_hdc, OBJ_BRUSH))
  23. #endif
  24. #ifndef SET_GRADIENT_VERTEX
  25. #define SET_GRADIENT_VERTEX(_vertex, _x, _y, _rgb)\
  26. {(_vertex).x = (_x); (_vertex).y = (_y);\
  27. (_vertex).Red = GetRValue(_rgb) << 8; (_vertex).Green = GetGValue(_rgb) << 8;\
  28. (_vertex).Blue = GetBValue(_rgb) << 8; (_vertex).Alpha = 0x0000;}
  29. #endif
  30. #ifndef SET_GRADIENT_RECT_MESH
  31. #define SET_GRADIENT_RECT_MESH(_mesh, _upperLeft, _bottomRight)\
  32. {(_mesh).UpperLeft = (_upperLeft); (_mesh).LowerRight = (_bottomRight);}
  33. #endif
  34. BYTE Graphics_GetSysFontQuality();
  35. HFONT Graphics_CreateSysFont();
  36. HFONT Graphics_DuplicateFont(HFONT sourceFont, INT heightDeltaPt, BOOL forceBold, BOOL systemQuality);
  37. long Graphics_GetFontHeight(HDC hdc);
  38. long Graphics_GetAveStrWidth(HDC hdc, UINT cchLen);
  39. BOOL Graphics_GetWindowBaseUnits(HWND hwnd, LONG *baseUnitX, LONG *baseUnitY);
  40. COLORREF Graphics_GetSkinColor(unsigned int colorIndex);
  41. COLORREF Graphics_BlendColors(COLORREF rgbTop, COLORREF rgbBottom, INT alpha);
  42. INT Graphics_GetColorDistance(COLORREF rgb1, COLORREF rgb2);
  43. void Graphics_ClampRect(RECT *rect, const RECT *boxRect);
  44. void Graphics_NormalizeRect(RECT *rect);
  45. void Graphics_GetRectSizeNormalized(const RECT *rect, SIZE *size);
  46. BOOL Graphics_IsRectFit(const RECT *rect, const RECT *boxRect);
  47. BOOL SetSizeEmpty(SIZE *size);
  48. BOOL IsSizeEmpty(SIZE *size);
  49. BOOL SetSize(SIZE *size, long width, long height);
  50. BOOL SetPoint(POINT *pt, long x, long y);
  51. BOOL MakeRectPolygon(POINT vertices[4], long left, long top, long right, long bottom);
  52. #endif //_NULLSOFT_WINAMP_ML_PORTABLES_GRAPHICS_HEADER