4 * Copyright 1994 Bob Amstadt
5 * Copyright 2001 Alexandre Julliard
12 #include "debugtools.h"
14 DEFAULT_DEBUG_CHANNEL(driver);
16 /***********************************************************************
19 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count,
20 SEGPTR in_data, LPVOID out_data )
26 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
27 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
28 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
29 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
30 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
31 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
32 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
33 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
34 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
35 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
36 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
37 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
38 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
46 case POSTSCRIPT_IGNORE:
48 case SET_ARC_DIRECTION:
50 case SET_SCREEN_ANGLE:
53 INT16 *ptr = MapSL(in_data);
55 return Escape( hdc, escape, sizeof(data), (LPCSTR)&data, out_data );
58 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
61 UINT16 *ptr = MapSL(in_data);
63 return Escape( hdc, escape, sizeof(data), (LPCSTR)&data, NULL );
66 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
67 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
68 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
70 case GETPRINTINGOFFSET:
71 case GETSCALINGFACTOR:
73 POINT16 *ptr = out_data;
75 ret = Escape( hdc, escape, 0, NULL, &pt32 );
81 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
82 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
83 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
84 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
85 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
86 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
87 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
88 case ENABLEPAIRKERNING:
89 case ENABLERELATIVEWIDTHS:
96 INT16 *new = MapSL(in_data);
97 INT16 *old = out_data;
99 ret = Escape( hdc, escape, sizeof(in), (LPCSTR)&in, &out );
104 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
106 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
108 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
109 * lpvOutData is actually a pointer to the DocInfo structure and used as
110 * a second input parameter */
114 ret = StartDoc16( hdc, out_data );
115 if (ret > 0) ret = StartPage( hdc );
118 return Escape( hdc, escape, in_count, MapSL(in_data), NULL );
120 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
121 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
125 RECT16 *rc16 = MapSL(in_data);
127 rc.left = rc16->left;
129 rc.right = rc16->right;
130 rc.bottom = rc16->bottom;
131 return Escape( hdc, escape, sizeof(rc), (LPCSTR)&rc, NULL );
134 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
138 RECT16 *rc16 = out_data;
139 ret = Escape( hdc, escape, 0, NULL, &rc );
140 rc16->left = rc.left;
142 rc16->right = rc.right;
143 rc16->bottom = rc.bottom;
147 /* Escape(hdc,ABORTDOC,NULL,NULL); */
148 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
149 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
150 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
151 /* Escape(hdc,ENDDOC,NULL,NULL); */
152 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
153 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
154 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
155 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
156 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
157 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
158 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
159 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
160 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
161 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
162 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
163 /* Escape(hdc,NEWFRAME,NULL,NULL); */
164 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
165 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
166 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
167 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
168 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
169 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
170 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
174 case DRAWPATTERNRECT:
180 case GETPAIRKERNTABLE:
181 case GETSETPAPERBINS:
182 case GETSETPRINTORIENT:
183 case GETSETSCREENPARAMS:
185 case GETTRACKKERNTABLE:
191 case SETALLJUSTVALUES:
193 case SET_BACKGROUND_COLOR:
195 /* pass it unmodified to the 32-bit function */
196 return Escape( hdc, escape, in_count, MapSL(in_data), out_data );
198 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
199 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
200 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
201 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
202 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
203 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
204 case ENUMPAPERMETRICS:
205 case GETEXTENDEDTEXTMETRICS:
207 case GETSETPAPERMETRICS:
208 case GETVECTORBRUSHSIZE:
209 case GETVECTORPENSIZE:
211 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
212 escape, in_count, MapSL(in_data), out_data );
213 return Escape( hdc, escape, in_count, MapSL(in_data), out_data );
218 /************************************************************************
221 INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out_data )
229 return AbortDoc( hdc );
232 return EndDoc( hdc );
234 case GETPHYSPAGESIZE:
236 pt->x = GetDeviceCaps( hdc, PHYSICALWIDTH );
237 pt->y = GetDeviceCaps( hdc, PHYSICALHEIGHT );
240 case GETPRINTINGOFFSET:
242 pt->x = GetDeviceCaps( hdc, PHYSICALOFFSETX );
243 pt->y = GetDeviceCaps( hdc, PHYSICALOFFSETY );
246 case GETSCALINGFACTOR:
248 pt->x = GetDeviceCaps( hdc, SCALINGFACTORX );
249 pt->y = GetDeviceCaps( hdc, SCALINGFACTORY );
253 return EndPage( hdc );
256 return SetAbortProc( hdc, (ABORTPROC)in_data );
263 /* in_data may not be 0 terminated so we must copy it */
266 name = HeapAlloc( GetProcessHeap(), 0, in_count+1 );
267 memcpy( name, in_data, in_count );
270 /* out_data is actually a pointer to the DocInfo structure and used as
271 * a second input parameter */
272 if (out_data) doc = *(DOCINFOA *)out_data;
275 doc.cbSize = sizeof(doc);
276 doc.lpszOutput = NULL;
277 doc.lpszDatatype = NULL;
280 doc.lpszDocName = name;
281 ret = StartDocA( hdc, &doc );
282 if (name) HeapFree( GetProcessHeap(), 0, name );
283 if (ret > 0) ret = StartPage( hdc );
287 case QUERYESCSUPPORT:
289 INT *ptr = (INT *)in_data;
290 if (in_count < sizeof(INT)) return 0;
295 case GETPHYSPAGESIZE:
296 case GETPRINTINGOFFSET:
297 case GETSCALINGFACTOR:
299 case QUERYESCSUPPORT:
308 /* if not handled internally, pass it to the driver */
309 return ExtEscape( hdc, escape, in_count, in_data, 0, out_data );
313 /******************************************************************************
314 * ExtEscape [GDI32.@]
317 * hdc [I] Handle to device context
318 * nEscape [I] Escape function
319 * cbInput [I] Number of bytes in input structure
320 * lpszInData [I] Pointer to input structure
321 * cbOutput [I] Number of bytes in output structure
322 * lpszOutData [O] Pointer to output structure
329 INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
330 INT cbOutput, LPSTR lpszOutData )
333 DC * dc = DC_GetDCPtr( hdc );
336 if (dc->funcs->pExtEscape)
337 ret = dc->funcs->pExtEscape( dc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
338 GDI_ReleaseObj( hdc );
344 /*******************************************************************
345 * DrawEscape [GDI32.@]
349 INT WINAPI DrawEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData)
351 FIXME("DrawEscape, stub\n");