62c0f2075a62ddc6757e5692683fb959fb5aad56
[reactos.git] / 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 DWORD
15 STDCALL
16 GetObjectType(
17         HGDIOBJ         a0
18         )
19 {
20         return NtGdiGetObjectType(a0);
21 }
22
23
24
25 /*
26  * @implemented
27  */
28 BOOL
29 STDCALL
30 DPtoLP(
31         HDC     a0,
32         LPPOINT a1,
33         int     a2
34         )
35 {
36         return NtGdiDPtoLP(a0, a1, a2);
37 }
38
39
40 /*
41  * @implemented
42  */
43 COLORREF
44 STDCALL
45 SetBkColor(
46         HDC             a0,
47         COLORREF        a1
48         )
49 {
50         return NtGdiSetBkColor(a0, a1);
51 }
52
53
54 /*
55  * @implemented
56  */
57 int
58 STDCALL
59 GetGraphicsMode(
60         HDC     a0
61         )
62 {
63         return NtGdiGetGraphicsMode(a0);
64 }
65
66
67 /*
68  * @implemented
69  */
70 int
71 STDCALL
72 SetGraphicsMode(
73         HDC     hdc,
74         int     iMode
75         )
76 {
77         return NtGdiSetGraphicsMode(hdc, iMode);
78 }
79
80
81 /*
82  * @implemented
83  */
84 int
85 STDCALL
86 GetMapMode(
87         HDC     a0
88         )
89 {
90         return NtGdiGetMapMode(a0);
91 }
92
93 /*
94  * @implemented
95  */
96 BOOL
97 STDCALL
98 GetCurrentPositionEx(
99         HDC     a0,
100         LPPOINT a1
101         )
102 {
103         return NtGdiGetCurrentPositionEx(a0, a1);
104 }
105
106
107 /*
108  * @implemented
109  */
110 COLORREF
111 STDCALL
112 GetBkColor(
113         HDC     a0
114         )
115 {
116         return NtGdiGetBkColor(a0);
117 }
118
119
120 /*
121  * @implemented
122  */
123 int
124 STDCALL
125 GetBkMode(
126         HDC     a0
127         )
128 {
129         return NtGdiGetBkMode(a0);
130 }
131
132 /*
133  * @implemented
134  */
135 BOOL
136 STDCALL
137 GetBrushOrgEx(
138         HDC     a0,
139         LPPOINT a1
140         )
141 {
142         return NtGdiGetBrushOrgEx(a0, a1);
143 }
144
145
146 /*
147  * @implemented
148  */
149 int
150 STDCALL
151 GetROP2(
152         HDC     a0
153         )
154 {
155         return NtGdiGetROP2(a0);
156
157 }
158
159
160 /*
161  * @implemented
162  */
163 int
164 STDCALL
165 GetStretchBltMode(
166         HDC     a0
167         )
168 {
169         return NtGdiGetStretchBltMode(a0);
170
171 }
172
173
174
175 /*
176  * @implemented
177  */
178 UINT
179 STDCALL
180 GetTextAlign(
181         HDC     hDc
182         )
183 {
184         return NtGdiGetTextAlign(hDc);
185
186 }
187
188
189 /*
190  * @implemented
191  */
192 COLORREF
193 STDCALL
194 GetTextColor(
195         HDC     hDc
196         )
197 {
198         return NtGdiGetTextColor(hDc);
199
200 }
201
202
203 /*
204  * @implemented
205  */
206 BOOL
207 STDCALL
208 GetViewportExtEx(
209         HDC     hDc,
210         LPSIZE  lpSize
211         )
212 {
213         return NtGdiGetViewportExtEx(hDc, lpSize);
214
215 }
216
217
218 /*
219  * @implemented
220  */
221 BOOL
222 STDCALL
223 GetViewportOrgEx(
224         HDC             hDc,
225         LPPOINT         lpPoint
226         )
227 {
228         return NtGdiGetViewportOrgEx(hDc, lpPoint);
229
230 }
231
232
233 /*
234  * @implemented
235  */
236 BOOL
237 STDCALL
238 GetWindowExtEx(
239         HDC             hDc,
240         LPSIZE          lpSize
241         )
242 {
243         return NtGdiGetWindowExtEx(hDc, lpSize);
244 }
245
246
247 /*
248  * @implemented
249  */
250 BOOL
251 STDCALL
252 GetWindowOrgEx(
253         HDC             hDc,
254         LPPOINT         lpPoint
255         )
256 {
257         return NtGdiGetWindowOrgEx(hDc, lpPoint);
258 }
259
260
261 /*
262  * @implemented
263  */
264 int
265 STDCALL
266 SetBkMode(
267         HDC     a0,
268         int     a1
269         )
270 {
271         return NtGdiSetBkMode(a0, a1);
272
273 }
274
275
276 /*
277  * @implemented
278  */
279 int
280 STDCALL
281 SetROP2(
282         HDC     a0,
283         int     a1
284         )
285 {
286         return NtGdiSetROP2(a0, a1);
287 }
288
289
290 /*
291  * @implemented
292  */
293 int
294 STDCALL
295 SetStretchBltMode(
296         HDC     a0,
297         int     a1
298         )
299 {
300         return NtGdiSetStretchBltMode(a0, a1);
301
302 }
303
304
305 /*
306  * @implemented
307  */
308 DWORD
309 STDCALL
310 GetRelAbs(
311          HDC  a0,
312          DWORD a1
313            )
314 {
315         return NtGdiGetRelAbs(a0);
316
317 }
318
319
320 /*
321  * @implemented
322  */
323 HGDIOBJ STDCALL
324 GetStockObject(int Index)
325 {
326   return(NtGdiGetStockObject(Index));
327 }
328
329
330 /*
331  * @implemented
332  */
333 int STDCALL
334 GetClipBox(HDC hDc, LPRECT Rect)
335 {
336   return(NtGdiGetClipBox(hDc, Rect));
337 }
338
339
340 /*
341  * @implemented
342  */
343 int
344 STDCALL
345 GetPolyFillMode(
346         HDC     a0
347         )
348 {
349         return NtGdiGetPolyFillMode(a0);
350 }
351
352
353 /*
354  * @implemented
355  */
356 HDC
357 STDCALL
358 CreateDCA (
359         LPCSTR          lpszDriver,
360         LPCSTR          lpszDevice,
361         LPCSTR          lpszOutput,
362         CONST DEVMODEA  * lpInitData
363         )
364 {
365         ANSI_STRING DriverA, DeviceA, OutputA;
366         UNICODE_STRING DriverU, DeviceU, OutputU;
367         HDC     hDC;
368         DEVMODEW *lpInitDataW;
369
370         /*
371          * If needed, convert to Unicode
372          * any string parameter.
373          */
374
375         if (NULL != lpszDriver)
376         {
377                 RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver);
378                 RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE);
379         } else
380                 DriverU.Buffer = NULL;
381         if (NULL != lpszDevice)
382         {
383                 RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice);
384                 RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE);
385         } else
386                 DeviceU.Buffer = NULL;
387         if (NULL != lpszOutput)
388         {
389                 RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput);
390                 RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE);
391         } else
392                 OutputU.Buffer = NULL;
393
394         if (NULL != lpInitData)
395         {
396 //              lpInitDataW = HeapAllocMem(
397         } else
398                 lpInitDataW = NULL;
399
400         /*
401          * Call the Unicode version
402          * of CreateDC.
403          */
404
405         hDC = CreateDCW (
406                 DriverU.Buffer,
407                 DeviceU.Buffer,
408                 OutputU.Buffer,
409                 NULL);
410 //              lpInitDataW);
411         /*
412          * Free Unicode parameters.
413          */
414         RtlFreeUnicodeString(&DriverU);
415         RtlFreeUnicodeString(&DeviceU);
416         RtlFreeUnicodeString(&OutputU);
417
418         /*
419          * Return the possible DC handle.
420          */
421
422         return hDC;
423 }
424
425
426 /*
427  * @implemented
428  */
429 HDC
430 STDCALL
431 CreateDCW (
432         LPCWSTR         lpwszDriver,
433         LPCWSTR         lpwszDevice,
434         LPCWSTR         lpwszOutput,
435         CONST DEVMODEW  * lpInitData
436         )
437 {
438         return NtGdiCreateDC (
439                         lpwszDriver,
440                         lpwszDevice,
441                         lpwszOutput,
442                         (PDEVMODEW)lpInitData
443                         );
444 }
445
446
447 /*
448  * @implemented
449  */
450 BOOL STDCALL DeleteDC( HDC hDC )
451 {
452   return NtGdiDeleteDC( hDC );
453 }
454
455
456 /*
457  * @implemented
458  */
459 HDC
460 STDCALL
461 CreateCompatibleDC(
462         HDC  hDC
463         )
464 {
465         return NtGdiCreateCompatableDC(hDC);
466 }
467
468
469 /*
470  * @implemented
471  */
472 HGDIOBJ
473 STDCALL
474 SelectObject(
475         HDC     hDC,
476         HGDIOBJ hGDIObj
477         )
478 {
479         return NtGdiSelectObject(hDC, hGDIObj);
480 }
481
482
483 /*
484  * @implemented
485  */
486 int
487 STDCALL
488 SetMapMode(
489         HDC     a0,
490         int     a1
491         )
492 {
493   return NtGdiSetMapMode( a0, a1 );
494 }
495
496
497 /*
498  * @implemented
499  */
500 BOOL
501 STDCALL
502 SetViewportOrgEx(
503         HDC     a0,
504         int     a1,
505         int     a2,
506         LPPOINT a3
507         )
508 {
509   return NtGdiSetViewportOrgEx( a0, a1, a2, a3 );
510 }
511
512
513 /*
514  * @implemented
515  */
516 BOOL
517 STDCALL
518 OffsetViewportOrgEx(
519         HDC     DC,
520         int     XOffset,
521         int     YOffset,
522         LPPOINT Point
523         )
524 {
525   return NtGdiOffsetViewportOrgEx(DC, XOffset, YOffset, Point);
526 }
527
528
529 /*
530  * @implemented
531  */
532 BOOL
533 STDCALL
534 SetWindowOrgEx(
535         HDC     a0,
536         int     a1,
537         int     a2,
538         LPPOINT a3
539         )
540 {
541   return NtGdiSetWindowOrgEx( a0, a1, a2, a3 );
542 }
543
544
545 /*
546  * @implemented
547  */
548 BOOL
549 STDCALL
550 DeleteObject(
551         HGDIOBJ         a0
552         )
553 {
554         return NtGdiDeleteObject(a0);
555 }
556
557
558 /*
559  * @implemented
560  */
561 HPALETTE
562 STDCALL
563 SelectPalette(
564         HDC             a0,
565         HPALETTE        a1,
566         BOOL            a2
567         )
568 {
569         return NtGdiSelectPalette( a0, a1,a2 );
570 }
571
572
573 /*
574  * @implemented
575  */
576 UINT
577 STDCALL
578 RealizePalette(
579         HDC     a0
580         )
581 {
582         return NtGdiRealizePalette( a0 );
583 }
584
585
586 /*
587  * @implemented
588  */
589 BOOL
590 STDCALL
591 LPtoDP(
592         HDC     a0,
593         LPPOINT a1,
594         int     a2
595         )
596 {
597         return NtGdiLPtoDP(a0, a1, a2);
598 }
599
600
601 /*
602  * @implemented
603  */
604 int
605 STDCALL
606 SetPolyFillMode(
607         HDC     a0,
608         int     a1
609         )
610 {
611         return NtGdiSetPolyFillMode(a0, a1);
612 }
613
614
615 /*
616  * @implemented
617  */
618 int
619 STDCALL
620 GetDeviceCaps(
621         HDC     DC,
622         int     Index
623         )
624 {
625         return NtGdiGetDeviceCaps(DC, Index);
626 }
627
628 /*
629  * @implemented
630  */
631 HPALETTE
632 STDCALL
633 CreatePalette(
634         CONST LOGPALETTE        *a0
635         )
636 {
637         return NtGdiCreatePalette((CONST PLOGPALETTE)a0);
638 }
639
640 /*
641  * @implemented
642  */
643 COLORREF
644 STDCALL
645 GetNearestColor(
646         HDC             a0,
647         COLORREF        a1
648         )
649 {
650         return NtGdiGetNearestColor(a0,a1);
651 }
652
653 /*
654  * @implemented
655  */
656 UINT
657 STDCALL
658 GetNearestPaletteIndex(
659         HPALETTE        a0,
660         COLORREF        a1
661         )
662 {
663         return NtGdiGetNearestPaletteIndex(a0,a1);
664 }
665
666 /*
667  * @implemented
668  */
669 UINT
670 STDCALL
671 GetPaletteEntries(
672         HPALETTE        a0,
673         UINT            a1,
674         UINT            a2,
675         LPPALETTEENTRY  a3
676         )
677 {
678         return NtGdiGetPaletteEntries(a0,a1,a2,a3);
679 }
680
681 /*
682  * @implemented
683  */
684 UINT
685 STDCALL
686 GetSystemPaletteEntries(
687         HDC             a0,
688         UINT            a1,
689         UINT            a2,
690         LPPALETTEENTRY  a3
691         )
692 {
693         return NtGdiGetSystemPaletteEntries(a0,a1,a2,a3);
694 }
695
696 /*
697  * @implemented
698  */
699 BOOL
700 STDCALL
701 RestoreDC(
702         HDC     a0,
703         int     a1
704         )
705 {
706         return NtGdiRestoreDC(a0,a1);
707 }
708
709
710 /*
711  * @implemented
712  */
713 int
714 STDCALL
715 SaveDC(
716         HDC     a0
717         )
718 {
719         return NtGdiSaveDC(a0);
720 }
721
722 /*
723  * @implemented
724  */
725 UINT
726 STDCALL
727 SetPaletteEntries(
728         HPALETTE                a0,
729         UINT                    a1,
730         UINT                    a2,
731         CONST PALETTEENTRY      *a3
732         )
733 {
734         return NtGdiSetPaletteEntries(a0,a1,a2,(CONST PPALETTEENTRY)a3);
735 }
736
737 /*
738  * @implemented
739  */
740 BOOL
741 STDCALL
742 GetWorldTransform(
743         HDC             hdc,
744         LPXFORM         a1
745         )
746 {
747         return NtGdiGetWorldTransform(hdc,a1);
748 }
749
750 /*
751  * @implemented
752  */
753 BOOL
754 STDCALL
755 SetWorldTransform(
756         HDC             a0,
757         CONST XFORM     *a1
758         )
759 {
760         return NtGdiSetWorldTransform(a0,(CONST PXFORM)a1);
761 }
762
763 /*
764  * @implemented
765  */
766 BOOL
767 STDCALL
768 ModifyWorldTransform(
769         HDC             a0,
770         CONST XFORM     *a1,
771         DWORD           a2
772         )
773 {
774         return NtGdiModifyWorldTransform(a0,(CONST PXFORM)a1,a2);
775 }
776
777 /*
778  * @implemented
779  */
780 BOOL
781 STDCALL
782 CombineTransform(
783         LPXFORM         a0,
784         CONST XFORM     *a1,
785         CONST XFORM     *a2
786         )
787 {
788         return NtGdiCombineTransform(a0,(CONST PXFORM)a1,(CONST PXFORM)a2);
789 }
790
791 /*
792  * @implemented
793  */
794 UINT
795 STDCALL
796 SetDIBColorTable(
797         HDC             hdc,
798         UINT            a1,
799         UINT            a2,
800         CONST RGBQUAD   *a3
801         )
802 {
803         return NtGdiSetDIBColorTable(hdc,a1,a2,(CONST PRGBQUAD)a3);
804 }
805
806 /*
807  * @implemented
808  */
809 HPALETTE
810 STDCALL
811 CreateHalftonePalette(
812         HDC     hdc
813         )
814 {
815         return NtGdiCreateHalftonePalette(hdc);
816 }
817
818 /*
819  * @implemented
820  */
821 BOOL
822 STDCALL
823 SetViewportExtEx(
824         HDC     a0,
825         int     a1,
826         int     a2,
827         LPSIZE  a3
828         )
829 {
830         return NtGdiSetViewportExtEx(a0,a1,a2,a3);
831 }
832
833 /*
834  * @implemented
835  */
836 BOOL
837 STDCALL
838 SetWindowExtEx(
839         HDC     a0,
840         int     a1,
841         int     a2,
842         LPSIZE  a3
843         )
844 {
845         return NtGdiSetWindowExtEx(a0,a1,a2,a3);
846 }
847
848 /*
849  * @implemented
850  */
851 BOOL
852 STDCALL
853 OffsetWindowOrgEx(
854         HDC     a0,
855         int     a1,
856         int     a2,
857         LPPOINT a3
858         )
859 {
860         return NtGdiOffsetWindowOrgEx(a0,a1,a2,a3);
861 }
862
863 /*
864  * @implemented
865  */
866 BOOL
867 STDCALL
868 SetBitmapDimensionEx(
869         HBITMAP a0,
870         int     a1,
871         int     a2,
872         LPSIZE  a3
873         )
874 {
875         return NtGdiSetBitmapDimensionEx(a0,a1,a2,a3);
876 }
877
878 /*
879  * @implemented
880  */
881 BOOL
882 STDCALL
883 GetDCOrgEx(
884         HDC     a0,
885         LPPOINT a1
886         )
887 {
888         return NtGdiGetDCOrgEx(a0,a1);
889 }