Added SetWindowOrgEx and SetViewportOrgEx
[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 HDC
11 STDCALL
12 CreateDCA (
13 LPCSTR lpszDriver,
14 LPCSTR lpszDevice,
15 LPCSTR lpszOutput,
16 CONST DEVMODEA * lpInitData
17 )
18 {
19 ANSI_STRING DriverA, DeviceA, OutputA;
20 UNICODE_STRING DriverU, DeviceU, OutputU;
21 HDC hDC;
22 DEVMODEW *lpInitDataW;
23
24 /*
25 * If needed, convert to Unicode
26 * any string parameter.
27 */
28
29 if (NULL != lpszDriver)
30 {
31 RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver);
32 RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE);
33 } else
34 DriverU.Buffer = NULL;
35 if (NULL != lpszDevice)
36 {
37 RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice);
38 RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE);
39 } else
40 DeviceU.Buffer = NULL;
41 if (NULL != lpszOutput)
42 {
43 RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput);
44 RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE);
45 } else
46 OutputU.Buffer = NULL;
47
48 if (NULL != lpInitData)
49 {
50 // lpInitDataW = HeapAllocMem(
51 } else
52 lpInitDataW = NULL;
53
54 /*
55 * Call the Unicode version
56 * of CreateDC.
57 */
58
59 hDC = CreateDCW (
60 DriverU.Buffer,
61 DeviceU.Buffer,
62 OutputU.Buffer,
63 NULL);
64 // lpInitDataW);
65 /*
66 * Free Unicode parameters.
67 */
68 RtlFreeUnicodeString(&DriverU);
69 RtlFreeUnicodeString(&DeviceU);
70 RtlFreeUnicodeString(&OutputU);
71
72 /*
73 * Return the possible DC handle.
74 */
75
76 return hDC;
77 }
78
79 HDC
80 STDCALL
81 CreateDCW (
82 LPCWSTR lpwszDriver,
83 LPCWSTR lpwszDevice,
84 LPCWSTR lpwszOutput,
85 CONST DEVMODEW * lpInitData
86 )
87 {
88 return W32kCreateDC (
89 lpwszDriver,
90 lpwszDevice,
91 lpwszOutput,
92 (PDEVMODEW)lpInitData
93 );
94 }
95
96 BOOL STDCALL DeleteDC( HDC hDC )
97 {
98 return W32kDeleteDC( hDC );
99 }
100
101
102 HDC
103 STDCALL
104 CreateCompatibleDC(
105 HDC hDC
106 )
107 {
108 return W32kCreateCompatableDC(hDC);
109 }
110
111 HGDIOBJ
112 STDCALL
113 SelectObject(
114 HDC hDC,
115 HGDIOBJ hGDIObj
116 )
117 {
118 return W32kSelectObject(hDC, hGDIObj);
119 }
120
121 int
122 STDCALL
123 SetMapMode(
124 HDC a0,
125 int a1
126 )
127 {
128 return W32kSetMapMode( a0, a1 );
129 }
130
131 BOOL
132 STDCALL
133 SetViewportOrgEx(
134 HDC a0,
135 int a1,
136 int a2,
137 LPPOINT a3
138 )
139 {
140 return W32kSetViewportOrgEx( a0, a1, a2, a3 );
141 }
142
143 BOOL
144 STDCALL
145 SetWindowOrgEx(
146 HDC a0,
147 int a1,
148 int a2,
149 LPPOINT a3
150 )
151 {
152 return W32kSetWindowOrgEx( a0, a1, a2, a3 );
153 }