ReactOS  0.4.12-dev-102-g4b7f1e0
drawing.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void Line (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness)
 
void Rect (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
 
void Ellp (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
 
void RRect (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
 
void Poly (HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
 
void Bezier (HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness)
 
void Fill (HDC hdc, LONG x, LONG y, COLORREF color)
 
void Erase (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
 
void Replace (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
 
void Airbrush (HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
 
void Brush (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
 
void RectSel (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
 
void SelectionFrame (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, DWORD system_selection_color)
 
void Text (HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style)
 

Function Documentation

◆ Airbrush()

void Airbrush ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  color,
LONG  r 
)

Definition at line 149 of file drawing.cpp.

Referenced by CToolSettingsWindow::OnPaint(), startPaintingL(), startPaintingR(), whilePaintingL(), and whilePaintingR().

150 {
151  LONG a, b;
152 
153  for(b = -r; b <= r; b++)
154  for(a = -r; a <= r; a++)
155  if ((a * a + b * b <= r * r) && (rand() % 4 == 0))
156  SetPixel(hdc, x + a, y + b, color);
157 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
INT INT y
Definition: msvc.h:62
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
_Check_return_ int __cdecl rand(void)
Definition: rand.c:10
#define a
Definition: ke_i.h:78
HDC hdc
Definition: msvc.h:53
#define b
Definition: ke_i.h:79
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
INT x
Definition: msvc.h:62

◆ Bezier()

void Bezier ( HDC  hdc,
POINT  p1,
POINT  p2,
POINT  p3,
POINT  p4,
COLORREF  color,
int  thickness 
)

Definition at line 95 of file drawing.cpp.

Referenced by GDI_Bezier(), whilePaintingL(), and whilePaintingR().

96 {
97  HPEN oldPen;
98  POINT fourPoints[4];
99  fourPoints[0] = p1;
100  fourPoints[1] = p2;
101  fourPoints[2] = p3;
102  fourPoints[3] = p4;
103  oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
104  PolyBezier(hdc, fourPoints, 4);
105  DeleteObject(SelectObject(hdc, oldPen));
106 }
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
const GLfloat * p2
Definition: s_aatritemp.h:44
#define PS_SOLID
Definition: wingdi.h:584
GLuint color
Definition: glext.h:6243
HDC hdc
Definition: msvc.h:53
BOOL WINAPI PolyBezier(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:247
const GLfloat * p1
Definition: s_aatritemp.h:43

◆ Brush()

void Brush ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  color,
LONG  style 
)

Definition at line 160 of file drawing.cpp.

Referenced by DeleteFrameBrushes(), DrvBitBlt(), MultiWndProc(), CToolSettingsWindow::OnPaint(), PaintCells(), startPaintingL(), startPaintingR(), ui_patblt(), whilePaintingL(), and whilePaintingR().

161 {
162  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
163  HBRUSH oldBrush = (HBRUSH) SelectObject(hdc, CreateSolidBrush(color));
164  LONG a, b;
165  b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
166  switch (style)
167  {
168  case 0:
169  for(a = 0; a <= b; a++)
170  Ellipse(hdc, (x1 * (b - a) + x2 * a) / b - 3, (y1 * (b - a) + y2 * a) / b - 3,
171  (x1 * (b - a) + x2 * a) / b + 4, (y1 * (b - a) + y2 * a) / b + 4);
172  break;
173  case 1:
174  for(a = 0; a <= b; a++)
175  Ellipse(hdc, (x1 * (b - a) + x2 * a) / b - 1, (y1 * (b - a) + y2 * a) / b - 1,
176  (x1 * (b - a) + x2 * a) / b + 3, (y1 * (b - a) + y2 * a) / b + 3);
177  break;
178  case 2:
179  MoveToEx(hdc, x1, y1, NULL);
180  LineTo(hdc, x2, y2);
181  SetPixel(hdc, x2, y2, color);
182  break;
183  case 3:
184  for(a = 0; a <= b; a++)
185  Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - 3, (y1 * (b - a) + y2 * a) / b - 3,
186  (x1 * (b - a) + x2 * a) / b + 5, (y1 * (b - a) + y2 * a) / b + 5);
187  break;
188  case 4:
189  for(a = 0; a <= b; a++)
190  Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - 2, (y1 * (b - a) + y2 * a) / b - 2,
191  (x1 * (b - a) + x2 * a) / b + 3, (y1 * (b - a) + y2 * a) / b + 3);
192  break;
193  case 5:
194  for(a = 0; a <= b; a++)
195  Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - 1, (y1 * (b - a) + y2 * a) / b - 1,
196  (x1 * (b - a) + x2 * a) / b + 1, (y1 * (b - a) + y2 * a) / b + 1);
197  break;
198  case 6:
199  case 7:
200  case 8:
201  case 9:
202  case 10:
203  case 11:
204  {
205  POINT offsTop[] = {{4, -3}, {2, -2}, {0, 0},
206  {-3, -3}, {-2, -2}, {-1, 0}};
207  POINT offsBtm[] = {{-3, 4}, {-2, 2}, {-1, 1},
208  {4, 4}, {2, 2}, {0, 1}};
209  LONG idx = style - 6;
210  POINT pts[4];
211  pts[0].x = x1 + offsTop[idx].x;
212  pts[0].y = y1 + offsTop[idx].y;
213  pts[1].x = x1 + offsBtm[idx].x;
214  pts[1].y = y1 + offsBtm[idx].y;
215  pts[2].x = x2 + offsBtm[idx].x;
216  pts[2].y = y2 + offsBtm[idx].y;
217  pts[3].x = x2 + offsTop[idx].x;
218  pts[3].y = y2 + offsTop[idx].y;
219  Polygon(hdc, pts, 4);
220  break;
221  }
222  }
223  DeleteObject(SelectObject(hdc, oldBrush));
224  DeleteObject(SelectObject(hdc, oldPen));
225 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define abs(i)
Definition: fconv.c:206
#define max(a, b)
Definition: svc.c:63
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
long y
Definition: polytest.cpp:48
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
long x
Definition: polytest.cpp:48
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:584
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
#define a
Definition: ke_i.h:78
unsigned int idx
Definition: utils.c:41
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
Arabic default style
Definition: afstyles.h:93

◆ Ellp()

void Ellp ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  fg,
COLORREF  bg,
int  thickness,
int  style 
)

Definition at line 40 of file drawing.cpp.

Referenced by endPaintingL(), endPaintingR(), whilePaintingL(), and whilePaintingR().

41 {
42  HBRUSH oldBrush;
43  LOGBRUSH logbrush;
44  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
45  logbrush.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
46  logbrush.lbColor = (style == 2) ? fg : bg;
47  logbrush.lbHatch = 0;
48  oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
49  Ellipse(hdc, x1, y1, x2, y2);
50  DeleteObject(SelectObject(hdc, oldBrush));
51  DeleteObject(SelectObject(hdc, oldPen));
52 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
UINT lbStyle
Definition: wingdi.h:1724
ULONG_PTR lbHatch
Definition: wingdi.h:1726
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PS_SOLID
Definition: wingdi.h:584
HDC hdc
Definition: msvc.h:53
COLORREF lbColor
Definition: wingdi.h:1725
#define BS_HOLLOW
Definition: wingdi.h:1069
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
#define BS_SOLID
Definition: wingdi.h:1067
Arabic default style
Definition: afstyles.h:93

◆ Erase()

void Erase ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  color,
LONG  radius 
)

Definition at line 117 of file drawing.cpp.

Referenced by endPaintingL(), IntBeginPaint(), startPaintingL(), and whilePaintingL().

118 {
119  LONG a, b;
120  HPEN oldPen;
121  HBRUSH oldBrush = (HBRUSH) SelectObject(hdc, CreateSolidBrush(color));
122 
123  b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
124  oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
125  for(a = 0; a <= b; a++)
126  Rectangle(hdc, (x1 * (b - a) + x2 * a) / b - radius + 1,
127  (y1 * (b - a) + y2 * a) / b - radius + 1, (x1 * (b - a) + x2 * a) / b + radius + 1,
128  (y1 * (b - a) + y2 * a) / b + radius + 1);
129  DeleteObject(SelectObject(hdc, oldBrush));
130  DeleteObject(SelectObject(hdc, oldPen));
131 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define abs(i)
Definition: fconv.c:206
#define max(a, b)
Definition: svc.c:63
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PS_SOLID
Definition: wingdi.h:584
long LONG
Definition: pedump.c:60
GLuint color
Definition: glext.h:6243
#define a
Definition: ke_i.h:78
HDC hdc
Definition: msvc.h:53
#define b
Definition: ke_i.h:79
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706

◆ Fill()

void Fill ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  color 
)

Definition at line 109 of file drawing.cpp.

Referenced by DIB_24BPP_HLine(), RtlFillMemoryUlong(), startPaintingL(), and startPaintingR().

110 {
111  HBRUSH oldBrush = (HBRUSH) SelectObject(hdc, CreateSolidBrush(color));
113  DeleteObject(SelectObject(hdc, oldBrush));
114 }
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
INT INT y
Definition: msvc.h:62
GLuint color
Definition: glext.h:6243
HDC hdc
Definition: msvc.h:53
#define FLOODFILLSURFACE
Definition: wingdi.h:643
INT x
Definition: msvc.h:62
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI ExtFloodFill(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF, _In_ UINT)

◆ Line()

void Line ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  color,
int  thickness 
)

Definition at line 16 of file drawing.cpp.

17 {
18  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
19  MoveToEx(hdc, x1, y1, NULL);
20  LineTo(hdc, x2, y2);
21  DeleteObject(SelectObject(hdc, oldPen));
22 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:584
GLuint color
Definition: glext.h:6243
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706

◆ Poly()

void Poly ( HDC  hdc,
POINT lpPoints,
int  nCount,
COLORREF  fg,
COLORREF  bg,
int  thickness,
int  style,
BOOL  closed,
BOOL  inverted 
)

Definition at line 70 of file drawing.cpp.

Referenced by SelectionModel::CalculateBoundingBoxAndContents(), SelectionModel::DrawBackgroundPoly(), SelectionModel::DrawFramePoly(), endPaintingL(), endPaintingR(), startPaintingL(), startPaintingR(), whilePaintingL(), and whilePaintingR().

71 {
72  LOGBRUSH logbrush;
73  HBRUSH oldBrush;
74  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
75  UINT oldRop = GetROP2(hdc);
76 
77  if (inverted)
79 
80  logbrush.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
81  logbrush.lbColor = (style == 2) ? fg : bg;
82  logbrush.lbHatch = 0;
83  oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
84  if (closed)
85  Polygon(hdc, lpPoints, nCount);
86  else
87  Polyline(hdc, lpPoints, nCount);
88  DeleteObject(SelectObject(hdc, oldBrush));
89  DeleteObject(SelectObject(hdc, oldPen));
90 
91  SetROP2(hdc, oldRop);
92 }
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
UINT lbStyle
Definition: wingdi.h:1724
ULONG_PTR lbHatch
Definition: wingdi.h:1726
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PS_SOLID
Definition: wingdi.h:584
int WINAPI SetROP2(_In_ HDC, _In_ int)
Definition: dc.c:1083
HDC hdc
Definition: msvc.h:53
COLORREF lbColor
Definition: wingdi.h:1725
unsigned int UINT
Definition: ndis.h:50
#define BS_HOLLOW
Definition: wingdi.h:1069
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
int WINAPI GetROP2(_In_ HDC)
Definition: dc.c:1062
BOOL WINAPI Polyline(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ int cpt)
#define R2_NOTXORPEN
Definition: wingdi.h:349
#define BS_SOLID
Definition: wingdi.h:1067
Arabic default style
Definition: afstyles.h:93

◆ Rect()

void Rect ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  fg,
COLORREF  bg,
int  thickness,
int  style 
)

Definition at line 25 of file drawing.cpp.

Referenced by Text().

26 {
27  HBRUSH oldBrush;
28  LOGBRUSH logbrush;
29  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
30  logbrush.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
31  logbrush.lbColor = (style == 2) ? fg : bg;
32  logbrush.lbHatch = 0;
33  oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
34  Rectangle(hdc, x1, y1, x2, y2);
35  DeleteObject(SelectObject(hdc, oldBrush));
36  DeleteObject(SelectObject(hdc, oldPen));
37 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
UINT lbStyle
Definition: wingdi.h:1724
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
ULONG_PTR lbHatch
Definition: wingdi.h:1726
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PS_SOLID
Definition: wingdi.h:584
HDC hdc
Definition: msvc.h:53
COLORREF lbColor
Definition: wingdi.h:1725
#define BS_HOLLOW
Definition: wingdi.h:1069
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
#define BS_SOLID
Definition: wingdi.h:1067
Arabic default style
Definition: afstyles.h:93

◆ RectSel()

void RectSel ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2 
)

Definition at line 228 of file drawing.cpp.

Referenced by whilePaintingL().

229 {
230  HBRUSH oldBrush;
231  LOGBRUSH logbrush;
232  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_DOT, 1, 0x00000000));
233  UINT oldRop = GetROP2(hdc);
234 
236 
237  logbrush.lbStyle = BS_HOLLOW;
238  logbrush.lbColor = 0;
239  logbrush.lbHatch = 0;
240  oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
241  Rectangle(hdc, x1, y1, x2, y2);
242  DeleteObject(SelectObject(hdc, oldBrush));
243  DeleteObject(SelectObject(hdc, oldPen));
244 
245  SetROP2(hdc, oldRop);
246 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
UINT lbStyle
Definition: wingdi.h:1724
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
ULONG_PTR lbHatch
Definition: wingdi.h:1726
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int WINAPI SetROP2(_In_ HDC, _In_ int)
Definition: dc.c:1083
HDC hdc
Definition: msvc.h:53
COLORREF lbColor
Definition: wingdi.h:1725
unsigned int UINT
Definition: ndis.h:50
#define BS_HOLLOW
Definition: wingdi.h:1069
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
int WINAPI GetROP2(_In_ HDC)
Definition: dc.c:1062
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
#define PS_DOT
Definition: wingdi.h:586
#define R2_NOTXORPEN
Definition: wingdi.h:349

◆ Replace()

void Replace ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  fg,
COLORREF  bg,
LONG  radius 
)

Definition at line 134 of file drawing.cpp.

Referenced by COMDLG32_FR_HandleWMCommand(), endPaintingR(), startPaintingR(), UDFHardLink(), UDFReadFileLocation__(), UDFRename(), and whilePaintingR().

135 {
136  LONG a, b, x, y;
137  b = max(1, max(abs(x2 - x1), abs(y2 - y1)));
138 
139  for(a = 0; a <= b; a++)
140  for(y = (y1 * (b - a) + y2 * a) / b - radius + 1;
141  y < (y1 * (b - a) + y2 * a) / b + radius + 1; y++)
142  for(x = (x1 * (b - a) + x2 * a) / b - radius + 1;
143  x < (x1 * (b - a) + x2 * a) / b + radius + 1; x++)
144  if (GetPixel(hdc, x, y) == fg)
145  SetPixel(hdc, x, y, bg);
146 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define abs(i)
Definition: fconv.c:206
#define max(a, b)
Definition: svc.c:63
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
INT INT y
Definition: msvc.h:62
long LONG
Definition: pedump.c:60
#define a
Definition: ke_i.h:78
HDC hdc
Definition: msvc.h:53
#define b
Definition: ke_i.h:79
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
INT x
Definition: msvc.h:62
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706

◆ RRect()

void RRect ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  fg,
COLORREF  bg,
int  thickness,
int  style 
)

Definition at line 55 of file drawing.cpp.

Referenced by endPaintingL(), endPaintingR(), whilePaintingL(), and whilePaintingR().

56 {
57  LOGBRUSH logbrush;
58  HBRUSH oldBrush;
59  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg));
60  logbrush.lbStyle = (style == 0) ? BS_HOLLOW : BS_SOLID;
61  logbrush.lbColor = (style == 2) ? fg : bg;
62  logbrush.lbHatch = 0;
63  oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
64  RoundRect(hdc, x1, y1, x2, y2, 16, 16);
65  DeleteObject(SelectObject(hdc, oldBrush));
66  DeleteObject(SelectObject(hdc, oldPen));
67 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
UINT lbStyle
Definition: wingdi.h:1724
ULONG_PTR lbHatch
Definition: wingdi.h:1726
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PS_SOLID
Definition: wingdi.h:584
BOOL WINAPI RoundRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
HDC hdc
Definition: msvc.h:53
COLORREF lbColor
Definition: wingdi.h:1725
#define BS_HOLLOW
Definition: wingdi.h:1069
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
#define BS_SOLID
Definition: wingdi.h:1067
Arabic default style
Definition: afstyles.h:93

◆ SelectionFrame()

void SelectionFrame ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
DWORD  system_selection_color 
)

Definition at line 249 of file drawing.cpp.

Referenced by CSelectionWindow::OnPaint().

250 {
251  HBRUSH oldBrush;
252  LOGBRUSH logbrush;
253  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_DOT, 1, system_selection_color));
254 
255  logbrush.lbStyle = BS_HOLLOW;
256  logbrush.lbColor = 0;
257  logbrush.lbHatch = 0;
258  oldBrush = (HBRUSH) SelectObject(hdc, CreateBrushIndirect(&logbrush));
259  Rectangle(hdc, x1, y1, x2, y2); /* SEL BOX FRAME */
260  DeleteObject(SelectObject(hdc, oldBrush));
261  DeleteObject(SelectObject(hdc, oldPen));
262  oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_SOLID, 1, system_selection_color));
263  oldBrush = (HBRUSH) SelectObject(hdc, CreateSolidBrush(system_selection_color));
264  Rectangle(hdc, x1 - 1, y1 - 1, x1 + 2, y1 + 2);
265  Rectangle(hdc, x2 - 2, y1 - 1, x2 + 2, y1 + 2);
266  Rectangle(hdc, x1 - 1, y2 - 2, x1 + 2, y2 + 1);
267  Rectangle(hdc, x2 - 2, y2 - 2, x2 + 2, y2 + 1);
268  Rectangle(hdc, (x1 + x2) / 2 - 1, y1 - 1, (x1 + x2) / 2 + 2, y1 + 2);
269  Rectangle(hdc, (x1 + x2) / 2 - 1, y2 - 2, (x1 + x2) / 2 + 2, y2 + 1);
270  Rectangle(hdc, x1 - 1, (y1 + y2) / 2 - 1, x1 + 2, (y1 + y2) / 2 + 2);
271  Rectangle(hdc, x2 - 2, (y1 + y2) / 2 - 1, x2 + 1, (y1 + y2) / 2 + 2);
272  DeleteObject(SelectObject(hdc, oldBrush));
273  DeleteObject(SelectObject(hdc, oldPen));
274 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
UINT lbStyle
Definition: wingdi.h:1724
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
ULONG_PTR lbHatch
Definition: wingdi.h:1726
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define PS_SOLID
Definition: wingdi.h:584
HDC hdc
Definition: msvc.h:53
COLORREF lbColor
Definition: wingdi.h:1725
#define BS_HOLLOW
Definition: wingdi.h:1069
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
HBRUSH WINAPI CreateBrushIndirect(_In_ const LOGBRUSH *plb)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
#define PS_DOT
Definition: wingdi.h:586

◆ Text()

void Text ( HDC  hdc,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
COLORREF  fg,
COLORREF  bg,
LPCTSTR  lpchText,
HFONT  font,
LONG  style 
)

Definition at line 277 of file drawing.cpp.

278 {
279  HFONT oldFont;
280  RECT rect = {x1, y1, x2, y2};
281  COLORREF oldColor;
282  COLORREF oldBkColor;
283  int oldBkMode;
284  oldFont = (HFONT) SelectObject(hdc, font);
285  oldColor = SetTextColor(hdc, fg);
286  oldBkColor = SetBkColor(hdc, bg);
287  oldBkMode = SetBkMode(hdc, TRANSPARENT);
288  if (style == 0)
289  Rect(hdc, x1, y1, x2, y2, bg, bg, 1, 2);
290  DrawText(hdc, lpchText, -1, &rect, DT_EDITCONTROL);
291  SelectObject(hdc, oldFont);
292  SetTextColor(hdc, oldColor);
293  SetBkColor(hdc, oldBkColor);
294  SetBkMode(hdc, oldBkMode);
295 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
Definition: mk_font.cpp:20
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
& rect
Definition: startmenu.cpp:1413
#define DrawText
Definition: winuser.h:5637
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1032
#define TRANSPARENT
Definition: wingdi.h:948
HDC hdc
Definition: msvc.h:53
void Rect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:25
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:784
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
Arabic default style
Definition: afstyles.h:93
DWORD COLORREF
Definition: windef.h:290
#define DT_EDITCONTROL
Definition: winuser.h:528