-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolidTexture.cpp
More file actions
61 lines (47 loc) · 1.45 KB
/
SolidTexture.cpp
File metadata and controls
61 lines (47 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "common.h"
#include "SolidTexture.h"
SolidTexture::SolidTexture()
{
backgroundColor = 0;
bevel = false;
darkBevelColor = 0;
lightBevelColor = 0;
}
void SolidTexture::read(const string &prefix)
{
backgroundColor = GetConfigColor(prefix, "Color", RGB(128, 128, 128));
bevel = GetConfigBoolean(prefix, "Bevel");
darkBevelColor = GetConfigColor(prefix, "DarkBevelColor", DarkenColor(backgroundColor));
lightBevelColor = GetConfigColor(prefix, "LightBevelColor", LightenColor(backgroundColor));
}
void SolidTexture::apply(HDC hDC, int x, int y, int width, int height)
{
RECT r;
r.left = x;
r.top = y;
r.right = r.left + width;
r.bottom = r.bottom + height;
// fill in the background
HBRUSH backgroundBrush = CreateSolidBrush(backgroundColor);
FillRect(hDC, &r, backgroundBrush);
DeleteObject(backgroundBrush);
// draw the dark bevel
HPEN pen = CreatePen(PS_SOLID, 1, darkBevelColor);
HPEN tempPen = (HPEN) SelectObject(hDC, pen);
MoveToEx(hDC, r.left, r.bottom - 1, 0);
LineTo(hDC, r.right - 1, r.bottom - 1);
LineTo(hDC, r.right - 1, r.top);
SelectObject(hDC, tempPen);
DeleteObject(pen);
// draw the light bevel
pen = CreatePen(PS_SOLID, 1, lightBevelColor);
tempPen = (HPEN) SelectObject(hDC, pen);
LineTo(hDC, r.left, r.top);
LineTo(hDC, r.left, r.bottom - 1);
SelectObject(hDC, tempPen);
DeleteObject(pen);
}
boolean SolidTexture::isTransparent() const
{
return false;
}