MCPcopy Create free account
hub / github.com/NetHack/NetHack / setMsgTextColor

Function setMsgTextColor

outdated/sys/wince/mhmsgwnd.c:463–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461#endif // MSG_WRAP_TEXT
462
463COLORREF
464setMsgTextColor(HDC hdc, int gray)
465{
466 COLORREF fg, color1, color2;
467 if (gray) {
468 color1 = mswin_get_color(NHW_MESSAGE, MSWIN_COLOR_BG);
469 color2 = mswin_get_color(NHW_MESSAGE, MSWIN_COLOR_FG);
470 /* Make a "gray" color by taking the average of the individual R,G,B
471 components of two colors. Thanks to Jonathan del Strother */
472 fg = RGB((GetRValue(color1) + GetRValue(color2)) / 2,
473 (GetGValue(color1) + GetGValue(color2)) / 2,
474 (GetBValue(color1) + GetBValue(color2)) / 2);
475 } else {
476 fg = mswin_get_color(NHW_MESSAGE, MSWIN_COLOR_FG);
477 }
478
479 return SetTextColor(hdc, fg);
480}
481
482void
483onPaint(HWND hWnd)

Callers 1

onPaintFunction · 0.70

Calls 2

mswin_get_colorFunction · 0.85
RGBClass · 0.50

Tested by

no test coverage detected