UIRender.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __UIRENDER_H__
  2. #define __UIRENDER_H__
  3. #pragma once
  4. namespace DuiLib {
  5. /////////////////////////////////////////////////////////////////////////////////////
  6. //
  7. class DUILIB_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 DUILIB_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& rcScale9, 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. // 以下函数中的颜色参数alpha值无效
  38. static void DrawLine(HDC hDC, const RECT& rc, int nSize, DWORD dwPenColor, int nStyle = PS_SOLID);
  39. static void DrawRect(HDC hDC, const RECT& rc, int nSize, DWORD dwPenColor, int nStyle = PS_SOLID);
  40. static void DrawRoundRect(HDC hDC, const RECT& rc, int width, int height, int nSize, DWORD dwPenColor, int nStyle = PS_SOLID);
  41. static void DrawText(HDC hDC, CPaintManagerUI* pManager, RECT& rc, LPCTSTR pstrText, \
  42. DWORD dwTextColor, int iFont, UINT uStyle);
  43. static void DrawHtmlText(HDC hDC, CPaintManagerUI* pManager, RECT& rc, LPCTSTR pstrText,
  44. DWORD dwTextColor, RECT* pLinks, CDuiString* sLinks, int& nLinkRects, int iDefaultFont, UINT uStyle);
  45. static HBITMAP GenerateBitmap(CPaintManagerUI* pManager, RECT rc, CControlUI* pStopControl = NULL, DWORD dwFilterColor = 0);
  46. static HBITMAP GenerateBitmap(CPaintManagerUI* pManager, CControlUI* pControl, RECT rc, DWORD dwFilterColor = 0);
  47. static SIZE GetTextSize(HDC hDC, CPaintManagerUI* pManager , LPCTSTR pstrText, int iFont, UINT uStyle);
  48. };
  49. } // namespace DuiLib
  50. #endif // __UIRENDER_H__