Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.6 KiB

  1. //---------------------------------------------------------------------------
  2. // Gradient.h - gradient drawing support
  3. //---------------------------------------------------------------------------
  4. #pragma once
  5. //---------------------------------------------------------------------------
  6. #define SYSCOLOR(c) (c|0x80000000)
  7. #define RGBA2WINCOLOR(color) (color.bBlue << 16) | (color.bGreen << 8) | (color.bRed);
  8. #define FIXCOLORVAL(val) ((val > 255) ? 255 : ((val < 0) ? 0 : val))
  9. //---------------------------------------------------------------------------
  10. struct RGBA
  11. {
  12. BYTE bRed;
  13. BYTE bGreen;
  14. BYTE bBlue;
  15. BYTE bAlpha; // not currently supported
  16. };
  17. //---------------------------------------------------------------------------
  18. struct GRADIENTPART
  19. {
  20. BYTE Ratio; // 0-255 ratio for this color (sum of ratios must be <= 255)
  21. RGBA Color;
  22. };
  23. //---------------------------------------------------------------------------
  24. //---- public ----
  25. HRESULT PaintGradientRadialRect(HDC hdc, RECT &rcBounds, int iPartCount,
  26. GRADIENTPART *pGradientParts);
  27. HRESULT PaintHorzGradient(HDC hdc, RECT &rcBounds, int iPartCount,
  28. GRADIENTPART *pGradientParts);
  29. HRESULT PaintVertGradient(HDC hdc, RECT &rcBounds, int iPartCount,
  30. GRADIENTPART *pGradientParts);
  31. //---- helpers ----
  32. void PaintGradientVertBand(HDC hdc, RECT &rcBand, COLORREF color1, COLORREF color2);
  33. void PaintGradientHorzBand(HDC hdc, RECT &rcBand, COLORREF color1, COLORREF color2);
  34. void PaintGradientRadialBand(HDC hdc, RECT &rcBand, int radiusOffset,
  35. int radius, COLORREF color1, COLORREF color2);
  36. //---------------------------------------------------------------------------