summaryrefslogtreecommitdiff
path: root/alf/alf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alf.cpp')
-rw-r--r--alf/alf.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/alf/alf.cpp b/alf/alf.cpp
index d40522f..311c65b 100644
--- a/alf/alf.cpp
+++ b/alf/alf.cpp
@@ -415,3 +415,27 @@ ALF_ShouldMessageBubble(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|| msg == WM_CTLCOLORLISTBOX || msg == WM_CTLCOLORSCROLLBAR
|| msg == WM_CTLCOLORSTATIC;
}
+
+void
+ALF_FillRect(HDC dc, const RECT *rc, ALFColor color)
+{
+ if (color == ALF_COLOR_TRANSPARENT)
+ return;
+
+ COLORREF gdicolor = ALF_ColorToGdi(color);
+ COLORREF oldBkColor = SetBkColor(dc, gdicolor);
+ ExtTextOut(dc, 0, 0, ETO_OPAQUE, rc, NULL, 0, NULL);
+ SetBkColor(dc, oldBkColor);
+}
+
+COLORREF
+ALF_ColorToGdi(ALFColor color)
+{
+ if (color == ALF_COLOR_TRANSPARENT) {
+ return (COLORREF)-1;
+ } else if (color & 0x80000000) {
+ return GetSysColor((color & 0x7f000000) >> 24);
+ } else {
+ return (COLORREF)color;
+ }
+}