Moved EnumObjects16, LineDDA16 and associated glue code to gdi16.c.
[wine] / dlls / gdi / gdi16.c
1 /*
2  * GDI 16-bit functions
3  *
4  * Copyright 2002 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "winbase.h"
22 #include "wingdi.h"
23 #include "wownt32.h"
24 #include "wine/wingdi16.h"
25 #include "gdi.h"
26 #include "wine/debug.h"
27
28 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
29
30 #define HGDIOBJ_32(handle16)    ((HGDIOBJ)(ULONG_PTR)(handle16))
31 #define HGDIOBJ_16(handle32)    ((HGDIOBJ16)(ULONG_PTR)(handle32))
32
33 /* ### start build ### */
34 extern WORD CALLBACK GDI_CallTo16_word_ll(FARPROC16,LONG,LONG);
35 extern WORD CALLBACK GDI_CallTo16_word_wwl(FARPROC16,WORD,WORD,LONG);
36 /* ### stop build ### */
37
38 struct callback16_info
39 {
40     FARPROC16 proc;
41     LPARAM    param;
42 };
43
44 /* callback for LineDDA16 */
45 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
46 {
47     const struct callback16_info *info = (struct callback16_info *)param;
48     GDI_CallTo16_word_wwl( info->proc, x, y, info->param );
49 }
50
51 /* callback for EnumObjects16 */
52 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
53 {
54     const struct callback16_info *info = (struct callback16_info *)param;
55     LOGPEN *pen = ptr;
56     LOGPEN16 pen16;
57     SEGPTR segptr;
58     INT ret;
59
60     pen16.lopnStyle   = pen->lopnStyle;
61     pen16.lopnWidth.x = pen->lopnWidth.x;
62     pen16.lopnWidth.y = pen->lopnWidth.y;
63     pen16.lopnColor   = pen->lopnColor;
64     segptr = MapLS( &pen16 );
65     ret = GDI_CallTo16_word_ll( info->proc, segptr, info->param );
66     UnMapLS( segptr );
67     return ret;
68 }
69
70 /* callback for EnumObjects16 */
71 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
72 {
73     const struct callback16_info *info = (struct callback16_info *)param;
74     LOGBRUSH *brush = ptr;
75     LOGBRUSH16 brush16;
76     SEGPTR segptr;
77     INT ret;
78
79     brush16.lbStyle = brush->lbStyle;
80     brush16.lbColor = brush->lbColor;
81     brush16.lbHatch = brush->lbHatch;
82     segptr = MapLS( &brush16 );
83     ret = GDI_CallTo16_word_ll( info->proc, segptr, info->param );
84     UnMapLS( segptr );
85     return ret;
86 }
87
88 /* convert a LOGFONT16 to a LOGFONTW */
89 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
90 {
91     font32->lfHeight = font16->lfHeight;
92     font32->lfWidth = font16->lfWidth;
93     font32->lfEscapement = font16->lfEscapement;
94     font32->lfOrientation = font16->lfOrientation;
95     font32->lfWeight = font16->lfWeight;
96     font32->lfItalic = font16->lfItalic;
97     font32->lfUnderline = font16->lfUnderline;
98     font32->lfStrikeOut = font16->lfStrikeOut;
99     font32->lfCharSet = font16->lfCharSet;
100     font32->lfOutPrecision = font16->lfOutPrecision;
101     font32->lfClipPrecision = font16->lfClipPrecision;
102     font32->lfQuality = font16->lfQuality;
103     font32->lfPitchAndFamily = font16->lfPitchAndFamily;
104     MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
105     font32->lfFaceName[LF_FACESIZE-1] = 0;
106 }
107
108
109 /***********************************************************************
110  *           SetBkColor    (GDI.1)
111  */
112 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
113 {
114     return SetBkColor( HDC_32(hdc), color );
115 }
116
117
118 /***********************************************************************
119  *              SetBkMode (GDI.2)
120  */
121 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
122 {
123     return SetBkMode( HDC_32(hdc), mode );
124 }
125
126
127 /***********************************************************************
128  *           SetMapMode    (GDI.3)
129  */
130 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
131 {
132     return SetMapMode( HDC_32(hdc), mode );
133 }
134
135
136 /***********************************************************************
137  *              SetROP2 (GDI.4)
138  */
139 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
140 {
141     return SetROP2( HDC_32(hdc), mode );
142 }
143
144
145 /***********************************************************************
146  *              SetRelAbs (GDI.5)
147  */
148 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
149 {
150     return SetRelAbs( HDC_32(hdc), mode );
151 }
152
153
154 /***********************************************************************
155  *              SetPolyFillMode (GDI.6)
156  */
157 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
158 {
159     return SetPolyFillMode( HDC_32(hdc), mode );
160 }
161
162
163 /***********************************************************************
164  *              SetStretchBltMode (GDI.7)
165  */
166 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
167 {
168     return SetStretchBltMode( HDC_32(hdc), mode );
169 }
170
171
172 /***********************************************************************
173  *           SetTextCharacterExtra    (GDI.8)
174  */
175 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
176 {
177     return SetTextCharacterExtra( HDC_32(hdc), extra );
178 }
179
180
181 /***********************************************************************
182  *           SetTextColor    (GDI.9)
183  */
184 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
185 {
186     return SetTextColor( HDC_32(hdc), color );
187 }
188
189
190 /***********************************************************************
191  *           SetTextJustification    (GDI.10)
192  */
193 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
194 {
195     return SetTextJustification( HDC_32(hdc), extra, breaks );
196 }
197
198
199 /***********************************************************************
200  *           SetWindowOrg    (GDI.11)
201  */
202 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
203 {
204     POINT pt;
205     if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
206     return MAKELONG( pt.x, pt.y );
207 }
208
209
210 /***********************************************************************
211  *           SetWindowExt    (GDI.12)
212  */
213 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
214 {
215     SIZE size;
216     if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
217     return MAKELONG( size.cx, size.cy );
218 }
219
220
221 /***********************************************************************
222  *           SetViewportOrg    (GDI.13)
223  */
224 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
225 {
226     POINT pt;
227     if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
228     return MAKELONG( pt.x, pt.y );
229 }
230
231
232 /***********************************************************************
233  *           SetViewportExt    (GDI.14)
234  */
235 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
236 {
237     SIZE size;
238     if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
239     return MAKELONG( size.cx, size.cy );
240 }
241
242
243 /***********************************************************************
244  *           OffsetWindowOrg    (GDI.15)
245  */
246 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
247 {
248     POINT pt;
249     if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
250     return MAKELONG( pt.x, pt.y );
251 }
252
253
254 /***********************************************************************
255  *           ScaleWindowExt    (GDI.16)
256  */
257 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
258                              INT16 yNum, INT16 yDenom )
259 {
260     SIZE size;
261     if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
262         return FALSE;
263     return MAKELONG( size.cx,  size.cy );
264 }
265
266
267 /***********************************************************************
268  *           OffsetViewportOrg    (GDI.17)
269  */
270 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
271 {
272     POINT pt;
273     if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
274     return MAKELONG( pt.x, pt.y );
275 }
276
277
278 /***********************************************************************
279  *           ScaleViewportExt    (GDI.18)
280  */
281 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
282                                INT16 yNum, INT16 yDenom )
283 {
284     SIZE size;
285     if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
286         return FALSE;
287     return MAKELONG( size.cx,  size.cy );
288 }
289
290
291 /***********************************************************************
292  *           LineTo    (GDI.19)
293  */
294 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
295 {
296     return LineTo( HDC_32(hdc), x, y );
297 }
298
299
300 /***********************************************************************
301  *           MoveTo    (GDI.20)
302  */
303 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
304 {
305     POINT pt;
306
307     if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
308     return MAKELONG(pt.x,pt.y);
309 }
310
311
312 /***********************************************************************
313  *           ExcludeClipRect    (GDI.21)
314  */
315 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
316                                 INT16 right, INT16 bottom )
317 {
318     return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
319 }
320
321
322 /***********************************************************************
323  *           IntersectClipRect    (GDI.22)
324  */
325 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
326                                   INT16 right, INT16 bottom )
327 {
328     return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
329 }
330
331
332 /***********************************************************************
333  *           Arc    (GDI.23)
334  */
335 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
336                      INT16 bottom, INT16 xstart, INT16 ystart,
337                      INT16 xend, INT16 yend )
338 {
339     return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
340 }
341
342
343 /***********************************************************************
344  *           Ellipse    (GDI.24)
345  */
346 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
347                          INT16 right, INT16 bottom )
348 {
349     return Ellipse( HDC_32(hdc), left, top, right, bottom );
350 }
351
352
353 /**********************************************************************
354  *          FloodFill   (GDI.25)
355  */
356 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
357 {
358     return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
359 }
360
361
362 /***********************************************************************
363  *           Pie    (GDI.26)
364  */
365 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
366                      INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
367                      INT16 xend, INT16 yend )
368 {
369     return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
370 }
371
372
373 /***********************************************************************
374  *           Rectangle    (GDI.27)
375  */
376 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
377                            INT16 right, INT16 bottom )
378 {
379     return Rectangle( HDC_32(hdc), left, top, right, bottom );
380 }
381
382
383 /***********************************************************************
384  *           RoundRect    (GDI.28)
385  */
386 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
387                            INT16 bottom, INT16 ell_width, INT16 ell_height )
388 {
389     return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
390 }
391
392
393 /***********************************************************************
394  *           PatBlt    (GDI.29)
395  */
396 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
397                         INT16 width, INT16 height, DWORD rop)
398 {
399     return PatBlt( HDC_32(hdc), left, top, width, height, rop );
400 }
401
402
403 /***********************************************************************
404  *           SaveDC    (GDI.30)
405  */
406 INT16 WINAPI SaveDC16( HDC16 hdc )
407 {
408     return SaveDC( HDC_32(hdc) );
409 }
410
411
412 /***********************************************************************
413  *           SetPixel    (GDI.31)
414  */
415 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
416 {
417     return SetPixel( HDC_32(hdc), x, y, color );
418 }
419
420
421 /***********************************************************************
422  *           OffsetClipRgn    (GDI.32)
423  */
424 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
425 {
426     return OffsetClipRgn( HDC_32(hdc), x, y );
427 }
428
429
430 /***********************************************************************
431  *           TextOut    (GDI.33)
432  */
433 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
434 {
435     return TextOutA( HDC_32(hdc), x, y, str, count );
436 }
437
438
439 /***********************************************************************
440  *           BitBlt    (GDI.34)
441  */
442 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
443                         INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
444                         DWORD rop )
445 {
446     return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
447 }
448
449
450 /***********************************************************************
451  *           StretchBlt    (GDI.35)
452  */
453 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
454                             INT16 widthDst, INT16 heightDst,
455                             HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
456                             INT16 widthSrc, INT16 heightSrc, DWORD rop )
457 {
458     return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
459                        HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
460 }
461
462
463 /**********************************************************************
464  *          Polygon  (GDI.36)
465  */
466 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
467 {
468     register int i;
469     BOOL ret;
470     LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
471                                            count*sizeof(POINT) );
472
473     if (!pt32) return FALSE;
474     for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
475     ret = Polygon(HDC_32(hdc),pt32,count);
476     HeapFree( GetProcessHeap(), 0, pt32 );
477     return ret;
478 }
479
480
481 /**********************************************************************
482  *          Polyline  (GDI.37)
483  */
484 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
485 {
486     register int i;
487     BOOL16 ret;
488     LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
489                                            count*sizeof(POINT) );
490
491     if (!pt32) return FALSE;
492     for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
493     ret = Polyline(HDC_32(hdc),pt32,count);
494     HeapFree( GetProcessHeap(), 0, pt32 );
495     return ret;
496 }
497
498
499 /***********************************************************************
500  *            Escape   (GDI.38)
501  */
502 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
503 {
504     INT ret;
505
506     switch(escape)
507     {
508     /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
509     /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
510     /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
511     /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
512     /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
513     /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
514     /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
515     /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
516     /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
517     /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
518     /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
519     /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
520     /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
521     case CLIP_TO_PATH:
522     case DRAFTMODE:
523     case ENUMPAPERBINS:
524     case EPSPRINTING:
525     case EXT_DEVICE_CAPS:
526     case GETCOLORTABLE:
527     case MOUSETRAILS:
528     case POSTSCRIPT_IGNORE:
529     case QUERYESCSUPPORT:
530     case SET_ARC_DIRECTION:
531     case SET_POLY_MODE:
532     case SET_SCREEN_ANGLE:
533     case SET_SPREAD:
534     {
535         INT16 *ptr = MapSL(in_data);
536         INT data = *ptr;
537         return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
538     }
539
540     /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
541     case ENABLEDUPLEX:
542     {
543         UINT16 *ptr = MapSL(in_data);
544         UINT data = *ptr;
545         return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
546     }
547
548     /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
549     /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
550     /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
551     case GETPHYSPAGESIZE:
552     case GETPRINTINGOFFSET:
553     case GETSCALINGFACTOR:
554     {
555         POINT16 *ptr = out_data;
556         POINT pt32;
557         ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
558         ptr->x = pt32.x;
559         ptr->y = pt32.y;
560         return ret;
561     }
562
563     /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
564     /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
565     /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
566     /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
567     /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
568     /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
569     /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
570     case ENABLEPAIRKERNING:
571     case ENABLERELATIVEWIDTHS:
572     case SETCOPYCOUNT:
573     case SETKERNTRACK:
574     case SETLINECAP:
575     case SETLINEJOIN:
576     case SETMITERLIMIT:
577     {
578         INT16 *new = MapSL(in_data);
579         INT16 *old = out_data;
580         INT out, in = *new;
581         ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
582         *old = out;
583         return ret;
584     }
585
586     /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
587     case SETABORTPROC:
588         return SetAbortProc16( hdc, (ABORTPROC16)in_data );
589
590     /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
591      * lpvOutData is actually a pointer to the DocInfo structure and used as
592      * a second input parameter */
593     case STARTDOC:
594         if (out_data)
595         {
596             ret = StartDoc16( hdc, out_data );
597             if (ret > 0) ret = StartPage( HDC_32(hdc) );
598             return ret;
599         }
600         return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
601
602     /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
603     /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
604     case SET_BOUNDS:
605     case SET_CLIP_BOX:
606     {
607         RECT16 *rc16 = MapSL(in_data);
608         RECT rc;
609         rc.left   = rc16->left;
610         rc.top    = rc16->top;
611         rc.right  = rc16->right;
612         rc.bottom = rc16->bottom;
613         return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
614     }
615
616     /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
617     case NEXTBAND:
618     {
619         RECT rc;
620         RECT16 *rc16 = out_data;
621         ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
622         rc16->left   = rc.left;
623         rc16->top    = rc.top;
624         rc16->right  = rc.right;
625         rc16->bottom = rc.bottom;
626         return ret;
627     }
628
629     /* Escape(hdc,ABORTDOC,NULL,NULL); */
630     /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
631     /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
632     /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
633     /* Escape(hdc,ENDDOC,NULL,NULL); */
634     /* Escape(hdc,END_PATH,PATHINFO,NULL); */
635     /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
636     /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
637     /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
638     /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
639     /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
640     /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
641     /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
642     /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
643     /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
644     /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
645     /* Escape(hdc,NEWFRAME,NULL,NULL); */
646     /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
647     /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
648     /* Escape(hdc,SAVE_CTM,NULL,NULL); */
649     /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
650     /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
651     /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
652     /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
653     case ABORTDOC:
654     case BANDINFO:
655     case BEGIN_PATH:
656     case DRAWPATTERNRECT:
657     case ENDDOC:
658     case END_PATH:
659     case EXTTEXTOUT:
660     case FLUSHOUTPUT:
661     case GETFACENAME:
662     case GETPAIRKERNTABLE:
663     case GETSETPAPERBINS:
664     case GETSETPRINTORIENT:
665     case GETSETSCREENPARAMS:
666     case GETTECHNOLOGY:
667     case GETTRACKKERNTABLE:
668     case MFCOMMENT:
669     case NEWFRAME:
670     case PASSTHROUGH:
671     case RESTORE_CTM:
672     case SAVE_CTM:
673     case SETALLJUSTVALUES:
674     case SETCOLORTABLE:
675     case SET_BACKGROUND_COLOR:
676     case TRANSFORM_CTM:
677         /* pass it unmodified to the 32-bit function */
678         return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
679
680     /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
681     /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
682     /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
683     /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
684     /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
685     /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
686     case ENUMPAPERMETRICS:
687     case GETEXTENDEDTEXTMETRICS:
688     case GETEXTENTTABLE:
689     case GETSETPAPERMETRICS:
690     case GETVECTORBRUSHSIZE:
691     case GETVECTORPENSIZE:
692     default:
693         FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
694               escape, in_count, MapSL(in_data), out_data );
695         return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
696     }
697 }
698
699
700 /***********************************************************************
701  *           RestoreDC    (GDI.39)
702  */
703 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
704 {
705     return RestoreDC( HDC_32(hdc), level );
706 }
707
708
709 /***********************************************************************
710  *           FillRgn    (GDI.40)
711  */
712 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
713 {
714     return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
715 }
716
717
718 /***********************************************************************
719  *           FrameRgn     (GDI.41)
720  */
721 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
722                           INT16 nWidth, INT16 nHeight )
723 {
724     return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
725 }
726
727
728 /***********************************************************************
729  *           InvertRgn    (GDI.42)
730  */
731 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
732 {
733     return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
734 }
735
736
737 /***********************************************************************
738  *           PaintRgn    (GDI.43)
739  */
740 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
741 {
742     return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
743 }
744
745
746 /***********************************************************************
747  *           SelectClipRgn    (GDI.44)
748  */
749 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
750 {
751     return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
752 }
753
754
755 /***********************************************************************
756  *           SelectObject    (GDI.45)
757  */
758 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
759 {
760     return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
761 }
762
763
764 /***********************************************************************
765  *           CombineRgn    (GDI.47)
766  */
767 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
768 {
769     return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
770 }
771
772
773 /***********************************************************************
774  *           CreateBitmap    (GDI.48)
775  */
776 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
777                                  UINT16 bpp, LPCVOID bits )
778 {
779     return HBITMAP_16( CreateBitmap( width, height, planes, bpp, bits ) );
780 }
781
782
783 /***********************************************************************
784  *           CreateBitmapIndirect    (GDI.49)
785  */
786 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
787 {
788     return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
789                            bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
790 }
791
792
793 /***********************************************************************
794  *           CreateBrushIndirect    (GDI.50)
795  */
796 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
797 {
798     LOGBRUSH brush32;
799
800     if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
801         return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
802
803     brush32.lbStyle = brush->lbStyle;
804     brush32.lbColor = brush->lbColor;
805     brush32.lbHatch = brush->lbHatch;
806     return HBRUSH_16( CreateBrushIndirect(&brush32) );
807 }
808
809
810 /***********************************************************************
811  *           CreateCompatibleBitmap    (GDI.51)
812  */
813 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
814 {
815     return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
816 }
817
818
819 /***********************************************************************
820  *           CreateCompatibleDC    (GDI.52)
821  */
822 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
823 {
824     return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
825 }
826
827
828 /***********************************************************************
829  *           CreateDC    (GDI.53)
830  */
831 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
832                          const DEVMODEA *initData )
833 {
834     return HDC_16( CreateDCA( driver, device, output, initData ) );
835 }
836
837
838 /***********************************************************************
839  *           CreateEllipticRgn    (GDI.54)
840  */
841 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
842 {
843     return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
844 }
845
846
847 /***********************************************************************
848  *           CreateEllipticRgnIndirect    (GDI.55)
849  */
850 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
851 {
852     return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
853 }
854
855
856 /***********************************************************************
857  *           CreateFont    (GDI.56)
858  */
859 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
860                             INT16 weight, BYTE italic, BYTE underline,
861                             BYTE strikeout, BYTE charset, BYTE outpres,
862                             BYTE clippres, BYTE quality, BYTE pitch,
863                             LPCSTR name )
864 {
865     return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
866                                   strikeout, charset, outpres, clippres, quality, pitch, name ));
867 }
868
869 /***********************************************************************
870  *           CreateFontIndirect   (GDI.57)
871  */
872 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
873 {
874     HFONT ret;
875
876     if (plf16)
877     {
878         LOGFONTW lfW;
879         logfont_16_to_W( plf16, &lfW );
880         ret = CreateFontIndirectW( &lfW );
881     }
882     else ret = CreateFontIndirectW( NULL );
883     return HFONT_16(ret);
884 }
885
886
887 /***********************************************************************
888  *           CreateHatchBrush    (GDI.58)
889  */
890 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
891 {
892     return HBRUSH_16( CreateHatchBrush( style, color ) );
893 }
894
895
896 /***********************************************************************
897  *           CreatePatternBrush    (GDI.60)
898  */
899 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
900 {
901     return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
902 }
903
904
905 /***********************************************************************
906  *           CreatePen    (GDI.61)
907  */
908 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
909 {
910     LOGPEN logpen;
911
912     logpen.lopnStyle = style;
913     logpen.lopnWidth.x = width;
914     logpen.lopnWidth.y = 0;
915     logpen.lopnColor = color;
916     return HPEN_16( CreatePenIndirect( &logpen ) );
917 }
918
919
920 /***********************************************************************
921  *           CreatePenIndirect    (GDI.62)
922  */
923 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
924 {
925     LOGPEN logpen;
926
927     if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
928     logpen.lopnStyle   = pen->lopnStyle;
929     logpen.lopnWidth.x = pen->lopnWidth.x;
930     logpen.lopnWidth.y = pen->lopnWidth.y;
931     logpen.lopnColor   = pen->lopnColor;
932     return HPEN_16( CreatePenIndirect( &logpen ) );
933 }
934
935
936 /***********************************************************************
937  *           CreatePolygonRgn    (GDI.63)
938  */
939 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
940 {
941     return CreatePolyPolygonRgn16( points, &count, 1, mode );
942 }
943
944
945 /***********************************************************************
946  *           CreateRectRgn    (GDI.64)
947  *
948  * NOTE: cf. SetRectRgn16
949  */
950 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
951 {
952     HRGN hrgn;
953
954     if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
955     else hrgn = CreateRectRgn( 0, 0, 0, 0 );
956     return HRGN_16(hrgn);
957 }
958
959
960 /***********************************************************************
961  *           CreateRectRgnIndirect    (GDI.65)
962  */
963 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
964 {
965     return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
966 }
967
968
969 /***********************************************************************
970  *           CreateSolidBrush    (GDI.66)
971  */
972 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
973 {
974     return HBRUSH_16( CreateSolidBrush( color ) );
975 }
976
977
978 /***********************************************************************
979  *           DeleteDC    (GDI.68)
980  */
981 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
982 {
983     return DeleteDC( HDC_32(hdc) );
984 }
985
986
987 /***********************************************************************
988  *           DeleteObject    (GDI.69)
989  *           SysDeleteObject (GDI.605)
990  */
991 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
992 {
993     return DeleteObject( HGDIOBJ_32(obj) );
994 }
995
996
997 /***********************************************************************
998  *           EnumObjects    (GDI.71)
999  */
1000 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1001 {
1002     struct callback16_info info;
1003
1004     info.proc  = (FARPROC16)proc;
1005     info.param = lParam;
1006     switch(obj)
1007     {
1008     case OBJ_PEN:
1009         return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1010     case OBJ_BRUSH:
1011         return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1012     }
1013     return 0;
1014 }
1015
1016
1017 /***********************************************************************
1018  *           EqualRgn    (GDI.72)
1019  */
1020 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1021 {
1022     return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1023 }
1024
1025
1026 /***********************************************************************
1027  *           GetBitmapBits    (GDI.74)
1028  */
1029 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1030 {
1031     return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1032 }
1033
1034
1035 /***********************************************************************
1036  *              GetBkColor (GDI.75)
1037  */
1038 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1039 {
1040     return GetBkColor( HDC_32(hdc) );
1041 }
1042
1043
1044 /***********************************************************************
1045  *              GetBkMode (GDI.76)
1046  */
1047 INT16 WINAPI GetBkMode16( HDC16 hdc )
1048 {
1049     return GetBkMode( HDC_32(hdc) );
1050 }
1051
1052
1053 /***********************************************************************
1054  *           GetClipBox    (GDI.77)
1055  */
1056 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1057 {
1058     RECT rect32;
1059     INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1060
1061     if (ret != ERROR)
1062     {
1063         rect->left   = rect32.left;
1064         rect->top    = rect32.top;
1065         rect->right  = rect32.right;
1066         rect->bottom = rect32.bottom;
1067     }
1068     return ret;
1069 }
1070
1071
1072 /***********************************************************************
1073  *              GetCurrentPosition (GDI.78)
1074  */
1075 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1076 {
1077     POINT pt32;
1078     if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1079     return MAKELONG( pt32.x, pt32.y );
1080 }
1081
1082
1083 /***********************************************************************
1084  *           GetDCOrg    (GDI.79)
1085  */
1086 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1087 {
1088     POINT pt;
1089     if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1090     return 0;
1091 }
1092
1093
1094 /***********************************************************************
1095  *           GetDeviceCaps    (GDI.80)
1096  */
1097 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1098 {
1099     INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1100     /* some apps don't expect -1 and think it's a B&W screen */
1101     if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1102     return ret;
1103 }
1104
1105
1106 /***********************************************************************
1107  *              GetMapMode (GDI.81)
1108  */
1109 INT16 WINAPI GetMapMode16( HDC16 hdc )
1110 {
1111     return GetMapMode( HDC_32(hdc) );
1112 }
1113
1114
1115 /***********************************************************************
1116  *           GetPixel    (GDI.83)
1117  */
1118 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1119 {
1120     return GetPixel( HDC_32(hdc), x, y );
1121 }
1122
1123
1124 /***********************************************************************
1125  *              GetPolyFillMode (GDI.84)
1126  */
1127 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1128 {
1129     return GetPolyFillMode( HDC_32(hdc) );
1130 }
1131
1132
1133 /***********************************************************************
1134  *              GetROP2 (GDI.85)
1135  */
1136 INT16 WINAPI GetROP216( HDC16 hdc )
1137 {
1138     return GetROP2( HDC_32(hdc) );
1139 }
1140
1141
1142 /***********************************************************************
1143  *              GetRelAbs (GDI.86)
1144  */
1145 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1146 {
1147     return GetRelAbs( HDC_32(hdc), 0 );
1148 }
1149
1150
1151 /***********************************************************************
1152  *           GetStockObject    (GDI.87)
1153  */
1154 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1155 {
1156     return HGDIOBJ_16( GetStockObject( obj ) );
1157 }
1158
1159
1160 /***********************************************************************
1161  *              GetStretchBltMode (GDI.88)
1162  */
1163 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1164 {
1165     return GetStretchBltMode( HDC_32(hdc) );
1166 }
1167
1168
1169 /***********************************************************************
1170  *           GetTextCharacterExtra    (GDI.89)
1171  */
1172 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1173 {
1174     return GetTextCharacterExtra( HDC_32(hdc) );
1175 }
1176
1177
1178 /***********************************************************************
1179  *              GetTextColor (GDI.90)
1180  */
1181 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1182 {
1183     return GetTextColor( HDC_32(hdc) );
1184 }
1185
1186
1187 /***********************************************************************
1188  *           GetTextExtent    (GDI.91)
1189  */
1190 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1191 {
1192     SIZE size;
1193     if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1194     return MAKELONG( size.cx, size.cy );
1195 }
1196
1197
1198 /***********************************************************************
1199  *           GetTextFace    (GDI.92)
1200  */
1201 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1202 {
1203     return GetTextFaceA( HDC_32(hdc), count, name );
1204 }
1205
1206
1207 /***********************************************************************
1208  *           GetTextMetrics    (GDI.93)
1209  */
1210 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1211 {
1212     TEXTMETRICW tm32;
1213
1214     if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1215
1216     tm->tmHeight           = tm32.tmHeight;
1217     tm->tmAscent           = tm32.tmAscent;
1218     tm->tmDescent          = tm32.tmDescent;
1219     tm->tmInternalLeading  = tm32.tmInternalLeading;
1220     tm->tmExternalLeading  = tm32.tmExternalLeading;
1221     tm->tmAveCharWidth     = tm32.tmAveCharWidth;
1222     tm->tmMaxCharWidth     = tm32.tmMaxCharWidth;
1223     tm->tmWeight           = tm32.tmWeight;
1224     tm->tmOverhang         = tm32.tmOverhang;
1225     tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1226     tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1227     tm->tmFirstChar        = tm32.tmFirstChar;
1228     tm->tmLastChar         = tm32.tmLastChar;
1229     tm->tmDefaultChar      = tm32.tmDefaultChar;
1230     tm->tmBreakChar        = tm32.tmBreakChar;
1231     tm->tmItalic           = tm32.tmItalic;
1232     tm->tmUnderlined       = tm32.tmUnderlined;
1233     tm->tmStruckOut        = tm32.tmStruckOut;
1234     tm->tmPitchAndFamily   = tm32.tmPitchAndFamily;
1235     tm->tmCharSet          = tm32.tmCharSet;
1236     return TRUE;
1237 }
1238
1239
1240 /***********************************************************************
1241  *              GetViewportExt (GDI.94)
1242  */
1243 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1244 {
1245     SIZE size;
1246     if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1247     return MAKELONG( size.cx, size.cy );
1248 }
1249
1250
1251 /***********************************************************************
1252  *              GetViewportOrg (GDI.95)
1253  */
1254 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1255 {
1256     POINT pt;
1257     if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1258     return MAKELONG( pt.x, pt.y );
1259 }
1260
1261
1262 /***********************************************************************
1263  *              GetWindowExt (GDI.96)
1264  */
1265 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1266 {
1267     SIZE size;
1268     if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1269     return MAKELONG( size.cx, size.cy );
1270 }
1271
1272
1273 /***********************************************************************
1274  *              GetWindowOrg (GDI.97)
1275  */
1276 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1277 {
1278     POINT pt;
1279     if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1280     return MAKELONG( pt.x, pt.y );
1281 }
1282
1283
1284
1285
1286 /**********************************************************************
1287  *           LineDDA   (GDI.100)
1288  */
1289 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1290                        INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1291 {
1292     struct callback16_info info;
1293     info.proc  = (FARPROC16)proc;
1294     info.param = lParam;
1295     LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1296 }
1297
1298
1299 /***********************************************************************
1300  *           OffsetRgn    (GDI.101)
1301  */
1302 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1303 {
1304     return OffsetRgn( HRGN_32(hrgn), x, y );
1305 }
1306
1307
1308 /***********************************************************************
1309  *           PtVisible    (GDI.103)
1310  */
1311 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1312 {
1313     return PtVisible( HDC_32(hdc), x, y );
1314 }
1315
1316
1317 /***********************************************************************
1318  *           SetBitmapBits    (GDI.106)
1319  */
1320 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1321 {
1322     return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1323 }
1324
1325
1326 /***********************************************************************
1327  *           AddFontResource    (GDI.119)
1328  */
1329 INT16 WINAPI AddFontResource16( LPCSTR filename )
1330 {
1331     return AddFontResourceA( filename );
1332 }
1333
1334
1335 /***********************************************************************
1336  *           Death    (GDI.121)
1337  *
1338  * Disables GDI, switches back to text mode.
1339  * We don't have to do anything here,
1340  * just let console support handle everything
1341  */
1342 void WINAPI Death16(HDC16 hdc)
1343 {
1344     MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1345 }
1346
1347
1348 /***********************************************************************
1349  *           Resurrection    (GDI.122)
1350  *
1351  * Restores GDI functionality
1352  */
1353 void WINAPI Resurrection16(HDC16 hdc,
1354                            WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1355 {
1356     MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1357             hdc, w1, w2, w3, w4, w5, w6);
1358 }
1359
1360
1361 /**********************************************************************
1362  *           CreateMetaFile     (GDI.125)
1363  */
1364 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1365 {
1366     return HDC_16( CreateMetaFileA( filename ) );
1367 }
1368
1369
1370 /***********************************************************************
1371  *           MulDiv   (GDI.128)
1372  */
1373 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1374 {
1375     INT ret;
1376     if (!nDivisor) return -32768;
1377     /* We want to deal with a positive divisor to simplify the logic. */
1378     if (nDivisor < 0)
1379     {
1380       nMultiplicand = - nMultiplicand;
1381       nDivisor = -nDivisor;
1382     }
1383     /* If the result is positive, we "add" to round. else,
1384      * we subtract to round. */
1385     if ( ( (nMultiplicand <  0) && (nMultiplier <  0) ) ||
1386          ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1387         ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1388     else
1389         ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1390     if ((ret > 32767) || (ret < -32767)) return -32768;
1391     return (INT16) ret;
1392 }
1393
1394
1395 /***********************************************************************
1396  *           GetRgnBox    (GDI.134)
1397  */
1398 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1399 {
1400     RECT r;
1401     INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1402     CONV_RECT32TO16( &r, rect );
1403     return ret;
1404 }
1405
1406
1407 /***********************************************************************
1408  *           RemoveFontResource    (GDI.136)
1409  */
1410 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1411 {
1412     return RemoveFontResourceA(str);
1413 }
1414
1415
1416 /***********************************************************************
1417  *           SetBrushOrg    (GDI.148)
1418  */
1419 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1420 {
1421     POINT pt;
1422
1423     if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1424     return MAKELONG( pt.x, pt.y );
1425 }
1426
1427
1428 /***********************************************************************
1429  *              GetBrushOrg (GDI.149)
1430  */
1431 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1432 {
1433     POINT pt;
1434     if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1435     return MAKELONG( pt.x, pt.y );
1436 }
1437
1438
1439 /***********************************************************************
1440  *           UnrealizeObject    (GDI.150)
1441  */
1442 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1443 {
1444     return UnrealizeObject( HGDIOBJ_32(obj) );
1445 }
1446
1447
1448 /***********************************************************************
1449  *           CreateIC    (GDI.153)
1450  */
1451 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1452                          const DEVMODEA* initData )
1453 {
1454     return HDC_16( CreateICA( driver, device, output, initData ) );
1455 }
1456
1457
1458 /***********************************************************************
1459  *           GetNearestColor   (GDI.154)
1460  */
1461 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1462 {
1463     return GetNearestColor( HDC_32(hdc), color );
1464 }
1465
1466
1467 /***********************************************************************
1468  *           CreateDiscardableBitmap    (GDI.156)
1469  */
1470 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1471 {
1472     return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1473 }
1474
1475
1476 /***********************************************************************
1477  *           PtInRegion    (GDI.161)
1478  */
1479 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1480 {
1481     return PtInRegion( HRGN_32(hrgn), x, y );
1482 }
1483
1484
1485 /***********************************************************************
1486  *           GetBitmapDimension    (GDI.162)
1487  */
1488 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1489 {
1490     SIZE16 size;
1491     if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1492     return MAKELONG( size.cx, size.cy );
1493 }
1494
1495
1496 /***********************************************************************
1497  *           SetBitmapDimension    (GDI.163)
1498  */
1499 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1500 {
1501     SIZE16 size;
1502     if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1503     return MAKELONG( size.cx, size.cy );
1504 }
1505
1506
1507 /***********************************************************************
1508  *           SetRectRgn    (GDI.172)
1509  *
1510  * NOTE: Win 3.1 sets region to empty if left > right
1511  */
1512 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1513 {
1514     if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1515     else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1516 }
1517
1518
1519 /******************************************************************
1520  *             PlayMetaFileRecord   (GDI.176)
1521  */
1522 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1523 {
1524     HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1525     unsigned int i;
1526
1527     for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1528     PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1529     for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1530     HeapFree( GetProcessHeap(), 0, ht32 );
1531 }
1532
1533
1534 /***********************************************************************
1535  *           GetCharABCWidths   (GDI.307)
1536  */
1537 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1538 {
1539     BOOL ret;
1540     UINT i;
1541     LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1542
1543     if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1544     {
1545         for (i = firstChar; i <= lastChar; i++)
1546         {
1547             abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1548             abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1549             abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1550         }
1551     }
1552     HeapFree( GetProcessHeap(), 0, abc32 );
1553     return ret;
1554 }
1555
1556
1557 /***********************************************************************
1558  *           CreateScalableFontResource   (GDI.310)
1559  */
1560 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1561                                             LPCSTR fontFile, LPCSTR path )
1562 {
1563     return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1564 }
1565
1566
1567 /*************************************************************************
1568  *             GetFontData    (GDI.311)
1569  *
1570  */
1571 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1572 {
1573     return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1574 }
1575
1576
1577 /*************************************************************************
1578  *             GetRasterizerCaps   (GDI.313)
1579  */
1580 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1581 {
1582     return GetRasterizerCaps( lprs, cbNumBytes );
1583 }
1584
1585
1586 /*************************************************************************
1587  *             GetKerningPairs   (GDI.332)
1588  *
1589  */
1590 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1591 {
1592     KERNINGPAIR *pairs32;
1593     INT i, ret;
1594
1595     if (!count) return 0;
1596
1597     if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1598     if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1599     {
1600         for (i = 0; i < ret; i++)
1601         {
1602             pairs->wFirst      = pairs32->wFirst;
1603             pairs->wSecond     = pairs32->wSecond;
1604             pairs->iKernAmount = pairs32->iKernAmount;
1605         }
1606     }
1607     HeapFree( GetProcessHeap(), 0, pairs32 );
1608     return ret;
1609 }
1610
1611
1612
1613 /***********************************************************************
1614  *              GetTextAlign (GDI.345)
1615  */
1616 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1617 {
1618     return GetTextAlign( HDC_32(hdc) );
1619 }
1620
1621
1622 /***********************************************************************
1623  *           SetTextAlign    (GDI.346)
1624  */
1625 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1626 {
1627     return SetTextAlign( HDC_32(hdc), align );
1628 }
1629
1630
1631 /***********************************************************************
1632  *           Chord    (GDI.348)
1633  */
1634 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1635                        INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1636                        INT16 xend, INT16 yend )
1637 {
1638     return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1639 }
1640
1641
1642 /***********************************************************************
1643  *           SetMapperFlags    (GDI.349)
1644  */
1645 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1646 {
1647     return SetMapperFlags( HDC_32(hdc), flags );
1648 }
1649
1650
1651 /***********************************************************************
1652  *           GetCharWidth    (GDI.350)
1653  */
1654 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
1655 {
1656     BOOL retVal = FALSE;
1657
1658     if( firstChar != lastChar )
1659     {
1660         LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
1661         if( buf32 )
1662         {
1663             LPINT obuf32 = buf32;
1664             int i;
1665
1666             retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
1667             if (retVal)
1668             {
1669                 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
1670             }
1671             HeapFree(GetProcessHeap(), 0, obuf32);
1672         }
1673     }
1674     else /* happens quite often to warrant a special treatment */
1675     {
1676         INT chWidth;
1677         retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
1678         *buffer = chWidth;
1679     }
1680     return retVal;
1681 }
1682
1683
1684 /***********************************************************************
1685  *           ExtTextOut   (GDI.351)
1686  */
1687 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
1688                             const RECT16 *lprect, LPCSTR str, UINT16 count,
1689                             const INT16 *lpDx )
1690 {
1691     BOOL        ret;
1692     int         i;
1693     RECT        rect32;
1694     LPINT       lpdx32 = NULL;
1695
1696     if (lpDx) {
1697         lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
1698         if(lpdx32 == NULL) return FALSE;
1699         for (i=count;i--;) lpdx32[i]=lpDx[i];
1700     }
1701     if (lprect) CONV_RECT16TO32(lprect,&rect32);
1702     ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
1703     if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
1704     return ret;
1705 }
1706
1707
1708 /***********************************************************************
1709  *           CreatePalette    (GDI.360)
1710  */
1711 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
1712 {
1713     return HPALETTE_16( CreatePalette( palette ) );
1714 }
1715
1716
1717 /***********************************************************************
1718  *           GDISelectPalette   (GDI.361)
1719  */
1720 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
1721 {
1722     return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
1723 }
1724
1725
1726 /***********************************************************************
1727  *           GDIRealizePalette   (GDI.362)
1728  */
1729 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
1730 {
1731     return GDIRealizePalette( HDC_32(hdc) );
1732 }
1733
1734
1735 /***********************************************************************
1736  *           GetPaletteEntries    (GDI.363)
1737  */
1738 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1739                                    UINT16 count, LPPALETTEENTRY entries )
1740 {
1741     return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1742 }
1743
1744
1745 /***********************************************************************
1746  *           SetPaletteEntries    (GDI.364)
1747  */
1748 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1749                                    UINT16 count, const PALETTEENTRY *entries )
1750 {
1751     return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1752 }
1753
1754
1755 /**********************************************************************
1756  *            UpdateColors   (GDI.366)
1757  */
1758 INT16 WINAPI UpdateColors16( HDC16 hdc )
1759 {
1760     UpdateColors( HDC_32(hdc) );
1761     return TRUE;
1762 }
1763
1764
1765 /***********************************************************************
1766  *           AnimatePalette   (GDI.367)
1767  */
1768 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
1769                               UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
1770 {
1771     AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
1772 }
1773
1774
1775 /***********************************************************************
1776  *           ResizePalette   (GDI.368)
1777  */
1778 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
1779 {
1780     return ResizePalette( HPALETTE_32(hpalette), cEntries );
1781 }
1782
1783
1784 /***********************************************************************
1785  *           GetNearestPaletteIndex   (GDI.370)
1786  */
1787 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
1788 {
1789     return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
1790 }
1791
1792
1793 /**********************************************************************
1794  *          ExtFloodFill   (GDI.372)
1795  */
1796 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
1797                               UINT16 fillType )
1798 {
1799     return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
1800 }
1801
1802
1803 /***********************************************************************
1804  *           SetSystemPaletteUse   (GDI.373)
1805  */
1806 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
1807 {
1808     return SetSystemPaletteUse( HDC_32(hdc), use );
1809 }
1810
1811
1812 /***********************************************************************
1813  *           GetSystemPaletteUse   (GDI.374)
1814  */
1815 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
1816 {
1817     return GetSystemPaletteUse( HDC_32(hdc) );
1818 }
1819
1820
1821 /***********************************************************************
1822  *           GetSystemPaletteEntries   (GDI.375)
1823  */
1824 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
1825                                          LPPALETTEENTRY entries )
1826 {
1827     return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
1828 }
1829
1830
1831 /***********************************************************************
1832  *           ResetDC    (GDI.376)
1833  */
1834 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
1835 {
1836     return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
1837 }
1838
1839
1840 /******************************************************************
1841  *           StartDoc   (GDI.377)
1842  */
1843 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
1844 {
1845     DOCINFOA docA;
1846
1847     docA.cbSize = lpdoc->cbSize;
1848     docA.lpszDocName = MapSL(lpdoc->lpszDocName);
1849     docA.lpszOutput = MapSL(lpdoc->lpszOutput);
1850     if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
1851         docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
1852     else
1853         docA.lpszDatatype = NULL;
1854     if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
1855         docA.fwType = lpdoc->fwType;
1856     else
1857         docA.fwType = 0;
1858     return StartDocA( HDC_32(hdc), &docA );
1859 }
1860
1861
1862 /******************************************************************
1863  *           EndDoc   (GDI.378)
1864  */
1865 INT16 WINAPI EndDoc16( HDC16 hdc )
1866 {
1867     return EndDoc( HDC_32(hdc) );
1868 }
1869
1870
1871 /******************************************************************
1872  *           StartPage   (GDI.379)
1873  */
1874 INT16 WINAPI StartPage16( HDC16 hdc )
1875 {
1876     return StartPage( HDC_32(hdc) );
1877 }
1878
1879
1880 /******************************************************************
1881  *           EndPage   (GDI.380)
1882  */
1883 INT16 WINAPI EndPage16( HDC16 hdc )
1884 {
1885     return EndPage( HDC_32(hdc) );
1886 }
1887
1888
1889 /******************************************************************************
1890  *           AbortDoc   (GDI.382)
1891  */
1892 INT16 WINAPI AbortDoc16( HDC16 hdc )
1893 {
1894     return AbortDoc( HDC_32(hdc) );
1895 }
1896
1897
1898 /***********************************************************************
1899  *           FastWindowFrame    (GDI.400)
1900  */
1901 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
1902                                INT16 width, INT16 height, DWORD rop )
1903 {
1904     HDC hdc32 = HDC_32(hdc);
1905     HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
1906     PatBlt( hdc32, rect->left, rect->top,
1907             rect->right - rect->left - width, height, rop );
1908     PatBlt( hdc32, rect->left, rect->top + height, width,
1909             rect->bottom - rect->top - height, rop );
1910     PatBlt( hdc32, rect->left + width, rect->bottom - 1,
1911             rect->right - rect->left - width, -height, rop );
1912     PatBlt( hdc32, rect->right - 1, rect->top, -width,
1913             rect->bottom - rect->top - height, rop );
1914     SelectObject( hdc32, hbrush );
1915     return TRUE;
1916 }
1917
1918
1919 /***********************************************************************
1920  *           CreateUserBitmap    (GDI.407)
1921  */
1922 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
1923                                      UINT16 bpp, LPCVOID bits )
1924 {
1925     return CreateBitmap16( width, height, planes, bpp, bits );
1926 }
1927
1928
1929 /***********************************************************************
1930  *           CreateUserDiscardableBitmap    (GDI.409)
1931  */
1932 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
1933 {
1934     HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
1935     HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
1936     DeleteDC( hdc );
1937     return HBITMAP_16(ret);
1938 }
1939
1940
1941 /***********************************************************************
1942  *              GetCurLogFont (GDI.411)
1943  */
1944 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
1945 {
1946     return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
1947 }
1948
1949
1950 /***********************************************************************
1951  *           StretchDIBits   (GDI.439)
1952  */
1953 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
1954                               INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
1955                               INT16 heightSrc, const VOID *bits,
1956                               const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
1957 {
1958     return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
1959                           xSrc, ySrc, widthSrc, heightSrc, bits,
1960                           info, wUsage, dwRop );
1961 }
1962
1963
1964 /***********************************************************************
1965  *           SetDIBits    (GDI.440)
1966  */
1967 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1968                           UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
1969                           UINT16 coloruse )
1970 {
1971     return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
1972 }
1973
1974
1975 /***********************************************************************
1976  *           GetDIBits    (GDI.441)
1977  */
1978 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1979                           UINT16 lines, LPVOID bits, BITMAPINFO * info,
1980                           UINT16 coloruse )
1981 {
1982     return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
1983 }
1984
1985
1986 /***********************************************************************
1987  *           CreateDIBitmap    (GDI.442)
1988  */
1989 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
1990                                    DWORD init, LPCVOID bits, const BITMAPINFO * data,
1991                                    UINT16 coloruse )
1992 {
1993     return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
1994 }
1995
1996
1997 /***********************************************************************
1998  *           SetDIBitsToDevice    (GDI.443)
1999  */
2000 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2001                                   INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2002                                   UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2003                                   UINT16 coloruse )
2004 {
2005     return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2006                               startscan, lines, bits, info, coloruse );
2007 }
2008
2009
2010 /***********************************************************************
2011  *           CreateRoundRectRgn    (GDI.444)
2012  *
2013  * If either ellipse dimension is zero we call CreateRectRgn16 for its
2014  * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2015  * we just let CreateRoundRectRgn convert them to +ve values.
2016  */
2017
2018 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2019                                     INT16 ellipse_width, INT16 ellipse_height )
2020 {
2021     if( ellipse_width == 0 || ellipse_height == 0 )
2022         return CreateRectRgn16( left, top, right, bottom );
2023     else
2024         return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2025                                             ellipse_width, ellipse_height ));
2026 }
2027
2028
2029 /***********************************************************************
2030  *           CreateDIBPatternBrush    (GDI.445)
2031  */
2032 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2033 {
2034     BITMAPINFO *bmi;
2035     HBRUSH16 ret;
2036
2037     if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2038     ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2039     GlobalUnlock16( hbitmap );
2040     return ret;
2041 }
2042
2043
2044 /**********************************************************************
2045  *          PolyPolygon (GDI.450)
2046  */
2047 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2048                              UINT16 polygons )
2049 {
2050     int         i,nrpts;
2051     LPPOINT     pt32;
2052     LPINT       counts32;
2053     BOOL16      ret;
2054
2055     nrpts=0;
2056     for (i=polygons;i--;)
2057         nrpts+=counts[i];
2058     pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2059     if(pt32 == NULL) return FALSE;
2060     for (i=nrpts;i--;)
2061         CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
2062     counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2063     if(counts32 == NULL) {
2064         HeapFree( GetProcessHeap(), 0, pt32 );
2065         return FALSE;
2066     }
2067     for (i=polygons;i--;) counts32[i]=counts[i];
2068
2069     ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2070     HeapFree( GetProcessHeap(), 0, counts32 );
2071     HeapFree( GetProcessHeap(), 0, pt32 );
2072     return ret;
2073 }
2074
2075
2076 /***********************************************************************
2077  *           CreatePolyPolygonRgn    (GDI.451)
2078  */
2079 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2080                                       const INT16 *count, INT16 nbpolygons, INT16 mode )
2081 {
2082     HRGN hrgn;
2083     int i, npts = 0;
2084     INT *count32;
2085     POINT *points32;
2086
2087     for (i = 0; i < nbpolygons; i++) npts += count[i];
2088     points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2089     for (i = 0; i < npts; i++) CONV_POINT16TO32( &(points[i]), &(points32[i]) );
2090
2091     count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2092     for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2093     hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2094     HeapFree( GetProcessHeap(), 0, count32 );
2095     HeapFree( GetProcessHeap(), 0, points32 );
2096     return HRGN_16(hrgn);
2097 }
2098
2099
2100 /***********************************************************************
2101  *           SetObjectOwner    (GDI.461)
2102  */
2103 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2104 {
2105     /* Nothing to do */
2106 }
2107
2108
2109 /***********************************************************************
2110  *           RectVisible    (GDI.465)
2111  *           RectVisibleOld (GDI.104)
2112  */
2113 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2114 {
2115     RECT rect;
2116     CONV_RECT16TO32( rect16, &rect );
2117     return RectVisible( HDC_32(hdc), &rect );
2118 }
2119
2120
2121 /***********************************************************************
2122  *           RectInRegion    (GDI.466)
2123  *           RectInRegionOld (GDI.181)
2124  */
2125 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2126 {
2127     RECT r32;
2128
2129     CONV_RECT16TO32(rect, &r32);
2130     return RectInRegion( HRGN_32(hrgn), &r32 );
2131 }
2132
2133
2134 /***********************************************************************
2135  *           GetBitmapDimensionEx    (GDI.468)
2136  */
2137 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2138 {
2139     SIZE size32;
2140     BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2141
2142     if (ret)
2143     {
2144         size->cx = size32.cx;
2145         size->cy = size32.cy;
2146     }
2147     return ret;
2148 }
2149
2150
2151 /***********************************************************************
2152  *              GetBrushOrgEx (GDI.469)
2153  */
2154 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2155 {
2156     POINT pt32;
2157     if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2158     pt->x = pt32.x;
2159     pt->y = pt32.y;
2160     return TRUE;
2161 }
2162
2163
2164 /***********************************************************************
2165  *              GetCurrentPositionEx (GDI.470)
2166  */
2167 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2168 {
2169     POINT pt32;
2170     if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2171     pt->x = pt32.x;
2172     pt->y = pt32.y;
2173     return TRUE;
2174 }
2175
2176
2177 /***********************************************************************
2178  *           GetTextExtentPoint    (GDI.471)
2179  *
2180  * FIXME: Should this have a bug for compatibility?
2181  * Original Windows versions of GetTextExtentPoint{A,W} have documented
2182  * bugs (-> MSDN KB q147647.txt).
2183  */
2184 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2185 {
2186     SIZE size32;
2187     BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2188
2189     if (ret)
2190     {
2191         size->cx = size32.cx;
2192         size->cy = size32.cy;
2193     }
2194     return ret;
2195 }
2196
2197
2198 /***********************************************************************
2199  *              GetViewportExtEx (GDI.472)
2200  */
2201 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2202 {
2203     SIZE size32;
2204     if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2205     size->cx = size32.cx;
2206     size->cy = size32.cy;
2207     return TRUE;
2208 }
2209
2210
2211 /***********************************************************************
2212  *              GetViewportOrgEx (GDI.473)
2213  */
2214 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2215 {
2216     POINT pt32;
2217     if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2218     pt->x = pt32.x;
2219     pt->y = pt32.y;
2220     return TRUE;
2221 }
2222
2223
2224 /***********************************************************************
2225  *              GetWindowExtEx (GDI.474)
2226  */
2227 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2228 {
2229     SIZE size32;
2230     if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2231     size->cx = size32.cx;
2232     size->cy = size32.cy;
2233     return TRUE;
2234 }
2235
2236
2237 /***********************************************************************
2238  *              GetWindowOrgEx (GDI.475)
2239  */
2240 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2241 {
2242     POINT pt32;
2243     if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2244     pt->x = pt32.x;
2245     pt->y = pt32.y;
2246     return TRUE;
2247 }
2248
2249
2250 /***********************************************************************
2251  *           OffsetViewportOrgEx    (GDI.476)
2252  */
2253 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2254 {
2255     POINT pt32;
2256     BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2257     if (pt) CONV_POINT32TO16( &pt32, pt );
2258     return ret;
2259 }
2260
2261
2262 /***********************************************************************
2263  *           OffsetWindowOrgEx    (GDI.477)
2264  */
2265 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2266 {
2267     POINT pt32;
2268     BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2269     if (pt) CONV_POINT32TO16( &pt32, pt );
2270     return ret;
2271 }
2272
2273
2274 /***********************************************************************
2275  *           SetBitmapDimensionEx    (GDI.478)
2276  */
2277 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2278 {
2279     SIZE size32;
2280     BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2281
2282     if (ret && prevSize)
2283     {
2284         prevSize->cx = size32.cx;
2285         prevSize->cy = size32.cy;
2286     }
2287     return ret;
2288 }
2289
2290
2291 /***********************************************************************
2292  *           SetViewportExtEx    (GDI.479)
2293  */
2294 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2295 {
2296     SIZE size32;
2297     BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2298     if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2299     return ret;
2300 }
2301
2302
2303 /***********************************************************************
2304  *           SetViewportOrgEx    (GDI.480)
2305  */
2306 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2307 {
2308     POINT pt32;
2309     BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2310     if (pt) CONV_POINT32TO16( &pt32, pt );
2311     return ret;
2312 }
2313
2314
2315 /***********************************************************************
2316  *           SetWindowExtEx    (GDI.481)
2317  */
2318 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2319 {
2320     SIZE size32;
2321     BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2322     if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2323     return ret;
2324 }
2325
2326
2327 /***********************************************************************
2328  *           SetWindowOrgEx    (GDI.482)
2329  */
2330 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2331 {
2332     POINT pt32;
2333     BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2334     if (pt) CONV_POINT32TO16( &pt32, pt );
2335     return ret;
2336 }
2337
2338
2339 /***********************************************************************
2340  *           MoveToEx    (GDI.483)
2341  */
2342 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2343 {
2344     POINT pt32;
2345
2346     if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2347     if (pt) CONV_POINT32TO16( &pt32, pt );
2348     return TRUE;
2349 }
2350
2351
2352 /***********************************************************************
2353  *           ScaleViewportExtEx    (GDI.484)
2354  */
2355 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2356                                     INT16 yNum, INT16 yDenom, LPSIZE16 size )
2357 {
2358     SIZE size32;
2359     BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2360                                        &size32 );
2361     if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2362     return ret;
2363 }
2364
2365
2366 /***********************************************************************
2367  *           ScaleWindowExtEx    (GDI.485)
2368  */
2369 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2370                                   INT16 yNum, INT16 yDenom, LPSIZE16 size )
2371 {
2372     SIZE size32;
2373     BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2374                                      &size32 );
2375     if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2376     return ret;
2377 }
2378
2379
2380 /******************************************************************************
2381  *           PolyBezier  (GDI.502)
2382  */
2383 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2384 {
2385     int i;
2386     BOOL16 ret;
2387     LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2388                                            cPoints*sizeof(POINT) );
2389     if(!pt32) return FALSE;
2390     for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2391     ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2392     HeapFree( GetProcessHeap(), 0, pt32 );
2393     return ret;
2394 }
2395
2396
2397 /******************************************************************************
2398  *           PolyBezierTo  (GDI.503)
2399  */
2400 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2401 {
2402     int i;
2403     BOOL16 ret;
2404     LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2405                                            cPoints*sizeof(POINT) );
2406     if(!pt32) return FALSE;
2407     for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2408     ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2409     HeapFree( GetProcessHeap(), 0, pt32 );
2410     return ret;
2411 }
2412
2413
2414 /******************************************************************************
2415  *           ExtSelectClipRgn   (GDI.508)
2416  */
2417 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2418 {
2419   return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2420 }
2421
2422
2423 /***********************************************************************
2424  *           AbortPath    (GDI.511)
2425  */
2426 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2427 {
2428     return AbortPath( HDC_32(hdc) );
2429 }
2430
2431
2432 /***********************************************************************
2433  *           BeginPath    (GDI.512)
2434  */
2435 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2436 {
2437     return BeginPath( HDC_32(hdc) );
2438 }
2439
2440
2441 /***********************************************************************
2442  *           CloseFigure    (GDI.513)
2443  */
2444 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2445 {
2446     return CloseFigure( HDC_32(hdc) );
2447 }
2448
2449
2450 /***********************************************************************
2451  *           EndPath    (GDI.514)
2452  */
2453 BOOL16 WINAPI EndPath16(HDC16 hdc)
2454 {
2455     return EndPath( HDC_32(hdc) );
2456 }
2457
2458
2459 /***********************************************************************
2460  *           FillPath    (GDI.515)
2461  */
2462 BOOL16 WINAPI FillPath16(HDC16 hdc)
2463 {
2464     return FillPath( HDC_32(hdc) );
2465 }
2466
2467
2468 /*******************************************************************
2469  *           FlattenPath    (GDI.516)
2470  */
2471 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2472 {
2473     return FlattenPath( HDC_32(hdc) );
2474 }
2475
2476
2477 /***********************************************************************
2478  *           GetPath    (GDI.517)
2479  */
2480 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2481 {
2482     FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2483     return 0;
2484 }
2485
2486
2487 /***********************************************************************
2488  *           PathToRegion    (GDI.518)
2489  */
2490 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2491 {
2492     return HRGN_16( PathToRegion( HDC_32(hdc) ));
2493 }
2494
2495
2496 /***********************************************************************
2497  *           SelectClipPath    (GDI.519)
2498  */
2499 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2500 {
2501     return SelectClipPath( HDC_32(hdc), iMode );
2502 }
2503
2504
2505 /*******************************************************************
2506  *           StrokeAndFillPath    (GDI.520)
2507  */
2508 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
2509 {
2510     return StrokeAndFillPath( HDC_32(hdc) );
2511 }
2512
2513
2514 /*******************************************************************
2515  *           StrokePath    (GDI.521)
2516  */
2517 BOOL16 WINAPI StrokePath16(HDC16 hdc)
2518 {
2519     return StrokePath( HDC_32(hdc) );
2520 }
2521
2522
2523 /*******************************************************************
2524  *           WidenPath    (GDI.522)
2525  */
2526 BOOL16 WINAPI WidenPath16(HDC16 hdc)
2527 {
2528     return WidenPath( HDC_32(hdc) );
2529 }
2530
2531
2532 /***********************************************************************
2533  *              GetArcDirection (GDI.524)
2534  */
2535 INT16 WINAPI GetArcDirection16( HDC16 hdc )
2536 {
2537     return GetArcDirection( HDC_32(hdc) );
2538 }
2539
2540
2541 /***********************************************************************
2542  *           SetArcDirection    (GDI.525)
2543  */
2544 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
2545 {
2546     return SetArcDirection( HDC_32(hdc), (INT)nDirection );
2547 }
2548
2549
2550 /***********************************************************************
2551  *           CreateHalftonePalette (GDI.529)
2552  */
2553 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
2554 {
2555     return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
2556 }
2557
2558
2559 /***********************************************************************
2560  *           SetDIBColorTable    (GDI.602)
2561  */
2562 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2563 {
2564     return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2565 }
2566
2567
2568 /***********************************************************************
2569  *           GetDIBColorTable    (GDI.603)
2570  */
2571 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2572 {
2573     return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2574 }
2575
2576
2577 /***********************************************************************
2578  *           GetRegionData   (GDI.607)
2579  *
2580  * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2581  */
2582 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
2583 {
2584     return GetRegionData( HRGN_32(hrgn), count, rgndata );
2585 }
2586
2587
2588 /***********************************************************************
2589  *           GetTextCharset   (GDI.612)
2590  */
2591 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
2592 {
2593     return GetTextCharset( HDC_32(hdc) );
2594 }
2595
2596
2597 /*************************************************************************
2598  *             GetFontLanguageInfo   (GDI.616)
2599  */
2600 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
2601 {
2602     return GetFontLanguageInfo( HDC_32(hdc) );
2603 }
2604
2605
2606 /***********************************************************************
2607  *           SetLayout   (GDI.1000)
2608  *
2609  * Sets left->right or right->left text layout flags of a dc.
2610  */
2611 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
2612 {
2613     return SetLayout( HDC_32(hdc), layout );
2614 }