MCPcopy Create free account
hub / github.com/cinience/RedisStudio / DrawColor

Method DrawColor

DuiLib/Core/UIRender.cpp:1050–1080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048}
1049
1050void CRenderEngine::DrawColor(HDC hDC, const RECT& rc, DWORD color)
1051{
1052 if( color <= 0x00FFFFFF ) return;
1053 if( color >= 0xFF000000 )
1054 {
1055 ::SetBkColor(hDC, RGB(GetBValue(color), GetGValue(color), GetRValue(color)));
1056 ::ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL);
1057 }
1058 else
1059 {
1060 // Create a new 32bpp bitmap with room for an alpha channel
1061 BITMAPINFO bmi = { 0 };
1062 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1063 bmi.bmiHeader.biWidth = 1;
1064 bmi.bmiHeader.biHeight = 1;
1065 bmi.bmiHeader.biPlanes = 1;
1066 bmi.bmiHeader.biBitCount = 32;
1067 bmi.bmiHeader.biCompression = BI_RGB;
1068 bmi.bmiHeader.biSizeImage = 1 * 1 * sizeof(DWORD);
1069 LPDWORD pDest = NULL;
1070 HBITMAP hBitmap = ::CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, (LPVOID*) &pDest, NULL, 0);
1071 if( !hBitmap ) return;
1072
1073 *pDest = color;
1074
1075 RECT rcBmpPart = {0, 0, 1, 1};
1076 RECT rcCorners = {0};
1077 DrawImage(hDC, hBitmap, rc, rc, rcBmpPart, rcCorners, true, 255);
1078 ::DeleteObject(hBitmap);
1079 }
1080}
1081
1082void CRenderEngine::DrawGradient(HDC hDC, const RECT& rc, DWORD dwFirst, DWORD dwSecond, bool bVertical, int nSteps)
1083{

Callers

nothing calls this directly

Calls 1

DrawImageFunction · 0.85

Tested by

no test coverage detected