Release 980329
[wine/multimedia.git] / graphics / escape.c
blobcd3873c0ca7af4c86e8949ffa3b04a28349655f7
1 /*
2 * Escape() function.
4 * Copyright 1994 Bob Amstadt
5 */
7 #include <stdio.h>
8 #include "windows.h"
9 #include "gdi.h"
10 #include "heap.h"
11 #include "ldt.h"
12 #include "dc.h"
14 INT16 WINAPI Escape16( HDC16 hdc, INT16 nEscape, INT16 cbInput,
15 SEGPTR lpszInData, SEGPTR lpvOutData )
17 DC * dc = DC_GetDCPtr( hdc );
18 if (!dc || !dc->funcs->pEscape) return 0;
19 return dc->funcs->pEscape( dc, nEscape, cbInput, lpszInData, lpvOutData );
22 INT32 WINAPI Escape32( HDC32 hdc, INT32 nEscape, INT32 cbInput,
23 LPVOID lpszInData, LPVOID lpvOutData )
25 DC *dc = DC_GetDCPtr( hdc );
26 SEGPTR segin,segout;
27 INT32 ret;
29 if (!dc || !dc->funcs->pEscape) return 0;
30 segin = (SEGPTR)lpszInData;
31 segout = (SEGPTR)lpvOutData;
32 switch (nEscape) {
33 /* Escape(hdc,QUERYESCSUPPORT,LPINT32,NULL) */
34 case QUERYESCSUPPORT: {
35 LPINT16 x = (LPINT16)SEGPTR_NEW(INT16);
36 *x = *(INT32*)lpszInData;
37 segin = SEGPTR_GET(x);
38 break;
41 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT32) */
42 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT32) */
43 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT32) */
45 case GETSCALINGFACTOR:
46 case GETPHYSPAGESIZE:
47 case GETPRINTINGOFFSET:
48 segout = SEGPTR_GET(SEGPTR_NEW(POINT16));
49 break;
51 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
53 case GETTECHNOLOGY: {
54 segout = SEGPTR_GET(SEGPTR_ALLOC(200)); /* enough I hope */
55 break;
59 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
61 case ENABLEPAIRKERNING: {
62 LPINT16 enab = SEGPTR_NEW(INT16);
63 segout = SEGPTR_GET(SEGPTR_NEW(INT16));
64 segin = SEGPTR_GET(enab);
65 *enab = *(INT32*)lpszInData;
66 break;
69 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
71 case GETFACENAME: {
72 segout = SEGPTR_GET(SEGPTR_ALLOC(200));
73 break;
76 ret = dc->funcs->pEscape( dc, nEscape, cbInput, segin, segout );
77 switch(nEscape) {
78 case QUERYESCSUPPORT:
79 if (ret)
80 fprintf(stderr,"target DC implements Escape %d\n",nEscape);
81 SEGPTR_FREE(PTR_SEG_TO_LIN(segin));
82 break;
83 case GETSCALINGFACTOR:
84 case GETPRINTINGOFFSET:
85 case GETPHYSPAGESIZE: {
86 LPPOINT16 x = (LPPOINT16)PTR_SEG_TO_LIN(segout);
87 CONV_POINT16TO32(x,(LPPOINT32)lpvOutData);
88 SEGPTR_FREE(x);
89 break;
91 case GETTECHNOLOGY: {
92 LPSTR x=PTR_SEG_TO_LIN(segout);
93 lstrcpy32A(lpvOutData,x);
94 SEGPTR_FREE(x);
95 break;
97 case ENABLEPAIRKERNING: {
98 LPINT16 enab = (LPINT16)PTR_SEG_TO_LIN(segout);
100 *(LPINT32)lpvOutData = *enab;
101 SEGPTR_FREE(enab);
102 SEGPTR_FREE(PTR_SEG_TO_LIN(segin));
103 break;
105 case GETFACENAME: {
106 LPSTR x = (LPSTR)PTR_SEG_TO_LIN(segout);
107 lstrcpy32A(lpvOutData,x);
108 SEGPTR_FREE(x);
109 break;
111 default:
112 break;
114 return ret;
117 INT32 WINAPI ExtEscape32(HDC32 hdc,INT32 nEscape,INT32 cbInput,LPCSTR x,INT32 cbOutput,LPSTR out) {
118 fprintf(stderr,"ExtEscape32(0x%04x,0x%x,%d,%s,%d,%p),stub!\n",
119 hdc,nEscape,cbInput,x,cbOutput,out
121 return 1;