UIRender.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef __UIRENDER_H__
  2. #define __UIRENDER_H__
  3. #pragma once
  4. namespace DuiLib {
  5. /////////////////////////////////////////////////////////////////////////////////////
  6. //
  7. class UILIB_API CRenderClip
  8. {
  9. public:
  10. ~CRenderClip();
  11. RECT rcItem;
  12. HDC hDC;
  13. HRGN hRgn;
  14. HRGN hOldRgn;
  15. static void GenerateClip(HDC hDC, RECT rc, CRenderClip& clip);
  16. static void GenerateRoundClip(HDC hDC, RECT rc, RECT rcItem, int width, int height, CRenderClip& clip);
  17. static void UseOldClipBegin(HDC hDC, CRenderClip& clip);
  18. static void UseOldClipEnd(HDC hDC, CRenderClip& clip);
  19. };
  20. /////////////////////////////////////////////////////////////////////////////////////
  21. //
  22. class UILIB_API CRenderEngine
  23. {
  24. public:
  25. static DWORD AdjustColor(DWORD dwColor, short H, short S, short L);
  26. static HBITMAP CreateARGB32Bitmap(HDC hDC, int cx, int cy, COLORREF** pBits);
  27. static void AdjustImage(bool bUseHSL, TImageInfo* imageInfo, short H, short S, short L);
  28. static TImageInfo* LoadImage(STRINGorID bitmap, LPCTSTR type = NULL, DWORD mask = 0);
  29. static void FreeImage(TImageInfo* bitmap, bool bDelete = true);
  30. static void DrawImage(HDC hDC, HBITMAP hBitmap, const RECT& rc, const RECT& rcPaint, \
  31. const RECT& rcBmpPart, const RECT& rcCorners, bool alphaChannel, BYTE uFade = 255,
  32. bool hole = false, bool xtiled = false, bool ytiled = false);
  33. static bool DrawImage(HDC hDC, CPaintManagerUI* pManager, const RECT& rcItem, const RECT& rcPaint,
  34. TDrawInfo& drawInfo);
  35. static void DrawColor(HDC hDC, const RECT& rc, DWORD color);
  36. static void DrawGradient(HDC hDC, const RECT& rc, DWORD dwFirst, DWORD dwSecond, bool bVertical, int nSteps);
  37. //modify by hshong
  38. static void DrawGradientEx(HDC hDC,const RECT& rc,COLORREF crColors[],size_t nColors, DWORD dwFillMode=GRADIENT_FILL_RECT_H);
  39. // 以下函数中的颜色参数alpha值无效
  40. static void DrawLine(HDC hDC, const RECT& rc, int nSize, DWORD dwPenColor, int nStyle = PS_SOLID);
  41. static void DrawRect(HDC hDC, const RECT& rc, int nSize, DWORD dwPenColor, int nStyle = PS_SOLID);
  42. static void DrawRoundRect(HDC hDC, const RECT& rc, int width, int height, int nSize, DWORD dwPenColor, int nStyle = PS_SOLID);
  43. static void DrawText(HDC hDC, CPaintManagerUI* pManager, RECT& rc, LPCTSTR pstrText, \
  44. DWORD dwTextColor, int iFont, UINT uStyle);
  45. static void DrawHtmlText(HDC hDC, CPaintManagerUI* pManager, RECT& rc, LPCTSTR pstrText,
  46. DWORD dwTextColor, RECT* pLinks, CDuiString* sLinks, int& nLinkRects, UINT uStyle);
  47. static HBITMAP GenerateBitmap(CPaintManagerUI* pManager, CControlUI* pControl, RECT rc);
  48. static SIZE GetTextSize(HDC hDC, CPaintManagerUI* pManager , LPCTSTR pstrText, int iFont, UINT uStyle);
  49. };
  50. } // namespace DuiLib
  51. #endif // __UIRENDER_H__