1c2c66affSColin Finck #include <precomp.h>
2c2c66affSColin Finck
3c2c66affSColin Finck #define NDEBUG
4c2c66affSColin Finck #include <debug.h>
5c2c66affSColin Finck
6c2c66affSColin Finck /*
7c2c66affSColin Finck * @unimplemented
8c2c66affSColin Finck */
9*fc16259fSJames Tabor BOOL
10c2c66affSColin Finck WINAPI
IsValidEnhMetaRecord(PVOID pv0,PVOID pv1)11c2c66affSColin Finck IsValidEnhMetaRecord(
12*fc16259fSJames Tabor PVOID pv0,
13*fc16259fSJames Tabor PVOID pv1)
14c2c66affSColin Finck {
15c2c66affSColin Finck UNIMPLEMENTED;
16c2c66affSColin Finck SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
17*fc16259fSJames Tabor return FALSE;
18c2c66affSColin Finck }
19c2c66affSColin Finck
20c2c66affSColin Finck /*
21c2c66affSColin Finck * @unimplemented
22c2c66affSColin Finck */
23*fc16259fSJames Tabor BOOL
24c2c66affSColin Finck WINAPI
IsValidEnhMetaRecordOffExt(PVOID pv0,PVOID pv1,DWORD dwOffset,DWORD dwExtends)25c2c66affSColin Finck IsValidEnhMetaRecordOffExt(
26*fc16259fSJames Tabor PVOID pv0,
27*fc16259fSJames Tabor PVOID pv1,
28*fc16259fSJames Tabor DWORD dwOffset,
29*fc16259fSJames Tabor DWORD dwExtends )
30c2c66affSColin Finck {
31c2c66affSColin Finck UNIMPLEMENTED;
32c2c66affSColin Finck SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
33*fc16259fSJames Tabor return FALSE;
34c2c66affSColin Finck }
35c2c66affSColin Finck
36c2c66affSColin Finck /*
37da264743Sjimtabor * @implemented
38c2c66affSColin Finck */
39da264743Sjimtabor HANDLE
40c2c66affSColin Finck WINAPI
GdiConvertEnhMetaFile(HENHMETAFILE hemf)41da264743Sjimtabor GdiConvertEnhMetaFile(HENHMETAFILE hemf)
42c2c66affSColin Finck {
43da264743Sjimtabor HANDLE hmo = NULL;
44da264743Sjimtabor BYTE * Buffer = NULL;
45da264743Sjimtabor UINT nSize;
46da264743Sjimtabor
47da264743Sjimtabor nSize = GetEnhMetaFileBits( hemf, 0, NULL );
48da264743Sjimtabor if (nSize == 0)
49da264743Sjimtabor goto Exit;
50da264743Sjimtabor
51da264743Sjimtabor // allocate buffer
52da264743Sjimtabor Buffer = (BYTE *)LocalAlloc(LPTR, nSize);
53da264743Sjimtabor if (Buffer == NULL)
54da264743Sjimtabor goto Exit;
55da264743Sjimtabor
56da264743Sjimtabor nSize = GetEnhMetaFileBits( hemf, nSize, Buffer );
57da264743Sjimtabor if (nSize == 0)
58da264743Sjimtabor goto Exit;
59da264743Sjimtabor
60da264743Sjimtabor hmo = NtGdiCreateServerMetaFile( GDITAG_TYPE_EMF, nSize, Buffer, 0, 0, 0 );
61da264743Sjimtabor
62da264743Sjimtabor Exit:
63da264743Sjimtabor // clean up
64da264743Sjimtabor if (Buffer)
65da264743Sjimtabor LocalFree(Buffer);
66da264743Sjimtabor return hmo;
67c2c66affSColin Finck }
68c2c66affSColin Finck
69c2c66affSColin Finck /*
70da264743Sjimtabor * @implemented
71c2c66affSColin Finck */
72c2c66affSColin Finck HENHMETAFILE
73c2c66affSColin Finck WINAPI
GdiCreateLocalEnhMetaFile(HANDLE hmo)74da264743Sjimtabor GdiCreateLocalEnhMetaFile(HANDLE hmo)
75c2c66affSColin Finck {
76da264743Sjimtabor HENHMETAFILE hEMF;
77da264743Sjimtabor BYTE * Buffer = NULL;
78da264743Sjimtabor UINT nSize;
79da264743Sjimtabor DWORD iType, mm, xExt, yExt;
80da264743Sjimtabor
81da264743Sjimtabor nSize = NtGdiGetServerMetaFileBits( hmo, 0, NULL, NULL, NULL, NULL, NULL);
82da264743Sjimtabor if (nSize == 0)
83da264743Sjimtabor goto Exit;
84da264743Sjimtabor
85da264743Sjimtabor // allocate buffer
86da264743Sjimtabor Buffer = (BYTE *)LocalAlloc(LPTR, nSize);
87da264743Sjimtabor if (Buffer == NULL)
88da264743Sjimtabor goto Exit;
89da264743Sjimtabor
90da264743Sjimtabor // store to buffer
91da264743Sjimtabor nSize = NtGdiGetServerMetaFileBits( hmo, nSize, Buffer, &iType, &mm, &xExt, &yExt);
92da264743Sjimtabor if (nSize == 0)
93da264743Sjimtabor goto Exit;
94da264743Sjimtabor
95da264743Sjimtabor if ( iType == GDITAG_TYPE_MFP ) // handle conversion to EMF
96da264743Sjimtabor {
97da264743Sjimtabor METAFILEPICT Info;
98da264743Sjimtabor
99da264743Sjimtabor Info.hMF = NULL;
100da264743Sjimtabor Info.mm = mm;
101da264743Sjimtabor Info.xExt = xExt;
102da264743Sjimtabor Info.yExt = yExt;
103da264743Sjimtabor
104da264743Sjimtabor hEMF = SetWinMetaFileBits( nSize, Buffer, NULL, &Info ); // Translate from old style to new style.
105da264743Sjimtabor if (hEMF == NULL)
106da264743Sjimtabor goto Exit;
107da264743Sjimtabor }
108da264743Sjimtabor else
109da264743Sjimtabor {
110da264743Sjimtabor hEMF = SetEnhMetaFileBits(nSize, Buffer);
111da264743Sjimtabor if (hEMF == NULL)
112da264743Sjimtabor goto Exit;
113da264743Sjimtabor }
114da264743Sjimtabor
115da264743Sjimtabor Exit:
116da264743Sjimtabor // clean up
117da264743Sjimtabor if (Buffer)
118da264743Sjimtabor LocalFree(Buffer);
119da264743Sjimtabor return hEMF;
120c2c66affSColin Finck }
121c2c66affSColin Finck
122c2c66affSColin Finck /*
123c2c66affSColin Finck * @implemented
124c2c66affSColin Finck */
125c2c66affSColin Finck BOOL
126c2c66affSColin Finck WINAPI
GdiComment(_In_ HDC hdc,_In_ UINT cbSize,_In_ const BYTE * lpData)127c2c66affSColin Finck GdiComment(
128c2c66affSColin Finck _In_ HDC hdc,
129c2c66affSColin Finck _In_ UINT cbSize,
130c2c66affSColin Finck _In_ const BYTE *lpData)
131c2c66affSColin Finck {
132c2c66affSColin Finck if (GDI_HANDLE_GET_TYPE(hdc) != GDILoObjType_LO_ALTDC_TYPE)
133c2c66affSColin Finck return TRUE;
134c2c66affSColin Finck
135*fc16259fSJames Tabor return EMFDC_GdiComment( hdc, cbSize, lpData );
136c2c66affSColin Finck }
137c2c66affSColin Finck
138c2c66affSColin Finck /*
139c2c66affSColin Finck * @implemented
140c2c66affSColin Finck */
141c2c66affSColin Finck UINT
142c2c66affSColin Finck WINAPI
GetEnhMetaFilePixelFormat(HENHMETAFILE hemf,UINT cbBuffer,PIXELFORMATDESCRIPTOR * ppfd)143c2c66affSColin Finck GetEnhMetaFilePixelFormat(
144c2c66affSColin Finck HENHMETAFILE hemf,
145c2c66affSColin Finck UINT cbBuffer,
146*fc16259fSJames Tabor PIXELFORMATDESCRIPTOR *ppfd )
147c2c66affSColin Finck {
148c2c66affSColin Finck ENHMETAHEADER pemh;
149c2c66affSColin Finck
150c2c66affSColin Finck if(GetEnhMetaFileHeader(hemf, sizeof(ENHMETAHEADER), &pemh))
151c2c66affSColin Finck {
152c2c66affSColin Finck if(pemh.bOpenGL)
153c2c66affSColin Finck {
154c2c66affSColin Finck if(pemh.cbPixelFormat)
155c2c66affSColin Finck {
156c2c66affSColin Finck memcpy((void*)ppfd, UlongToPtr(pemh.offPixelFormat), cbBuffer );
157c2c66affSColin Finck return(pemh.cbPixelFormat);
158c2c66affSColin Finck }
159c2c66affSColin Finck }
160c2c66affSColin Finck }
161c2c66affSColin Finck return(0);
162c2c66affSColin Finck }
163