gdi32: Move a few more gdiobj functions to gdi16.c.
[wine.git] / dlls / gdi32 / gdi16.c
blob069c52836088584952bf440fe1a0d27897197988
1 /*
2 * GDI 16-bit functions
4 * Copyright 2002 Alexandre Julliard
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "wownt32.h"
27 #include "wine/wingdi16.h"
28 #include "gdi_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
33 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
34 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
36 struct callback16_info
38 FARPROC16 proc;
39 LPARAM param;
42 /* callback for LineDDA16 */
43 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
45 const struct callback16_info *info = (struct callback16_info *)param;
46 WORD args[4];
48 args[3] = x;
49 args[2] = y;
50 args[1] = HIWORD(info->param);
51 args[0] = LOWORD(info->param);
52 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, NULL );
55 /* callback for EnumObjects16 */
56 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
58 const struct callback16_info *info = (struct callback16_info *)param;
59 LOGPEN *pen = ptr;
60 LOGPEN16 pen16;
61 SEGPTR segptr;
62 DWORD ret;
63 WORD args[4];
65 pen16.lopnStyle = pen->lopnStyle;
66 pen16.lopnWidth.x = pen->lopnWidth.x;
67 pen16.lopnWidth.y = pen->lopnWidth.y;
68 pen16.lopnColor = pen->lopnColor;
69 segptr = MapLS( &pen16 );
70 args[3] = SELECTOROF(segptr);
71 args[2] = OFFSETOF(segptr);
72 args[1] = HIWORD(info->param);
73 args[0] = LOWORD(info->param);
74 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
75 UnMapLS( segptr );
76 return LOWORD(ret);
79 /* callback for EnumObjects16 */
80 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
82 const struct callback16_info *info = (struct callback16_info *)param;
83 LOGBRUSH *brush = ptr;
84 LOGBRUSH16 brush16;
85 SEGPTR segptr;
86 DWORD ret;
87 WORD args[4];
89 brush16.lbStyle = brush->lbStyle;
90 brush16.lbColor = brush->lbColor;
91 brush16.lbHatch = brush->lbHatch;
92 segptr = MapLS( &brush16 );
93 args[3] = SELECTOROF(segptr);
94 args[2] = OFFSETOF(segptr);
95 args[1] = HIWORD(info->param);
96 args[0] = LOWORD(info->param);
97 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
98 UnMapLS( segptr );
99 return ret;
102 /* convert a LOGFONT16 to a LOGFONTW */
103 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
105 font32->lfHeight = font16->lfHeight;
106 font32->lfWidth = font16->lfWidth;
107 font32->lfEscapement = font16->lfEscapement;
108 font32->lfOrientation = font16->lfOrientation;
109 font32->lfWeight = font16->lfWeight;
110 font32->lfItalic = font16->lfItalic;
111 font32->lfUnderline = font16->lfUnderline;
112 font32->lfStrikeOut = font16->lfStrikeOut;
113 font32->lfCharSet = font16->lfCharSet;
114 font32->lfOutPrecision = font16->lfOutPrecision;
115 font32->lfClipPrecision = font16->lfClipPrecision;
116 font32->lfQuality = font16->lfQuality;
117 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
118 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
119 font32->lfFaceName[LF_FACESIZE-1] = 0;
122 /* convert a LOGFONTW to a LOGFONT16 */
123 static void logfont_W_to_16( const LOGFONTW* font32, LPLOGFONT16 font16 )
125 font16->lfHeight = font32->lfHeight;
126 font16->lfWidth = font32->lfWidth;
127 font16->lfEscapement = font32->lfEscapement;
128 font16->lfOrientation = font32->lfOrientation;
129 font16->lfWeight = font32->lfWeight;
130 font16->lfItalic = font32->lfItalic;
131 font16->lfUnderline = font32->lfUnderline;
132 font16->lfStrikeOut = font32->lfStrikeOut;
133 font16->lfCharSet = font32->lfCharSet;
134 font16->lfOutPrecision = font32->lfOutPrecision;
135 font16->lfClipPrecision = font32->lfClipPrecision;
136 font16->lfQuality = font32->lfQuality;
137 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
138 WideCharToMultiByte( CP_ACP, 0, font32->lfFaceName, -1, font16->lfFaceName, LF_FACESIZE, NULL, NULL );
139 font16->lfFaceName[LF_FACESIZE-1] = 0;
142 /***********************************************************************
143 * SetBkColor (GDI.1)
145 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
147 return SetBkColor( HDC_32(hdc), color );
151 /***********************************************************************
152 * SetBkMode (GDI.2)
154 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
156 return SetBkMode( HDC_32(hdc), mode );
160 /***********************************************************************
161 * SetMapMode (GDI.3)
163 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
165 return SetMapMode( HDC_32(hdc), mode );
169 /***********************************************************************
170 * SetROP2 (GDI.4)
172 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
174 return SetROP2( HDC_32(hdc), mode );
178 /***********************************************************************
179 * SetRelAbs (GDI.5)
181 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
183 return SetRelAbs( HDC_32(hdc), mode );
187 /***********************************************************************
188 * SetPolyFillMode (GDI.6)
190 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
192 return SetPolyFillMode( HDC_32(hdc), mode );
196 /***********************************************************************
197 * SetStretchBltMode (GDI.7)
199 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
201 return SetStretchBltMode( HDC_32(hdc), mode );
205 /***********************************************************************
206 * SetTextCharacterExtra (GDI.8)
208 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
210 return SetTextCharacterExtra( HDC_32(hdc), extra );
214 /***********************************************************************
215 * SetTextColor (GDI.9)
217 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
219 return SetTextColor( HDC_32(hdc), color );
223 /***********************************************************************
224 * SetTextJustification (GDI.10)
226 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
228 return SetTextJustification( HDC_32(hdc), extra, breaks );
232 /***********************************************************************
233 * SetWindowOrg (GDI.11)
235 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
237 POINT pt;
238 if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
239 return MAKELONG( pt.x, pt.y );
243 /***********************************************************************
244 * SetWindowExt (GDI.12)
246 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
248 SIZE size;
249 if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
250 return MAKELONG( size.cx, size.cy );
254 /***********************************************************************
255 * SetViewportOrg (GDI.13)
257 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
259 POINT pt;
260 if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
261 return MAKELONG( pt.x, pt.y );
265 /***********************************************************************
266 * SetViewportExt (GDI.14)
268 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
270 SIZE size;
271 if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
272 return MAKELONG( size.cx, size.cy );
276 /***********************************************************************
277 * OffsetWindowOrg (GDI.15)
279 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
281 POINT pt;
282 if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
283 return MAKELONG( pt.x, pt.y );
287 /***********************************************************************
288 * ScaleWindowExt (GDI.16)
290 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
291 INT16 yNum, INT16 yDenom )
293 SIZE size;
294 if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
295 return FALSE;
296 return MAKELONG( size.cx, size.cy );
300 /***********************************************************************
301 * OffsetViewportOrg (GDI.17)
303 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
305 POINT pt;
306 if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
307 return MAKELONG( pt.x, pt.y );
311 /***********************************************************************
312 * ScaleViewportExt (GDI.18)
314 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
315 INT16 yNum, INT16 yDenom )
317 SIZE size;
318 if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
319 return FALSE;
320 return MAKELONG( size.cx, size.cy );
324 /***********************************************************************
325 * LineTo (GDI.19)
327 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
329 return LineTo( HDC_32(hdc), x, y );
333 /***********************************************************************
334 * MoveTo (GDI.20)
336 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
338 POINT pt;
340 if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
341 return MAKELONG(pt.x,pt.y);
345 /***********************************************************************
346 * ExcludeClipRect (GDI.21)
348 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
349 INT16 right, INT16 bottom )
351 return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
355 /***********************************************************************
356 * IntersectClipRect (GDI.22)
358 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
359 INT16 right, INT16 bottom )
361 return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
365 /***********************************************************************
366 * Arc (GDI.23)
368 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
369 INT16 bottom, INT16 xstart, INT16 ystart,
370 INT16 xend, INT16 yend )
372 return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
376 /***********************************************************************
377 * Ellipse (GDI.24)
379 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
380 INT16 right, INT16 bottom )
382 return Ellipse( HDC_32(hdc), left, top, right, bottom );
386 /**********************************************************************
387 * FloodFill (GDI.25)
389 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
391 return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
395 /***********************************************************************
396 * Pie (GDI.26)
398 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
399 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
400 INT16 xend, INT16 yend )
402 return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
406 /***********************************************************************
407 * Rectangle (GDI.27)
409 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
410 INT16 right, INT16 bottom )
412 return Rectangle( HDC_32(hdc), left, top, right, bottom );
416 /***********************************************************************
417 * RoundRect (GDI.28)
419 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
420 INT16 bottom, INT16 ell_width, INT16 ell_height )
422 return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
426 /***********************************************************************
427 * PatBlt (GDI.29)
429 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
430 INT16 width, INT16 height, DWORD rop)
432 return PatBlt( HDC_32(hdc), left, top, width, height, rop );
436 /***********************************************************************
437 * SaveDC (GDI.30)
439 INT16 WINAPI SaveDC16( HDC16 hdc )
441 return SaveDC( HDC_32(hdc) );
445 /***********************************************************************
446 * SetPixel (GDI.31)
448 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
450 return SetPixel( HDC_32(hdc), x, y, color );
454 /***********************************************************************
455 * OffsetClipRgn (GDI.32)
457 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
459 return OffsetClipRgn( HDC_32(hdc), x, y );
463 /***********************************************************************
464 * TextOut (GDI.33)
466 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
468 return TextOutA( HDC_32(hdc), x, y, str, count );
472 /***********************************************************************
473 * BitBlt (GDI.34)
475 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
476 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
477 DWORD rop )
479 return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
483 /***********************************************************************
484 * StretchBlt (GDI.35)
486 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
487 INT16 widthDst, INT16 heightDst,
488 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
489 INT16 widthSrc, INT16 heightSrc, DWORD rop )
491 return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
492 HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
496 /**********************************************************************
497 * Polygon (GDI.36)
499 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
501 register int i;
502 BOOL ret;
503 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) );
505 if (!pt32) return FALSE;
506 for (i=count;i--;)
508 pt32[i].x = pt[i].x;
509 pt32[i].y = pt[i].y;
511 ret = Polygon(HDC_32(hdc),pt32,count);
512 HeapFree( GetProcessHeap(), 0, pt32 );
513 return ret;
517 /**********************************************************************
518 * Polyline (GDI.37)
520 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
522 register int i;
523 BOOL16 ret;
524 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) );
526 if (!pt32) return FALSE;
527 for (i=count;i--;)
529 pt32[i].x = pt[i].x;
530 pt32[i].y = pt[i].y;
532 ret = Polyline(HDC_32(hdc),pt32,count);
533 HeapFree( GetProcessHeap(), 0, pt32 );
534 return ret;
538 /***********************************************************************
539 * Escape (GDI.38)
541 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
543 INT ret;
545 switch(escape)
547 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
548 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
549 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
550 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
551 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
552 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
553 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
554 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
555 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
556 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
557 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
558 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
559 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
560 case CLIP_TO_PATH:
561 case DRAFTMODE:
562 case ENUMPAPERBINS:
563 case EPSPRINTING:
564 case EXT_DEVICE_CAPS:
565 case GETCOLORTABLE:
566 case MOUSETRAILS:
567 case POSTSCRIPT_IGNORE:
568 case QUERYESCSUPPORT:
569 case SET_ARC_DIRECTION:
570 case SET_POLY_MODE:
571 case SET_SCREEN_ANGLE:
572 case SET_SPREAD:
574 INT16 *ptr = MapSL(in_data);
575 INT data = *ptr;
576 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
579 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
580 case ENABLEDUPLEX:
582 UINT16 *ptr = MapSL(in_data);
583 UINT data = *ptr;
584 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
587 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
588 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
589 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
590 case GETPHYSPAGESIZE:
591 case GETPRINTINGOFFSET:
592 case GETSCALINGFACTOR:
594 POINT16 *ptr = out_data;
595 POINT pt32;
596 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
597 ptr->x = pt32.x;
598 ptr->y = pt32.y;
599 return ret;
602 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
603 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
604 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
605 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
606 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
607 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
608 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
609 case ENABLEPAIRKERNING:
610 case ENABLERELATIVEWIDTHS:
611 case SETCOPYCOUNT:
612 case SETKERNTRACK:
613 case SETLINECAP:
614 case SETLINEJOIN:
615 case SETMITERLIMIT:
617 INT16 *new = MapSL(in_data);
618 INT16 *old = out_data;
619 INT out, in = *new;
620 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
621 *old = out;
622 return ret;
625 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
626 case SETABORTPROC:
627 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
629 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
630 * lpvOutData is actually a pointer to the DocInfo structure and used as
631 * a second input parameter */
632 case STARTDOC:
633 if (out_data)
635 ret = StartDoc16( hdc, out_data );
636 if (ret > 0) ret = StartPage( HDC_32(hdc) );
637 return ret;
639 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
641 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
642 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
643 case SET_BOUNDS:
644 case SET_CLIP_BOX:
646 RECT16 *rc16 = MapSL(in_data);
647 RECT rc;
648 rc.left = rc16->left;
649 rc.top = rc16->top;
650 rc.right = rc16->right;
651 rc.bottom = rc16->bottom;
652 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
655 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
656 case NEXTBAND:
658 RECT rc;
659 RECT16 *rc16 = out_data;
660 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
661 rc16->left = rc.left;
662 rc16->top = rc.top;
663 rc16->right = rc.right;
664 rc16->bottom = rc.bottom;
665 return ret;
667 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
668 case DRAWPATTERNRECT:
670 DRAWPATRECT pr;
671 DRAWPATRECT16 *pr16 = (DRAWPATRECT16*)MapSL(in_data);
673 pr.ptPosition.x = pr16->ptPosition.x;
674 pr.ptPosition.y = pr16->ptPosition.y;
675 pr.ptSize.x = pr16->ptSize.x;
676 pr.ptSize.y = pr16->ptSize.y;
677 pr.wStyle = pr16->wStyle;
678 pr.wPattern = pr16->wPattern;
679 return Escape( HDC_32(hdc), escape, sizeof(pr), (LPCSTR)&pr, NULL );
682 /* Escape(hdc,ABORTDOC,NULL,NULL); */
683 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
684 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
685 /* Escape(hdc,ENDDOC,NULL,NULL); */
686 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
687 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
688 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
689 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
690 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
691 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
692 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
693 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
694 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
695 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
696 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
697 /* Escape(hdc,NEWFRAME,NULL,NULL); */
698 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
699 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
700 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
701 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
702 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
703 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
704 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
705 case ABORTDOC:
706 case BANDINFO:
707 case BEGIN_PATH:
708 case ENDDOC:
709 case END_PATH:
710 case EXTTEXTOUT:
711 case FLUSHOUTPUT:
712 case GETFACENAME:
713 case GETPAIRKERNTABLE:
714 case GETSETPAPERBINS:
715 case GETSETPRINTORIENT:
716 case GETSETSCREENPARAMS:
717 case GETTECHNOLOGY:
718 case GETTRACKKERNTABLE:
719 case MFCOMMENT:
720 case NEWFRAME:
721 case PASSTHROUGH:
722 case RESTORE_CTM:
723 case SAVE_CTM:
724 case SETALLJUSTVALUES:
725 case SETCOLORTABLE:
726 case SET_BACKGROUND_COLOR:
727 case TRANSFORM_CTM:
728 /* pass it unmodified to the 32-bit function */
729 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
731 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
732 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
733 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
734 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
735 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
736 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
737 case ENUMPAPERMETRICS:
738 case GETEXTENDEDTEXTMETRICS:
739 case GETEXTENTTABLE:
740 case GETSETPAPERMETRICS:
741 case GETVECTORBRUSHSIZE:
742 case GETVECTORPENSIZE:
743 default:
744 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
745 escape, in_count, MapSL(in_data), out_data );
746 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
751 /***********************************************************************
752 * RestoreDC (GDI.39)
754 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
756 return RestoreDC( HDC_32(hdc), level );
760 /***********************************************************************
761 * FillRgn (GDI.40)
763 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
765 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
769 /***********************************************************************
770 * FrameRgn (GDI.41)
772 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
773 INT16 nWidth, INT16 nHeight )
775 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
779 /***********************************************************************
780 * InvertRgn (GDI.42)
782 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
784 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
788 /***********************************************************************
789 * PaintRgn (GDI.43)
791 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
793 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
797 /***********************************************************************
798 * SelectClipRgn (GDI.44)
800 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
802 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
806 /***********************************************************************
807 * SelectObject (GDI.45)
809 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
811 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
815 /***********************************************************************
816 * CombineRgn (GDI.47)
818 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
820 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
824 /***********************************************************************
825 * CreateBitmap (GDI.48)
827 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
828 UINT16 bpp, LPCVOID bits )
830 return HBITMAP_16( CreateBitmap( width, height, planes & 0xff, bpp & 0xff, bits ) );
834 /***********************************************************************
835 * CreateBitmapIndirect (GDI.49)
837 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
839 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
840 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
844 /***********************************************************************
845 * CreateBrushIndirect (GDI.50)
847 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
849 LOGBRUSH brush32;
851 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
852 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
854 brush32.lbStyle = brush->lbStyle;
855 brush32.lbColor = brush->lbColor;
856 brush32.lbHatch = brush->lbHatch;
857 return HBRUSH_16( CreateBrushIndirect(&brush32) );
861 /***********************************************************************
862 * CreateCompatibleBitmap (GDI.51)
864 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
866 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
870 /***********************************************************************
871 * CreateCompatibleDC (GDI.52)
873 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
875 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
879 /***********************************************************************
880 * CreateDC (GDI.53)
882 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
883 const DEVMODEA *initData )
885 return HDC_16( CreateDCA( driver, device, output, initData ) );
889 /***********************************************************************
890 * CreateEllipticRgn (GDI.54)
892 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
894 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
898 /***********************************************************************
899 * CreateEllipticRgnIndirect (GDI.55)
901 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
903 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
907 /***********************************************************************
908 * CreateFont (GDI.56)
910 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
911 INT16 weight, BYTE italic, BYTE underline,
912 BYTE strikeout, BYTE charset, BYTE outpres,
913 BYTE clippres, BYTE quality, BYTE pitch,
914 LPCSTR name )
916 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
917 strikeout, charset, outpres, clippres, quality, pitch, name ));
920 /***********************************************************************
921 * CreateFontIndirect (GDI.57)
923 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
925 HFONT ret;
927 if (plf16)
929 LOGFONTW lfW;
930 logfont_16_to_W( plf16, &lfW );
931 ret = CreateFontIndirectW( &lfW );
933 else ret = CreateFontIndirectW( NULL );
934 return HFONT_16(ret);
938 /***********************************************************************
939 * CreateHatchBrush (GDI.58)
941 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
943 return HBRUSH_16( CreateHatchBrush( style, color ) );
947 /***********************************************************************
948 * CreatePatternBrush (GDI.60)
950 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
952 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
956 /***********************************************************************
957 * CreatePen (GDI.61)
959 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
961 LOGPEN logpen;
963 logpen.lopnStyle = style;
964 logpen.lopnWidth.x = width;
965 logpen.lopnWidth.y = 0;
966 logpen.lopnColor = color;
967 return HPEN_16( CreatePenIndirect( &logpen ) );
971 /***********************************************************************
972 * CreatePenIndirect (GDI.62)
974 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
976 LOGPEN logpen;
978 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
979 logpen.lopnStyle = pen->lopnStyle;
980 logpen.lopnWidth.x = pen->lopnWidth.x;
981 logpen.lopnWidth.y = pen->lopnWidth.y;
982 logpen.lopnColor = pen->lopnColor;
983 return HPEN_16( CreatePenIndirect( &logpen ) );
987 /***********************************************************************
988 * CreatePolygonRgn (GDI.63)
990 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
992 return CreatePolyPolygonRgn16( points, &count, 1, mode );
996 /***********************************************************************
997 * CreateRectRgn (GDI.64)
999 * NOTE: cf. SetRectRgn16
1001 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
1003 HRGN hrgn;
1005 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
1006 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
1007 return HRGN_16(hrgn);
1011 /***********************************************************************
1012 * CreateRectRgnIndirect (GDI.65)
1014 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
1016 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
1020 /***********************************************************************
1021 * CreateSolidBrush (GDI.66)
1023 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
1025 return HBRUSH_16( CreateSolidBrush( color ) );
1029 /***********************************************************************
1030 * DeleteDC (GDI.68)
1032 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
1034 return DeleteDC( HDC_32(hdc) );
1038 /***********************************************************************
1039 * DeleteObject (GDI.69)
1040 * SysDeleteObject (GDI.605)
1042 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
1044 return DeleteObject( HGDIOBJ_32(obj) );
1048 /***********************************************************************
1049 * EnumObjects (GDI.71)
1051 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1053 struct callback16_info info;
1055 info.proc = (FARPROC16)proc;
1056 info.param = lParam;
1057 switch(obj)
1059 case OBJ_PEN:
1060 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1061 case OBJ_BRUSH:
1062 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1064 return 0;
1068 /***********************************************************************
1069 * EqualRgn (GDI.72)
1071 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1073 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1077 /***********************************************************************
1078 * GetBitmapBits (GDI.74)
1080 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1082 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1086 /***********************************************************************
1087 * GetBkColor (GDI.75)
1089 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1091 return GetBkColor( HDC_32(hdc) );
1095 /***********************************************************************
1096 * GetBkMode (GDI.76)
1098 INT16 WINAPI GetBkMode16( HDC16 hdc )
1100 return GetBkMode( HDC_32(hdc) );
1104 /***********************************************************************
1105 * GetClipBox (GDI.77)
1107 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1109 RECT rect32;
1110 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1112 if (ret != ERROR)
1114 rect->left = rect32.left;
1115 rect->top = rect32.top;
1116 rect->right = rect32.right;
1117 rect->bottom = rect32.bottom;
1119 return ret;
1123 /***********************************************************************
1124 * GetCurrentPosition (GDI.78)
1126 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1128 POINT pt32;
1129 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1130 return MAKELONG( pt32.x, pt32.y );
1134 /***********************************************************************
1135 * GetDCOrg (GDI.79)
1137 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1139 POINT pt;
1140 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1141 return 0;
1145 /***********************************************************************
1146 * GetDeviceCaps (GDI.80)
1148 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1150 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1151 /* some apps don't expect -1 and think it's a B&W screen */
1152 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1153 return ret;
1157 /***********************************************************************
1158 * GetMapMode (GDI.81)
1160 INT16 WINAPI GetMapMode16( HDC16 hdc )
1162 return GetMapMode( HDC_32(hdc) );
1166 /***********************************************************************
1167 * GetObject (GDI.82)
1169 INT16 WINAPI GetObject16( HGDIOBJ16 handle16, INT16 count, LPVOID buffer )
1171 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1172 switch( GetObjectType( handle ))
1174 case OBJ_PEN:
1175 if (buffer)
1177 LOGPEN16 *pen16 = buffer;
1178 LOGPEN pen;
1180 if (count < sizeof(LOGPEN16)) return 0;
1181 if (!GetObjectW( handle, sizeof(pen), &pen )) return 0;
1183 pen16->lopnStyle = pen.lopnStyle;
1184 pen16->lopnColor = pen.lopnColor;
1185 pen16->lopnWidth.x = pen.lopnWidth.x;
1186 pen16->lopnWidth.y = pen.lopnWidth.y;
1188 return sizeof(LOGPEN16);
1190 case OBJ_BRUSH:
1191 if (buffer)
1193 LOGBRUSH brush;
1194 LOGBRUSH16 brush16;
1196 if (!GetObjectW( handle, sizeof(brush), &brush )) return 0;
1197 brush16.lbStyle = brush.lbStyle;
1198 brush16.lbColor = brush.lbColor;
1199 brush16.lbHatch = brush.lbHatch;
1200 if (count > sizeof(brush16)) count = sizeof(brush16);
1201 memcpy( buffer, &brush16, count );
1202 return count;
1204 return sizeof(LOGBRUSH16);
1206 case OBJ_PAL:
1207 return GetObjectW( handle, count, buffer );
1209 case OBJ_FONT:
1210 if (buffer)
1212 LOGFONTW font;
1213 LOGFONT16 font16;
1215 if (!GetObjectW( handle, sizeof(font), &font )) return 0;
1216 logfont_W_to_16( &font, &font16 );
1217 if (count > sizeof(font16)) count = sizeof(font16);
1218 memcpy( buffer, &font16, count );
1219 return count;
1221 return sizeof(LOGFONT16);
1223 case OBJ_BITMAP:
1225 DIBSECTION dib;
1226 INT size;
1227 BITMAP16 *bmp16 = buffer;
1229 if (!(size = GetObjectW( handle, sizeof(dib), &dib ))) return 0;
1230 if (size == sizeof(DIBSECTION) && count > sizeof(BITMAP16))
1232 FIXME("not implemented for DIBs: count %d\n", count);
1233 return 0;
1235 else
1237 if (count < sizeof(BITMAP16)) return 0;
1238 bmp16->bmType = dib.dsBm.bmType;
1239 bmp16->bmWidth = dib.dsBm.bmWidth;
1240 bmp16->bmHeight = dib.dsBm.bmHeight;
1241 bmp16->bmWidthBytes = dib.dsBm.bmWidthBytes;
1242 bmp16->bmPlanes = dib.dsBm.bmPlanes;
1243 bmp16->bmBitsPixel = dib.dsBm.bmBitsPixel;
1244 bmp16->bmBits = 0;
1245 return sizeof(BITMAP16);
1249 default:
1250 return 0;
1255 /***********************************************************************
1256 * GetPixel (GDI.83)
1258 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1260 return GetPixel( HDC_32(hdc), x, y );
1264 /***********************************************************************
1265 * GetPolyFillMode (GDI.84)
1267 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1269 return GetPolyFillMode( HDC_32(hdc) );
1273 /***********************************************************************
1274 * GetROP2 (GDI.85)
1276 INT16 WINAPI GetROP216( HDC16 hdc )
1278 return GetROP2( HDC_32(hdc) );
1282 /***********************************************************************
1283 * GetRelAbs (GDI.86)
1285 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1287 return GetRelAbs( HDC_32(hdc), 0 );
1291 /***********************************************************************
1292 * GetStockObject (GDI.87)
1294 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1296 return HGDIOBJ_16( GetStockObject( obj ) );
1300 /***********************************************************************
1301 * GetStretchBltMode (GDI.88)
1303 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1305 return GetStretchBltMode( HDC_32(hdc) );
1309 /***********************************************************************
1310 * GetTextCharacterExtra (GDI.89)
1312 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1314 return GetTextCharacterExtra( HDC_32(hdc) );
1318 /***********************************************************************
1319 * GetTextColor (GDI.90)
1321 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1323 return GetTextColor( HDC_32(hdc) );
1327 /***********************************************************************
1328 * GetTextExtent (GDI.91)
1330 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1332 SIZE size;
1333 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1334 return MAKELONG( size.cx, size.cy );
1338 /***********************************************************************
1339 * GetTextFace (GDI.92)
1341 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1343 return GetTextFaceA( HDC_32(hdc), count, name );
1347 /***********************************************************************
1348 * GetTextMetrics (GDI.93)
1350 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1352 TEXTMETRICW tm32;
1354 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1356 tm->tmHeight = tm32.tmHeight;
1357 tm->tmAscent = tm32.tmAscent;
1358 tm->tmDescent = tm32.tmDescent;
1359 tm->tmInternalLeading = tm32.tmInternalLeading;
1360 tm->tmExternalLeading = tm32.tmExternalLeading;
1361 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1362 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1363 tm->tmWeight = tm32.tmWeight;
1364 tm->tmOverhang = tm32.tmOverhang;
1365 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1366 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1367 tm->tmFirstChar = tm32.tmFirstChar;
1368 tm->tmLastChar = tm32.tmLastChar;
1369 tm->tmDefaultChar = tm32.tmDefaultChar;
1370 tm->tmBreakChar = tm32.tmBreakChar;
1371 tm->tmItalic = tm32.tmItalic;
1372 tm->tmUnderlined = tm32.tmUnderlined;
1373 tm->tmStruckOut = tm32.tmStruckOut;
1374 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1375 tm->tmCharSet = tm32.tmCharSet;
1376 return TRUE;
1380 /***********************************************************************
1381 * GetViewportExt (GDI.94)
1383 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1385 SIZE size;
1386 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1387 return MAKELONG( size.cx, size.cy );
1391 /***********************************************************************
1392 * GetViewportOrg (GDI.95)
1394 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1396 POINT pt;
1397 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1398 return MAKELONG( pt.x, pt.y );
1402 /***********************************************************************
1403 * GetWindowExt (GDI.96)
1405 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1407 SIZE size;
1408 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1409 return MAKELONG( size.cx, size.cy );
1413 /***********************************************************************
1414 * GetWindowOrg (GDI.97)
1416 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1418 POINT pt;
1419 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1420 return MAKELONG( pt.x, pt.y );
1426 /**********************************************************************
1427 * LineDDA (GDI.100)
1429 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1430 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1432 struct callback16_info info;
1433 info.proc = (FARPROC16)proc;
1434 info.param = lParam;
1435 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1439 /***********************************************************************
1440 * OffsetRgn (GDI.101)
1442 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1444 return OffsetRgn( HRGN_32(hrgn), x, y );
1448 /***********************************************************************
1449 * PtVisible (GDI.103)
1451 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1453 return PtVisible( HDC_32(hdc), x, y );
1457 /***********************************************************************
1458 * SelectVisRgn (GDI.105)
1460 INT16 WINAPI SelectVisRgn16( HDC16 hdc, HRGN16 hrgn )
1462 return SelectVisRgn( HDC_32(hdc), HRGN_32(hrgn) );
1466 /***********************************************************************
1467 * SetBitmapBits (GDI.106)
1469 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1471 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1475 /***********************************************************************
1476 * AddFontResource (GDI.119)
1478 INT16 WINAPI AddFontResource16( LPCSTR filename )
1480 return AddFontResourceA( filename );
1484 /***********************************************************************
1485 * Death (GDI.121)
1487 * Disables GDI, switches back to text mode.
1488 * We don't have to do anything here,
1489 * just let console support handle everything
1491 void WINAPI Death16(HDC16 hdc)
1493 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1497 /***********************************************************************
1498 * Resurrection (GDI.122)
1500 * Restores GDI functionality
1502 void WINAPI Resurrection16(HDC16 hdc,
1503 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1505 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1506 hdc, w1, w2, w3, w4, w5, w6);
1510 /**********************************************************************
1511 * CreateMetaFile (GDI.125)
1513 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1515 return HDC_16( CreateMetaFileA( filename ) );
1519 /***********************************************************************
1520 * MulDiv (GDI.128)
1522 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1524 INT ret;
1525 if (!nDivisor) return -32768;
1526 /* We want to deal with a positive divisor to simplify the logic. */
1527 if (nDivisor < 0)
1529 nMultiplicand = - nMultiplicand;
1530 nDivisor = -nDivisor;
1532 /* If the result is positive, we "add" to round. else,
1533 * we subtract to round. */
1534 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1535 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1536 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1537 else
1538 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1539 if ((ret > 32767) || (ret < -32767)) return -32768;
1540 return (INT16) ret;
1544 /***********************************************************************
1545 * GetRgnBox (GDI.134)
1547 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1549 RECT r;
1550 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1551 rect->left = r.left;
1552 rect->top = r.top;
1553 rect->right = r.right;
1554 rect->bottom = r.bottom;
1555 return ret;
1559 /***********************************************************************
1560 * RemoveFontResource (GDI.136)
1562 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1564 return RemoveFontResourceA(str);
1568 /***********************************************************************
1569 * SetBrushOrg (GDI.148)
1571 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1573 POINT pt;
1575 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1576 return MAKELONG( pt.x, pt.y );
1580 /***********************************************************************
1581 * GetBrushOrg (GDI.149)
1583 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1585 POINT pt;
1586 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1587 return MAKELONG( pt.x, pt.y );
1591 /***********************************************************************
1592 * UnrealizeObject (GDI.150)
1594 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1596 return UnrealizeObject( HGDIOBJ_32(obj) );
1600 /***********************************************************************
1601 * CreateIC (GDI.153)
1603 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1604 const DEVMODEA* initData )
1606 return HDC_16( CreateICA( driver, device, output, initData ) );
1610 /***********************************************************************
1611 * GetNearestColor (GDI.154)
1613 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1615 return GetNearestColor( HDC_32(hdc), color );
1619 /***********************************************************************
1620 * CreateDiscardableBitmap (GDI.156)
1622 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1624 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1628 /***********************************************************************
1629 * PtInRegion (GDI.161)
1631 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1633 return PtInRegion( HRGN_32(hrgn), x, y );
1637 /***********************************************************************
1638 * GetBitmapDimension (GDI.162)
1640 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1642 SIZE16 size;
1643 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1644 return MAKELONG( size.cx, size.cy );
1648 /***********************************************************************
1649 * SetBitmapDimension (GDI.163)
1651 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1653 SIZE16 size;
1654 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1655 return MAKELONG( size.cx, size.cy );
1659 /***********************************************************************
1660 * SetRectRgn (GDI.172)
1662 * NOTE: Win 3.1 sets region to empty if left > right
1664 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1666 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1667 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1671 /******************************************************************
1672 * PlayMetaFileRecord (GDI.176)
1674 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1676 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1677 unsigned int i;
1679 for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1680 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1681 for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1682 HeapFree( GetProcessHeap(), 0, ht32 );
1686 /***********************************************************************
1687 * SetHookFlags (GDI.192)
1689 WORD WINAPI SetHookFlags16( HDC16 hdc, WORD flags )
1691 return SetHookFlags( HDC_32(hdc), flags );
1695 /***********************************************************************
1696 * SetBoundsRect (GDI.193)
1698 UINT16 WINAPI SetBoundsRect16( HDC16 hdc, const RECT16* rect, UINT16 flags )
1700 if (rect)
1702 RECT rect32;
1703 rect32.left = rect->left;
1704 rect32.top = rect->top;
1705 rect32.right = rect->right;
1706 rect32.bottom = rect->bottom;
1707 return SetBoundsRect( HDC_32( hdc ), &rect32, flags );
1709 else return SetBoundsRect( HDC_32( hdc ), NULL, flags );
1713 /***********************************************************************
1714 * GetBoundsRect (GDI.194)
1716 UINT16 WINAPI GetBoundsRect16( HDC16 hdc, LPRECT16 rect, UINT16 flags)
1718 RECT rect32;
1719 UINT ret = GetBoundsRect( HDC_32( hdc ), &rect32, flags );
1720 if (rect)
1722 rect->left = rect32.left;
1723 rect->top = rect32.top;
1724 rect->right = rect32.right;
1725 rect->bottom = rect32.bottom;
1727 return ret;
1731 /***********************************************************************
1732 * EngineEnumerateFont (GDI.300)
1734 WORD WINAPI EngineEnumerateFont16(LPSTR fontname, FARPROC16 proc, DWORD data )
1736 FIXME("(%s,%p,%x),stub\n",fontname,proc,data);
1737 return 0;
1741 /***********************************************************************
1742 * EngineDeleteFont (GDI.301)
1744 WORD WINAPI EngineDeleteFont16(LPFONTINFO16 lpFontInfo)
1746 WORD handle;
1748 /* untested, don't know if it works.
1749 We seem to access some structure that is located after the
1750 FONTINFO. The FONTINFO documentation says that there may
1751 follow some char-width table or font bitmap or vector info.
1752 I think it is some kind of font bitmap that begins at offset 0x52,
1753 as FONTINFO goes up to 0x51.
1754 If this is correct, everything should be implemented correctly.
1756 if ( ((lpFontInfo->dfType & (RASTER_FONTTYPE|DEVICE_FONTTYPE)) == (RASTER_FONTTYPE|DEVICE_FONTTYPE))
1757 && (LOWORD(lpFontInfo->dfFace) == LOWORD(lpFontInfo)+0x6e)
1758 && (handle = *(WORD *)(lpFontInfo+0x54)) )
1760 *(WORD *)(lpFontInfo+0x54) = 0;
1761 GlobalFree16(handle);
1763 return 1;
1767 /***********************************************************************
1768 * EngineRealizeFont (GDI.302)
1770 WORD WINAPI EngineRealizeFont16(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
1772 FIXME("(%p,%p,%p),stub\n",lplogFont,lptextxform,lpfontInfo);
1774 return 0;
1778 /***********************************************************************
1779 * EngineRealizeFontExt (GDI.315)
1781 WORD WINAPI EngineRealizeFontExt16(LONG l1, LONG l2, LONG l3, LONG l4)
1783 FIXME("(%08x,%08x,%08x,%08x),stub\n",l1,l2,l3,l4);
1785 return 0;
1789 /***********************************************************************
1790 * EngineGetCharWidth (GDI.303)
1792 WORD WINAPI EngineGetCharWidth16(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE lastChar, LPINT16 buffer)
1794 int i;
1796 for (i = firstChar; i <= lastChar; i++)
1797 FIXME(" returns font's average width for range %d to %d\n", firstChar, lastChar);
1798 *buffer++ = lpFontInfo->dfAvgWidth; /* insert some charwidth functionality here; use average width for now */
1799 return 1;
1803 /***********************************************************************
1804 * EngineSetFontContext (GDI.304)
1806 WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data)
1808 FIXME("stub?\n");
1809 return 0;
1812 /***********************************************************************
1813 * EngineGetGlyphBMP (GDI.305)
1815 WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2,
1816 LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics)
1818 FIXME("stub?\n");
1819 return 0;
1823 /***********************************************************************
1824 * EngineMakeFontDir (GDI.306)
1826 DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string)
1828 FIXME(" stub! (always fails)\n");
1829 return ~0UL; /* error */
1833 /***********************************************************************
1834 * GetCharABCWidths (GDI.307)
1836 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1838 BOOL ret;
1839 UINT i;
1840 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1842 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1844 for (i = firstChar; i <= lastChar; i++)
1846 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1847 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1848 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1851 HeapFree( GetProcessHeap(), 0, abc32 );
1852 return ret;
1856 /***********************************************************************
1857 * GetOutlineTextMetrics (GDI.308)
1859 * Gets metrics for TrueType fonts.
1861 * PARAMS
1862 * hdc [In] Handle of device context
1863 * cbData [In] Size of metric data array
1864 * lpOTM [Out] Address of metric data array
1866 * RETURNS
1867 * Success: Non-zero or size of required buffer
1868 * Failure: 0
1870 * NOTES
1871 * lpOTM should be LPOUTLINETEXTMETRIC
1873 UINT16 WINAPI GetOutlineTextMetrics16( HDC16 hdc, UINT16 cbData,
1874 LPOUTLINETEXTMETRIC16 lpOTM )
1876 FIXME("(%04x,%04x,%p): stub\n", hdc,cbData,lpOTM);
1877 return 0;
1881 /***********************************************************************
1882 * GetGlyphOutline (GDI.309)
1884 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1885 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1886 LPVOID lpBuffer, const MAT2 *lpmat2 )
1888 DWORD ret;
1889 GLYPHMETRICS gm32;
1891 ret = GetGlyphOutlineA( HDC_32(hdc), uChar, fuFormat, &gm32, cbBuffer, lpBuffer, lpmat2);
1892 lpgm->gmBlackBoxX = gm32.gmBlackBoxX;
1893 lpgm->gmBlackBoxY = gm32.gmBlackBoxY;
1894 lpgm->gmptGlyphOrigin.x = gm32.gmptGlyphOrigin.x;
1895 lpgm->gmptGlyphOrigin.y = gm32.gmptGlyphOrigin.y;
1896 lpgm->gmCellIncX = gm32.gmCellIncX;
1897 lpgm->gmCellIncY = gm32.gmCellIncY;
1898 return ret;
1902 /***********************************************************************
1903 * CreateScalableFontResource (GDI.310)
1905 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1906 LPCSTR fontFile, LPCSTR path )
1908 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1912 /*************************************************************************
1913 * GetFontData (GDI.311)
1916 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1918 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1922 /*************************************************************************
1923 * GetRasterizerCaps (GDI.313)
1925 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1927 return GetRasterizerCaps( lprs, cbNumBytes );
1931 /*************************************************************************
1932 * GetKerningPairs (GDI.332)
1935 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1937 KERNINGPAIR *pairs32;
1938 INT i, ret;
1940 if (!count) return 0;
1942 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1943 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1945 for (i = 0; i < ret; i++)
1947 pairs->wFirst = pairs32->wFirst;
1948 pairs->wSecond = pairs32->wSecond;
1949 pairs->iKernAmount = pairs32->iKernAmount;
1952 HeapFree( GetProcessHeap(), 0, pairs32 );
1953 return ret;
1958 /***********************************************************************
1959 * GetTextAlign (GDI.345)
1961 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1963 return GetTextAlign( HDC_32(hdc) );
1967 /***********************************************************************
1968 * SetTextAlign (GDI.346)
1970 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1972 return SetTextAlign( HDC_32(hdc), align );
1976 /***********************************************************************
1977 * Chord (GDI.348)
1979 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1980 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1981 INT16 xend, INT16 yend )
1983 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1987 /***********************************************************************
1988 * SetMapperFlags (GDI.349)
1990 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1992 return SetMapperFlags( HDC_32(hdc), flags );
1996 /***********************************************************************
1997 * GetCharWidth (GDI.350)
1999 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
2001 BOOL retVal = FALSE;
2003 if( firstChar != lastChar )
2005 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
2006 if( buf32 )
2008 LPINT obuf32 = buf32;
2009 int i;
2011 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
2012 if (retVal)
2014 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
2016 HeapFree(GetProcessHeap(), 0, obuf32);
2019 else /* happens quite often to warrant a special treatment */
2021 INT chWidth;
2022 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
2023 *buffer = chWidth;
2025 return retVal;
2029 /***********************************************************************
2030 * ExtTextOut (GDI.351)
2032 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
2033 const RECT16 *lprect, LPCSTR str, UINT16 count,
2034 const INT16 *lpDx )
2036 BOOL ret;
2037 int i;
2038 RECT rect32;
2039 LPINT lpdx32 = NULL;
2041 if (lpDx) {
2042 lpdx32 = HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
2043 if(lpdx32 == NULL) return FALSE;
2044 for (i=count;i--;) lpdx32[i]=lpDx[i];
2046 if (lprect)
2048 rect32.left = lprect->left;
2049 rect32.top = lprect->top;
2050 rect32.right = lprect->right;
2051 rect32.bottom = lprect->bottom;
2053 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
2054 HeapFree( GetProcessHeap(), 0, lpdx32 );
2055 return ret;
2059 /***********************************************************************
2060 * CreatePalette (GDI.360)
2062 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
2064 return HPALETTE_16( CreatePalette( palette ) );
2068 /***********************************************************************
2069 * GDISelectPalette (GDI.361)
2071 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
2073 return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
2077 /***********************************************************************
2078 * GDIRealizePalette (GDI.362)
2080 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
2082 return GDIRealizePalette( HDC_32(hdc) );
2086 /***********************************************************************
2087 * GetPaletteEntries (GDI.363)
2089 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
2090 UINT16 count, LPPALETTEENTRY entries )
2092 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
2096 /***********************************************************************
2097 * SetPaletteEntries (GDI.364)
2099 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
2100 UINT16 count, const PALETTEENTRY *entries )
2102 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
2106 /**********************************************************************
2107 * UpdateColors (GDI.366)
2109 INT16 WINAPI UpdateColors16( HDC16 hdc )
2111 UpdateColors( HDC_32(hdc) );
2112 return TRUE;
2116 /***********************************************************************
2117 * AnimatePalette (GDI.367)
2119 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
2120 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
2122 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
2126 /***********************************************************************
2127 * ResizePalette (GDI.368)
2129 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
2131 return ResizePalette( HPALETTE_32(hpalette), cEntries );
2135 /***********************************************************************
2136 * GetNearestPaletteIndex (GDI.370)
2138 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
2140 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
2144 /**********************************************************************
2145 * ExtFloodFill (GDI.372)
2147 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
2148 UINT16 fillType )
2150 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
2154 /***********************************************************************
2155 * SetSystemPaletteUse (GDI.373)
2157 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
2159 return SetSystemPaletteUse( HDC_32(hdc), use );
2163 /***********************************************************************
2164 * GetSystemPaletteUse (GDI.374)
2166 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
2168 return GetSystemPaletteUse( HDC_32(hdc) );
2172 /***********************************************************************
2173 * GetSystemPaletteEntries (GDI.375)
2175 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
2176 LPPALETTEENTRY entries )
2178 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
2182 /***********************************************************************
2183 * ResetDC (GDI.376)
2185 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
2187 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
2191 /******************************************************************
2192 * StartDoc (GDI.377)
2194 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
2196 DOCINFOA docA;
2198 docA.cbSize = lpdoc->cbSize;
2199 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
2200 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
2201 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
2202 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
2203 else
2204 docA.lpszDatatype = NULL;
2205 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
2206 docA.fwType = lpdoc->fwType;
2207 else
2208 docA.fwType = 0;
2209 return StartDocA( HDC_32(hdc), &docA );
2213 /******************************************************************
2214 * EndDoc (GDI.378)
2216 INT16 WINAPI EndDoc16( HDC16 hdc )
2218 return EndDoc( HDC_32(hdc) );
2222 /******************************************************************
2223 * StartPage (GDI.379)
2225 INT16 WINAPI StartPage16( HDC16 hdc )
2227 return StartPage( HDC_32(hdc) );
2231 /******************************************************************
2232 * EndPage (GDI.380)
2234 INT16 WINAPI EndPage16( HDC16 hdc )
2236 return EndPage( HDC_32(hdc) );
2240 /******************************************************************************
2241 * AbortDoc (GDI.382)
2243 INT16 WINAPI AbortDoc16( HDC16 hdc )
2245 return AbortDoc( HDC_32(hdc) );
2249 /***********************************************************************
2250 * FastWindowFrame (GDI.400)
2252 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
2253 INT16 width, INT16 height, DWORD rop )
2255 HDC hdc32 = HDC_32(hdc);
2256 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
2257 PatBlt( hdc32, rect->left, rect->top,
2258 rect->right - rect->left - width, height, rop );
2259 PatBlt( hdc32, rect->left, rect->top + height, width,
2260 rect->bottom - rect->top - height, rop );
2261 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
2262 rect->right - rect->left - width, -height, rop );
2263 PatBlt( hdc32, rect->right - 1, rect->top, -width,
2264 rect->bottom - rect->top - height, rop );
2265 SelectObject( hdc32, hbrush );
2266 return TRUE;
2270 /***********************************************************************
2271 * GdiInit2 (GDI.403)
2273 * See "Undocumented Windows"
2275 * PARAMS
2276 * h1 [I] GDI object
2277 * h2 [I] global data
2279 HANDLE16 WINAPI GdiInit216( HANDLE16 h1, HANDLE16 h2 )
2281 FIXME("(%04x, %04x), stub.\n", h1, h2);
2282 if (h2 == 0xffff) return 0xffff; /* undefined return value */
2283 return h1; /* FIXME: should be the memory handle of h1 */
2287 /***********************************************************************
2288 * FinalGdiInit (GDI.405)
2290 void WINAPI FinalGdiInit16( HBRUSH16 hPattern /* [in] fill pattern of desktop */ )
2295 /***********************************************************************
2296 * CreateUserBitmap (GDI.407)
2298 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
2299 UINT16 bpp, LPCVOID bits )
2301 return CreateBitmap16( width, height, planes, bpp, bits );
2305 /***********************************************************************
2306 * CreateUserDiscardableBitmap (GDI.409)
2308 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
2310 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
2311 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
2312 DeleteDC( hdc );
2313 return HBITMAP_16(ret);
2317 /***********************************************************************
2318 * GetCurLogFont (GDI.411)
2320 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
2322 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
2326 /***********************************************************************
2327 * StretchDIBits (GDI.439)
2329 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
2330 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
2331 INT16 heightSrc, const VOID *bits,
2332 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
2334 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
2335 xSrc, ySrc, widthSrc, heightSrc, bits,
2336 info, wUsage, dwRop );
2340 /***********************************************************************
2341 * SetDIBits (GDI.440)
2343 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2344 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2345 UINT16 coloruse )
2347 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2351 /***********************************************************************
2352 * GetDIBits (GDI.441)
2354 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2355 UINT16 lines, LPVOID bits, BITMAPINFO * info,
2356 UINT16 coloruse )
2358 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2362 /***********************************************************************
2363 * CreateDIBitmap (GDI.442)
2365 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
2366 DWORD init, LPCVOID bits, const BITMAPINFO * data,
2367 UINT16 coloruse )
2369 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
2373 /***********************************************************************
2374 * SetDIBitsToDevice (GDI.443)
2376 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2377 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2378 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2379 UINT16 coloruse )
2381 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2382 startscan, lines, bits, info, coloruse );
2386 /***********************************************************************
2387 * CreateRoundRectRgn (GDI.444)
2389 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2390 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2391 * we just let CreateRoundRectRgn convert them to +ve values.
2394 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2395 INT16 ellipse_width, INT16 ellipse_height )
2397 if( ellipse_width == 0 || ellipse_height == 0 )
2398 return CreateRectRgn16( left, top, right, bottom );
2399 else
2400 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2401 ellipse_width, ellipse_height ));
2405 /***********************************************************************
2406 * CreateDIBPatternBrush (GDI.445)
2408 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2410 BITMAPINFO *bmi;
2411 HBRUSH16 ret;
2413 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2414 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2415 GlobalUnlock16( hbitmap );
2416 return ret;
2420 /**********************************************************************
2421 * PolyPolygon (GDI.450)
2423 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2424 UINT16 polygons )
2426 int i,nrpts;
2427 LPPOINT pt32;
2428 LPINT counts32;
2429 BOOL16 ret;
2431 nrpts=0;
2432 for (i=polygons;i--;)
2433 nrpts+=counts[i];
2434 pt32 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2435 if(pt32 == NULL) return FALSE;
2436 for (i=nrpts;i--;)
2438 pt32[i].x = pt[i].x;
2439 pt32[i].y = pt[i].y;
2441 counts32 = HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2442 if(counts32 == NULL) {
2443 HeapFree( GetProcessHeap(), 0, pt32 );
2444 return FALSE;
2446 for (i=polygons;i--;) counts32[i]=counts[i];
2448 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2449 HeapFree( GetProcessHeap(), 0, counts32 );
2450 HeapFree( GetProcessHeap(), 0, pt32 );
2451 return ret;
2455 /***********************************************************************
2456 * CreatePolyPolygonRgn (GDI.451)
2458 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2459 const INT16 *count, INT16 nbpolygons, INT16 mode )
2461 HRGN hrgn;
2462 int i, npts = 0;
2463 INT *count32;
2464 POINT *points32;
2466 for (i = 0; i < nbpolygons; i++) npts += count[i];
2467 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2468 for (i = 0; i < npts; i++)
2470 points32[i].x = points[i].x;
2471 points32[i].y = points[i].y;
2474 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2475 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2476 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2477 HeapFree( GetProcessHeap(), 0, count32 );
2478 HeapFree( GetProcessHeap(), 0, points32 );
2479 return HRGN_16(hrgn);
2483 /***********************************************************************
2484 * GdiSeeGdiDo (GDI.452)
2486 DWORD WINAPI GdiSeeGdiDo16( WORD wReqType, WORD wParam1, WORD wParam2,
2487 WORD wParam3 )
2489 DWORD ret = ~0U;
2491 switch (wReqType)
2493 case 0x0001: /* LocalAlloc */
2494 WARN("LocalAlloc16(%x, %x): ignoring\n", wParam1, wParam3);
2495 ret = 0;
2496 break;
2497 case 0x0002: /* LocalFree */
2498 WARN("LocalFree16(%x): ignoring\n", wParam1);
2499 ret = 0;
2500 break;
2501 case 0x0003: /* LocalCompact */
2502 WARN("LocalCompact16(%x): ignoring\n", wParam3);
2503 ret = 65000; /* lie about the amount of free space */
2504 break;
2505 case 0x0103: /* LocalHeap */
2506 WARN("LocalHeap16(): ignoring\n");
2507 break;
2508 default:
2509 WARN("(wReqType=%04x): Unknown\n", wReqType);
2510 break;
2512 return ret;
2516 /***********************************************************************
2517 * SetObjectOwner (GDI.461)
2519 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2521 /* Nothing to do */
2525 /***********************************************************************
2526 * IsGDIObject (GDI.462)
2528 * returns type of object if valid (W95 system programming secrets p. 264-5)
2530 BOOL16 WINAPI IsGDIObject16( HGDIOBJ16 handle16 )
2532 static const BYTE type_map[] =
2534 0, /* bad */
2535 1, /* OBJ_PEN */
2536 2, /* OBJ_BRUSH */
2537 7, /* OBJ_DC */
2538 9, /* OBJ_METADC */
2539 4, /* OBJ_PAL */
2540 3, /* OBJ_FONT */
2541 5, /* OBJ_BITMAP */
2542 6, /* OBJ_REGION */
2543 10, /* OBJ_METAFILE */
2544 7, /* OBJ_MEMDC */
2545 0, /* OBJ_EXTPEN */
2546 9, /* OBJ_ENHMETADC */
2547 12, /* OBJ_ENHMETAFILE */
2548 0 /* OBJ_COLORSPACE */
2551 UINT type = GetObjectType( HGDIOBJ_32( handle16 ));
2553 if (type >= sizeof(type_map)/sizeof(type_map[0])) return 0;
2554 return type_map[type];
2558 /***********************************************************************
2559 * RectVisible (GDI.465)
2560 * RectVisibleOld (GDI.104)
2562 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2564 RECT rect;
2566 rect.left = rect16->left;
2567 rect.top = rect16->top;
2568 rect.right = rect16->right;
2569 rect.bottom = rect16->bottom;
2570 return RectVisible( HDC_32(hdc), &rect );
2574 /***********************************************************************
2575 * RectInRegion (GDI.466)
2576 * RectInRegionOld (GDI.181)
2578 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2580 RECT r32;
2582 r32.left = rect->left;
2583 r32.top = rect->top;
2584 r32.right = rect->right;
2585 r32.bottom = rect->bottom;
2586 return RectInRegion( HRGN_32(hrgn), &r32 );
2590 /***********************************************************************
2591 * GetBitmapDimensionEx (GDI.468)
2593 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2595 SIZE size32;
2596 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2598 if (ret)
2600 size->cx = size32.cx;
2601 size->cy = size32.cy;
2603 return ret;
2607 /***********************************************************************
2608 * GetBrushOrgEx (GDI.469)
2610 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2612 POINT pt32;
2613 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2614 pt->x = pt32.x;
2615 pt->y = pt32.y;
2616 return TRUE;
2620 /***********************************************************************
2621 * GetCurrentPositionEx (GDI.470)
2623 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2625 POINT pt32;
2626 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2627 pt->x = pt32.x;
2628 pt->y = pt32.y;
2629 return TRUE;
2633 /***********************************************************************
2634 * GetTextExtentPoint (GDI.471)
2636 * FIXME: Should this have a bug for compatibility?
2637 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2638 * bugs (-> MSDN KB q147647.txt).
2640 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2642 SIZE size32;
2643 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2645 if (ret)
2647 size->cx = size32.cx;
2648 size->cy = size32.cy;
2650 return ret;
2654 /***********************************************************************
2655 * GetViewportExtEx (GDI.472)
2657 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2659 SIZE size32;
2660 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2661 size->cx = size32.cx;
2662 size->cy = size32.cy;
2663 return TRUE;
2667 /***********************************************************************
2668 * GetViewportOrgEx (GDI.473)
2670 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2672 POINT pt32;
2673 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2674 pt->x = pt32.x;
2675 pt->y = pt32.y;
2676 return TRUE;
2680 /***********************************************************************
2681 * GetWindowExtEx (GDI.474)
2683 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2685 SIZE size32;
2686 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2687 size->cx = size32.cx;
2688 size->cy = size32.cy;
2689 return TRUE;
2693 /***********************************************************************
2694 * GetWindowOrgEx (GDI.475)
2696 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2698 POINT pt32;
2699 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2700 pt->x = pt32.x;
2701 pt->y = pt32.y;
2702 return TRUE;
2706 /***********************************************************************
2707 * OffsetViewportOrgEx (GDI.476)
2709 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2711 POINT pt32;
2712 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2713 if (pt)
2715 pt->x = pt32.x;
2716 pt->y = pt32.y;
2718 return ret;
2722 /***********************************************************************
2723 * OffsetWindowOrgEx (GDI.477)
2725 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2727 POINT pt32;
2728 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2729 if (pt)
2731 pt->x = pt32.x;
2732 pt->y = pt32.y;
2734 return ret;
2738 /***********************************************************************
2739 * SetBitmapDimensionEx (GDI.478)
2741 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2743 SIZE size32;
2744 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2746 if (ret && prevSize)
2748 prevSize->cx = size32.cx;
2749 prevSize->cy = size32.cy;
2751 return ret;
2755 /***********************************************************************
2756 * SetViewportExtEx (GDI.479)
2758 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2760 SIZE size32;
2761 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2762 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2763 return ret;
2767 /***********************************************************************
2768 * SetViewportOrgEx (GDI.480)
2770 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2772 POINT pt32;
2773 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2774 if (pt)
2776 pt->x = pt32.x;
2777 pt->y = pt32.y;
2779 return ret;
2783 /***********************************************************************
2784 * SetWindowExtEx (GDI.481)
2786 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2788 SIZE size32;
2789 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2790 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2791 return ret;
2795 /***********************************************************************
2796 * SetWindowOrgEx (GDI.482)
2798 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2800 POINT pt32;
2801 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2802 if (pt)
2804 pt->x = pt32.x;
2805 pt->y = pt32.y;
2807 return ret;
2811 /***********************************************************************
2812 * MoveToEx (GDI.483)
2814 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2816 POINT pt32;
2818 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2819 if (pt)
2821 pt->x = pt32.x;
2822 pt->y = pt32.y;
2824 return TRUE;
2828 /***********************************************************************
2829 * ScaleViewportExtEx (GDI.484)
2831 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2832 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2834 SIZE size32;
2835 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2836 &size32 );
2837 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2838 return ret;
2842 /***********************************************************************
2843 * ScaleWindowExtEx (GDI.485)
2845 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2846 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2848 SIZE size32;
2849 BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2850 &size32 );
2851 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2852 return ret;
2856 /***********************************************************************
2857 * GetAspectRatioFilterEx (GDI.486)
2859 BOOL16 WINAPI GetAspectRatioFilterEx16( HDC16 hdc, LPSIZE16 pAspectRatio )
2861 FIXME("(%04x, %p): -- Empty Stub !\n", hdc, pAspectRatio);
2862 return FALSE;
2866 /******************************************************************************
2867 * PolyBezier (GDI.502)
2869 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2871 int i;
2872 BOOL16 ret;
2873 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, cPoints*sizeof(POINT) );
2874 if(!pt32) return FALSE;
2875 for (i=cPoints;i--;)
2877 pt32[i].x = lppt[i].x;
2878 pt32[i].y = lppt[i].y;
2880 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2881 HeapFree( GetProcessHeap(), 0, pt32 );
2882 return ret;
2886 /******************************************************************************
2887 * PolyBezierTo (GDI.503)
2889 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2891 int i;
2892 BOOL16 ret;
2893 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0,
2894 cPoints*sizeof(POINT) );
2895 if(!pt32) return FALSE;
2896 for (i=cPoints;i--;)
2898 pt32[i].x = lppt[i].x;
2899 pt32[i].y = lppt[i].y;
2901 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2902 HeapFree( GetProcessHeap(), 0, pt32 );
2903 return ret;
2907 /******************************************************************************
2908 * ExtSelectClipRgn (GDI.508)
2910 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2912 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2916 /***********************************************************************
2917 * AbortPath (GDI.511)
2919 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2921 return AbortPath( HDC_32(hdc) );
2925 /***********************************************************************
2926 * BeginPath (GDI.512)
2928 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2930 return BeginPath( HDC_32(hdc) );
2934 /***********************************************************************
2935 * CloseFigure (GDI.513)
2937 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2939 return CloseFigure( HDC_32(hdc) );
2943 /***********************************************************************
2944 * EndPath (GDI.514)
2946 BOOL16 WINAPI EndPath16(HDC16 hdc)
2948 return EndPath( HDC_32(hdc) );
2952 /***********************************************************************
2953 * FillPath (GDI.515)
2955 BOOL16 WINAPI FillPath16(HDC16 hdc)
2957 return FillPath( HDC_32(hdc) );
2961 /*******************************************************************
2962 * FlattenPath (GDI.516)
2964 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2966 return FlattenPath( HDC_32(hdc) );
2970 /***********************************************************************
2971 * GetPath (GDI.517)
2973 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2975 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2976 return 0;
2980 /***********************************************************************
2981 * PathToRegion (GDI.518)
2983 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2985 return HRGN_16( PathToRegion( HDC_32(hdc) ));
2989 /***********************************************************************
2990 * SelectClipPath (GDI.519)
2992 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2994 return SelectClipPath( HDC_32(hdc), iMode );
2998 /*******************************************************************
2999 * StrokeAndFillPath (GDI.520)
3001 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
3003 return StrokeAndFillPath( HDC_32(hdc) );
3007 /*******************************************************************
3008 * StrokePath (GDI.521)
3010 BOOL16 WINAPI StrokePath16(HDC16 hdc)
3012 return StrokePath( HDC_32(hdc) );
3016 /*******************************************************************
3017 * WidenPath (GDI.522)
3019 BOOL16 WINAPI WidenPath16(HDC16 hdc)
3021 return WidenPath( HDC_32(hdc) );
3025 /***********************************************************************
3026 * GetArcDirection (GDI.524)
3028 INT16 WINAPI GetArcDirection16( HDC16 hdc )
3030 return GetArcDirection( HDC_32(hdc) );
3034 /***********************************************************************
3035 * SetArcDirection (GDI.525)
3037 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
3039 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
3043 /***********************************************************************
3044 * CreateHalftonePalette (GDI.529)
3046 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
3048 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
3052 /***********************************************************************
3053 * SetDIBColorTable (GDI.602)
3055 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
3057 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
3061 /***********************************************************************
3062 * GetDIBColorTable (GDI.603)
3064 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
3066 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
3070 /***********************************************************************
3071 * GetRegionData (GDI.607)
3073 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
3075 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
3077 return GetRegionData( HRGN_32(hrgn), count, rgndata );
3081 /***********************************************************************
3082 * GdiFreeResources (GDI.609)
3084 WORD WINAPI GdiFreeResources16( DWORD reserve )
3086 return 90; /* lie about it, it shouldn't matter */
3090 /***********************************************************************
3091 * GdiSignalProc32 (GDI.610)
3093 WORD WINAPI GdiSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
3094 DWORD dwFlags, HMODULE16 hModule )
3096 return 0;
3100 /***********************************************************************
3101 * GetTextCharset (GDI.612)
3103 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
3105 return GetTextCharset( HDC_32(hdc) );
3109 /*************************************************************************
3110 * GetFontLanguageInfo (GDI.616)
3112 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
3114 return GetFontLanguageInfo( HDC_32(hdc) );
3118 /***********************************************************************
3119 * SetLayout (GDI.1000)
3121 * Sets left->right or right->left text layout flags of a dc.
3123 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
3125 return SetLayout( HDC_32(hdc), layout );