reshuffling of dlls
[reactos.git] / reactos / dll / win32 / gdi32 / objects / metafile.c
1 #include "precomp.h"
2
3 /*
4 * @implemented
5 */
6 HMETAFILE
7 STDCALL
8 CopyMetaFileW(
9 HMETAFILE hmfSrc,
10 LPCWSTR lpszFile
11 )
12 {
13 return NtGdiCopyMetaFile (hmfSrc, lpszFile);
14 }
15
16
17 /*
18 * @implemented
19 */
20 HMETAFILE
21 STDCALL
22 CopyMetaFileA(
23 HMETAFILE hmfSrc,
24 LPCSTR lpszFile
25 )
26 {
27 NTSTATUS Status;
28 PWSTR lpszFileW;
29 HMETAFILE rc = 0;
30
31 Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
32 if (!NT_SUCCESS (Status))
33 SetLastError (RtlNtStatusToDosError(Status));
34 else
35 {
36 rc = NtGdiCopyMetaFile ( hmfSrc, lpszFileW );
37
38 HEAP_free ( lpszFileW );
39 }
40
41 return rc;
42 }
43
44
45 /*
46 * @implemented
47 */
48 HDC
49 STDCALL
50 CreateMetaFileW(
51 LPCWSTR lpszFile
52 )
53 {
54 return NtGdiCreateMetaFile ( lpszFile );
55 }
56
57
58 /*
59 * @implemented
60 */
61 HDC
62 STDCALL
63 CreateMetaFileA(
64 LPCSTR lpszFile
65 )
66 {
67 NTSTATUS Status;
68 PWSTR lpszFileW;
69 HDC rc = 0;
70
71 Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
72 if (!NT_SUCCESS (Status))
73 SetLastError (RtlNtStatusToDosError(Status));
74 else
75 {
76 rc = NtGdiCreateMetaFile ( lpszFileW );
77
78 HEAP_free ( lpszFileW );
79 }
80 return rc;
81 }
82
83
84 /*
85 * @implemented
86 */
87 HMETAFILE
88 STDCALL
89 GetMetaFileW(
90 LPCWSTR lpszMetaFile
91 )
92 {
93 return NtGdiGetMetaFile ( lpszMetaFile );
94 }
95
96
97 /*
98 * @implemented
99 */
100 HMETAFILE
101 STDCALL
102 GetMetaFileA(
103 LPCSTR lpszMetaFile
104 )
105 {
106 NTSTATUS Status;
107 LPWSTR lpszMetaFileW;
108 HMETAFILE rc = 0;
109
110 Status = HEAP_strdupA2W ( &lpszMetaFileW, lpszMetaFile );
111 if (!NT_SUCCESS (Status))
112 SetLastError (RtlNtStatusToDosError(Status));
113 else
114 {
115 rc = NtGdiGetMetaFile ( lpszMetaFileW );
116
117 HEAP_free ( lpszMetaFileW );
118 }
119
120 return rc;
121 }
122
123
124 /*
125 * @implemented
126 */
127 HENHMETAFILE
128 STDCALL
129 CopyEnhMetaFileW(
130 HENHMETAFILE hemfSrc,
131 LPCWSTR lpszFile
132 )
133 {
134 return NtGdiCopyEnhMetaFile ( hemfSrc, lpszFile );
135 }
136
137
138 /*
139 * @implemented
140 */
141 HENHMETAFILE
142 STDCALL
143 CopyEnhMetaFileA(
144 HENHMETAFILE hemfSrc,
145 LPCSTR lpszFile
146 )
147 {
148 NTSTATUS Status;
149 LPWSTR lpszFileW;
150 HENHMETAFILE rc = 0;
151
152 Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
153 if (!NT_SUCCESS (Status))
154 SetLastError (RtlNtStatusToDosError(Status));
155 else
156 {
157 rc = NtGdiCopyEnhMetaFile ( hemfSrc, lpszFileW );
158
159 HEAP_free ( lpszFileW );
160 }
161 return rc;
162 }
163
164
165 /*
166 * @implemented
167 */
168 HDC
169 STDCALL
170 CreateEnhMetaFileW(
171 HDC hdcRef,
172 LPCWSTR lpFileName,
173 CONST RECT *lpRect,
174 LPCWSTR lpDescription
175 )
176 {
177 return NtGdiCreateEnhMetaFile ( hdcRef, lpFileName, (CONST LPRECT)lpRect, lpDescription );
178 }
179
180
181 /*
182 * @implemented
183 */
184 HDC
185 STDCALL
186 CreateEnhMetaFileA(
187 HDC hdcRef,
188 LPCSTR lpFileName,
189 CONST RECT *lpRect,
190 LPCSTR lpDescription
191 )
192 {
193 NTSTATUS Status;
194 LPWSTR lpFileNameW, lpDescriptionW;
195 HDC rc = 0;
196
197 Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
198 if (!NT_SUCCESS (Status))
199 SetLastError (RtlNtStatusToDosError(Status));
200 else
201 {
202 Status = HEAP_strdupA2W ( &lpDescriptionW, lpDescription );
203 if (!NT_SUCCESS (Status))
204 SetLastError (RtlNtStatusToDosError(Status));
205 else
206 {
207 rc = NtGdiCreateEnhMetaFile (
208 hdcRef, lpFileNameW, (CONST LPRECT)lpRect, lpDescriptionW );
209
210 HEAP_free ( lpDescriptionW );
211 }
212 HEAP_free ( lpFileNameW );
213 }
214
215 return rc;
216 }
217
218 /*
219 * @implemented
220 */
221 HENHMETAFILE
222 STDCALL
223 GetEnhMetaFileW(
224 LPCWSTR lpszMetaFile
225 )
226 {
227 return NtGdiGetEnhMetaFile ( lpszMetaFile );
228 }
229
230
231 /*
232 * @implemented
233 */
234 HENHMETAFILE
235 STDCALL
236 GetEnhMetaFileA(
237 LPCSTR lpszMetaFile
238 )
239 {
240 NTSTATUS Status;
241 LPWSTR lpszMetaFileW;
242 HENHMETAFILE rc = 0;
243
244 Status = HEAP_strdupA2W ( &lpszMetaFileW, lpszMetaFile );
245 if (!NT_SUCCESS (Status))
246 SetLastError (RtlNtStatusToDosError(Status));
247 else
248 {
249 rc = NtGdiGetEnhMetaFile ( lpszMetaFileW );
250
251 HEAP_free ( lpszMetaFileW );
252 }
253
254 return rc;
255 }
256
257
258 /*
259 * @implemented
260 */
261 UINT
262 STDCALL
263 GetEnhMetaFileDescriptionW(
264 HENHMETAFILE hemf,
265 UINT cchBuffer,
266 LPWSTR lpszDescription
267 )
268 {
269 return NtGdiGetEnhMetaFileDescription ( hemf, cchBuffer, lpszDescription );
270 }
271
272
273 /*
274 * @implemented
275 */
276 UINT
277 STDCALL
278 GetEnhMetaFileDescriptionA(
279 HENHMETAFILE hemf,
280 UINT cchBuffer,
281 LPSTR lpszDescription
282 )
283 {
284 NTSTATUS Status;
285 LPWSTR lpszDescriptionW;
286 UINT rc;
287
288 if ( lpszDescription && cchBuffer )
289 {
290 lpszDescriptionW = (LPWSTR)HEAP_alloc ( cchBuffer*sizeof(WCHAR) );
291 if ( !lpszDescriptionW )
292 {
293 SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
294 return 0;
295 }
296 }
297 else
298 lpszDescriptionW = NULL;
299
300 rc = NtGdiGetEnhMetaFileDescription ( hemf, cchBuffer, lpszDescriptionW );
301
302 if ( lpszDescription && cchBuffer )
303 {
304 Status = RtlUnicodeToMultiByteN ( lpszDescription,
305 cchBuffer,
306 NULL,
307 lpszDescriptionW,
308 cchBuffer );
309 HEAP_free ( lpszDescriptionW );
310 if ( !NT_SUCCESS(Status) )
311 {
312 SetLastError (RtlNtStatusToDosError(Status));
313 return 0;
314 }
315 }
316
317 return rc;
318 }
319