Implemented Unpluged DC code
[reactos.git] / reactos / lib / gdi32 / objects / dc.c
1 #ifdef UNICODE
2 #undef UNICODE
3 #endif
4
5 #undef WIN32_LEAN_AND_MEAN
6 #include <windows.h>
7 #include <ddk/ntddk.h>
8 #include <win32k/kapi.h>
9
10
11 /*
12 * @implemented
13 */
14 int
15 STDCALL
16 GetMapMode(
17 HDC a0
18 )
19 {
20 return W32kGetMapMode(a0);
21 }
22
23 /*
24 * @implemented
25 */
26 BOOL
27 STDCALL
28 GetCurrentPositionEx(
29 HDC a0,
30 LPPOINT a1
31 )
32 {
33 return W32kGetCurrentPositionEx(a0, a1);
34 }
35
36
37 /*
38 * @implemented
39 */
40 COLORREF
41 STDCALL
42 GetBkColor(
43 HDC a0
44 )
45 {
46 return W32kGetBkColor(a0);
47 }
48
49
50 /*
51 * @implemented
52 */
53 int
54 STDCALL
55 GetBkMode(
56 HDC a0
57 )
58 {
59 return W32kGetBkMode(a0);
60 }
61
62
63 /*
64 * @implemented
65 */
66 BOOL
67 STDCALL
68 GetBrushOrgEx(
69 HDC a0,
70 LPPOINT a1
71 )
72 {
73 return W32kGetBrushOrgEx(a0, a1);
74 }
75
76
77 /*
78 * @implemented
79 */
80 int
81 STDCALL
82 GetROP2(
83 HDC a0
84 )
85 {
86 return W32kGetROP2(a0);
87
88 }
89
90
91 /*
92 * @implemented
93 */
94 int
95 STDCALL
96 GetStretchBltMode(
97 HDC a0
98 )
99 {
100 return W32kGetStretchBltMode(a0);
101
102 }
103
104
105
106 /*
107 * @implemented
108 */
109 UINT
110 STDCALL
111 GetTextAlign(
112 HDC hDc
113 )
114 {
115 return W32kGetTextAlign(hDc);
116
117 }
118
119
120 /*
121 * @implemented
122 */
123 COLORREF
124 STDCALL
125 GetTextColor(
126 HDC hDc
127 )
128 {
129 return W32kGetTextColor(hDc);
130
131 }
132
133
134 /*
135 * @implemented
136 */
137 BOOL
138 STDCALL
139 GetViewportExtEx(
140 HDC hDc,
141 LPSIZE lpSize
142 )
143 {
144 return W32kGetViewportExtEx(hDc, lpSize);
145
146 }
147
148
149 /*
150 * @implemented
151 */
152 BOOL
153 STDCALL
154 GetViewportOrgEx(
155 HDC hDc,
156 LPPOINT lpPoint
157 )
158 {
159 return W32kGetViewportOrgEx(hDc, lpPoint);
160
161 }
162
163
164 /*
165 * @implemented
166 */
167 BOOL
168 STDCALL
169 GetWindowExtEx(
170 HDC hDc,
171 LPSIZE lpSize
172 )
173 {
174 return W32kGetWindowExtEx(hDc, lpSize);
175 }
176
177
178 /*
179 * @implemented
180 */
181 BOOL
182 STDCALL
183 GetWindowOrgEx(
184 HDC hDc,
185 LPPOINT lpPoint
186 )
187 {
188 return W32kGetWindowOrgEx(hDc, lpPoint);
189 }
190
191
192 /*
193 * @implemented
194 */
195 int
196 STDCALL
197 SetBkMode(
198 HDC a0,
199 int a1
200 )
201 {
202 return W32kSetBkMode(a0, a1);
203
204 }
205
206
207 /*
208 * @implemented
209 */
210 int
211 STDCALL
212 SetROP2(
213 HDC a0,
214 int a1
215 )
216 {
217 return W32kSetROP2(a0, a1);
218 }
219
220
221 /*
222 * @implemented
223 */
224 int
225 STDCALL
226 SetStretchBltMode(
227 HDC a0,
228 int a1
229 )
230 {
231 return W32kSetStretchBltMode(a0, a1);
232
233 }
234
235
236 /*
237 * @implemented
238 */
239 DWORD
240 STDCALL
241 GetRelAbs(
242 HDC a0,
243 DWORD a1
244 )
245 {
246 return W32kGetRelAbs(a0);
247
248 }
249
250
251 /*
252 * @implemented
253 */
254 HGDIOBJ STDCALL
255 GetStockObject(int Index)
256 {
257 return(W32kGetStockObject(Index));
258 }
259
260
261 /*
262 * @implemented
263 */
264 int STDCALL
265 GetClipBox(HDC hDc, LPRECT Rect)
266 {
267 return(W32kGetClipBox(hDc, Rect));
268 }
269
270
271 /*
272 * @implemented
273 */
274 int
275 STDCALL
276 GetPolyFillMode(
277 HDC a0
278 )
279 {
280 return W32kGetPolyFillMode(a0);
281 }
282
283
284 /*
285 * @implemented
286 */
287 HDC
288 STDCALL
289 CreateDCA (
290 LPCSTR lpszDriver,
291 LPCSTR lpszDevice,
292 LPCSTR lpszOutput,
293 CONST DEVMODEA * lpInitData
294 )
295 {
296 ANSI_STRING DriverA, DeviceA, OutputA;
297 UNICODE_STRING DriverU, DeviceU, OutputU;
298 HDC hDC;
299 DEVMODEW *lpInitDataW;
300
301 /*
302 * If needed, convert to Unicode
303 * any string parameter.
304 */
305
306 if (NULL != lpszDriver)
307 {
308 RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver);
309 RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE);
310 } else
311 DriverU.Buffer = NULL;
312 if (NULL != lpszDevice)
313 {
314 RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice);
315 RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE);
316 } else
317 DeviceU.Buffer = NULL;
318 if (NULL != lpszOutput)
319 {
320 RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput);
321 RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE);
322 } else
323 OutputU.Buffer = NULL;
324
325 if (NULL != lpInitData)
326 {
327 // lpInitDataW = HeapAllocMem(
328 } else
329 lpInitDataW = NULL;
330
331 /*
332 * Call the Unicode version
333 * of CreateDC.
334 */
335
336 hDC = CreateDCW (
337 DriverU.Buffer,
338 DeviceU.Buffer,
339 OutputU.Buffer,
340 NULL);
341 // lpInitDataW);
342 /*
343 * Free Unicode parameters.
344 */
345 RtlFreeUnicodeString(&DriverU);
346 RtlFreeUnicodeString(&DeviceU);
347 RtlFreeUnicodeString(&OutputU);
348
349 /*
350 * Return the possible DC handle.
351 */
352
353 return hDC;
354 }
355
356
357 /*
358 * @implemented
359 */
360 HDC
361 STDCALL
362 CreateDCW (
363 LPCWSTR lpwszDriver,
364 LPCWSTR lpwszDevice,
365 LPCWSTR lpwszOutput,
366 CONST DEVMODEW * lpInitData
367 )
368 {
369 return W32kCreateDC (
370 lpwszDriver,
371 lpwszDevice,
372 lpwszOutput,
373 (PDEVMODEW)lpInitData
374 );
375 }
376
377
378 /*
379 * @implemented
380 */
381 BOOL STDCALL DeleteDC( HDC hDC )
382 {
383 return W32kDeleteDC( hDC );
384 }
385
386
387 /*
388 * @implemented
389 */
390 HDC
391 STDCALL
392 CreateCompatibleDC(
393 HDC hDC
394 )
395 {
396 return W32kCreateCompatableDC(hDC);
397 }
398
399
400 /*
401 * @implemented
402 */
403 HGDIOBJ
404 STDCALL
405 SelectObject(
406 HDC hDC,
407 HGDIOBJ hGDIObj
408 )
409 {
410 return W32kSelectObject(hDC, hGDIObj);
411 }
412
413
414 /*
415 * @implemented
416 */
417 int
418 STDCALL
419 SetMapMode(
420 HDC a0,
421 int a1
422 )
423 {
424 return W32kSetMapMode( a0, a1 );
425 }
426
427
428 /*
429 * @implemented
430 */
431 BOOL
432 STDCALL
433 SetViewportOrgEx(
434 HDC a0,
435 int a1,
436 int a2,
437 LPPOINT a3
438 )
439 {
440 return W32kSetViewportOrgEx( a0, a1, a2, a3 );
441 }
442
443
444 /*
445 * @implemented
446 */
447 BOOL
448 STDCALL
449 OffsetViewportOrgEx(
450 HDC DC,
451 int XOffset,
452 int YOffset,
453 LPPOINT Point
454 )
455 {
456 return W32kOffsetViewportOrgEx(DC, XOffset, YOffset, Point);
457 }
458
459
460 /*
461 * @implemented
462 */
463 BOOL
464 STDCALL
465 SetWindowOrgEx(
466 HDC a0,
467 int a1,
468 int a2,
469 LPPOINT a3
470 )
471 {
472 return W32kSetWindowOrgEx( a0, a1, a2, a3 );
473 }
474
475
476 /*
477 * @implemented
478 */
479 BOOL
480 STDCALL
481 DeleteObject(
482 HGDIOBJ a0
483 )
484 {
485 return W32kDeleteObject(a0);
486 }
487
488
489 /*
490 * @implemented
491 */
492 HPALETTE
493 STDCALL
494 SelectPalette(
495 HDC a0,
496 HPALETTE a1,
497 BOOL a2
498 )
499 {
500 return W32kSelectPalette( a0, a1,a2 );
501 }
502
503
504 /*
505 * @implemented
506 */
507 UINT
508 STDCALL
509 RealizePalette(
510 HDC a0
511 )
512 {
513 return W32kRealizePalette( a0 );
514 }
515
516
517 /*
518 * @implemented
519 */
520 BOOL
521 STDCALL
522 LPtoDP(
523 HDC a0,
524 LPPOINT a1,
525 int a2
526 )
527 {
528 return W32kLPtoDP(a0, a1, a2);
529 }
530
531
532 /*
533 * @implemented
534 */
535 int
536 STDCALL
537 SetPolyFillMode(
538 HDC a0,
539 int a1
540 )
541 {
542 return W32kSetPolyFillMode(a0, a1);
543 }
544
545
546 /*
547 * @implemented
548 */
549 int
550 STDCALL
551 GetDeviceCaps(
552 HDC DC,
553 int Index
554 )
555 {
556 return W32kGetDeviceCaps(DC, Index);
557 }