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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "wine/wingdi16.h"
29 #include "gdi_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
34 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
35 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
37 struct callback16_info
43 /* callback for LineDDA16 */
44 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
46 const struct callback16_info *info = (struct callback16_info *)param;
51 args[1] = HIWORD(info->param);
52 args[0] = LOWORD(info->param);
53 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, NULL );
56 /* callback for EnumObjects16 */
57 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
59 const struct callback16_info *info = (struct callback16_info *)param;
66 pen16.lopnStyle = pen->lopnStyle;
67 pen16.lopnWidth.x = pen->lopnWidth.x;
68 pen16.lopnWidth.y = pen->lopnWidth.y;
69 pen16.lopnColor = pen->lopnColor;
70 segptr = MapLS( &pen16 );
71 args[3] = SELECTOROF(segptr);
72 args[2] = OFFSETOF(segptr);
73 args[1] = HIWORD(info->param);
74 args[0] = LOWORD(info->param);
75 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
80 /* callback for EnumObjects16 */
81 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
83 const struct callback16_info *info = (struct callback16_info *)param;
84 LOGBRUSH *brush = ptr;
90 brush16.lbStyle = brush->lbStyle;
91 brush16.lbColor = brush->lbColor;
92 brush16.lbHatch = brush->lbHatch;
93 segptr = MapLS( &brush16 );
94 args[3] = SELECTOROF(segptr);
95 args[2] = OFFSETOF(segptr);
96 args[1] = HIWORD(info->param);
97 args[0] = LOWORD(info->param);
98 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
103 /* convert a LOGFONT16 to a LOGFONTW */
104 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
106 font32->lfHeight = font16->lfHeight;
107 font32->lfWidth = font16->lfWidth;
108 font32->lfEscapement = font16->lfEscapement;
109 font32->lfOrientation = font16->lfOrientation;
110 font32->lfWeight = font16->lfWeight;
111 font32->lfItalic = font16->lfItalic;
112 font32->lfUnderline = font16->lfUnderline;
113 font32->lfStrikeOut = font16->lfStrikeOut;
114 font32->lfCharSet = font16->lfCharSet;
115 font32->lfOutPrecision = font16->lfOutPrecision;
116 font32->lfClipPrecision = font16->lfClipPrecision;
117 font32->lfQuality = font16->lfQuality;
118 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
119 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
120 font32->lfFaceName[LF_FACESIZE-1] = 0;
124 /***********************************************************************
127 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
129 return SetBkColor( HDC_32(hdc), color );
133 /***********************************************************************
136 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
138 return SetBkMode( HDC_32(hdc), mode );
142 /***********************************************************************
145 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
147 return SetMapMode( HDC_32(hdc), mode );
151 /***********************************************************************
154 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
156 return SetROP2( HDC_32(hdc), mode );
160 /***********************************************************************
163 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
165 return SetRelAbs( HDC_32(hdc), mode );
169 /***********************************************************************
170 * SetPolyFillMode (GDI.6)
172 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
174 return SetPolyFillMode( HDC_32(hdc), mode );
178 /***********************************************************************
179 * SetStretchBltMode (GDI.7)
181 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
183 return SetStretchBltMode( HDC_32(hdc), mode );
187 /***********************************************************************
188 * SetTextCharacterExtra (GDI.8)
190 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
192 return SetTextCharacterExtra( HDC_32(hdc), extra );
196 /***********************************************************************
197 * SetTextColor (GDI.9)
199 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
201 return SetTextColor( HDC_32(hdc), color );
205 /***********************************************************************
206 * SetTextJustification (GDI.10)
208 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
210 return SetTextJustification( HDC_32(hdc), extra, breaks );
214 /***********************************************************************
215 * SetWindowOrg (GDI.11)
217 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
220 if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
221 return MAKELONG( pt.x, pt.y );
225 /***********************************************************************
226 * SetWindowExt (GDI.12)
228 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
231 if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
232 return MAKELONG( size.cx, size.cy );
236 /***********************************************************************
237 * SetViewportOrg (GDI.13)
239 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
242 if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
243 return MAKELONG( pt.x, pt.y );
247 /***********************************************************************
248 * SetViewportExt (GDI.14)
250 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
253 if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
254 return MAKELONG( size.cx, size.cy );
258 /***********************************************************************
259 * OffsetWindowOrg (GDI.15)
261 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
264 if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
265 return MAKELONG( pt.x, pt.y );
269 /***********************************************************************
270 * ScaleWindowExt (GDI.16)
272 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
273 INT16 yNum, INT16 yDenom )
276 if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
278 return MAKELONG( size.cx, size.cy );
282 /***********************************************************************
283 * OffsetViewportOrg (GDI.17)
285 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
288 if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
289 return MAKELONG( pt.x, pt.y );
293 /***********************************************************************
294 * ScaleViewportExt (GDI.18)
296 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
297 INT16 yNum, INT16 yDenom )
300 if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
302 return MAKELONG( size.cx, size.cy );
306 /***********************************************************************
309 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
311 return LineTo( HDC_32(hdc), x, y );
315 /***********************************************************************
318 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
322 if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
323 return MAKELONG(pt.x,pt.y);
327 /***********************************************************************
328 * ExcludeClipRect (GDI.21)
330 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
331 INT16 right, INT16 bottom )
333 return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
337 /***********************************************************************
338 * IntersectClipRect (GDI.22)
340 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
341 INT16 right, INT16 bottom )
343 return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
347 /***********************************************************************
350 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
351 INT16 bottom, INT16 xstart, INT16 ystart,
352 INT16 xend, INT16 yend )
354 return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
358 /***********************************************************************
361 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
362 INT16 right, INT16 bottom )
364 return Ellipse( HDC_32(hdc), left, top, right, bottom );
368 /**********************************************************************
371 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
373 return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
377 /***********************************************************************
380 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
381 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
382 INT16 xend, INT16 yend )
384 return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
388 /***********************************************************************
391 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
392 INT16 right, INT16 bottom )
394 return Rectangle( HDC_32(hdc), left, top, right, bottom );
398 /***********************************************************************
401 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
402 INT16 bottom, INT16 ell_width, INT16 ell_height )
404 return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
408 /***********************************************************************
411 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
412 INT16 width, INT16 height, DWORD rop)
414 return PatBlt( HDC_32(hdc), left, top, width, height, rop );
418 /***********************************************************************
421 INT16 WINAPI SaveDC16( HDC16 hdc )
423 return SaveDC( HDC_32(hdc) );
427 /***********************************************************************
430 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
432 return SetPixel( HDC_32(hdc), x, y, color );
436 /***********************************************************************
437 * OffsetClipRgn (GDI.32)
439 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
441 return OffsetClipRgn( HDC_32(hdc), x, y );
445 /***********************************************************************
448 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
450 return TextOutA( HDC_32(hdc), x, y, str, count );
454 /***********************************************************************
457 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
458 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
461 return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
465 /***********************************************************************
466 * StretchBlt (GDI.35)
468 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
469 INT16 widthDst, INT16 heightDst,
470 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
471 INT16 widthSrc, INT16 heightSrc, DWORD rop )
473 return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
474 HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
478 /**********************************************************************
481 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
485 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) );
487 if (!pt32) return FALSE;
493 ret = Polygon(HDC_32(hdc),pt32,count);
494 HeapFree( GetProcessHeap(), 0, pt32 );
499 /**********************************************************************
502 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
506 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) );
508 if (!pt32) return FALSE;
514 ret = Polyline(HDC_32(hdc),pt32,count);
515 HeapFree( GetProcessHeap(), 0, pt32 );
520 /***********************************************************************
523 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
529 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
530 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
531 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
532 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
533 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
534 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
535 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
536 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
537 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
538 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
539 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
540 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
541 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
546 case EXT_DEVICE_CAPS:
549 case POSTSCRIPT_IGNORE:
550 case QUERYESCSUPPORT:
551 case SET_ARC_DIRECTION:
553 case SET_SCREEN_ANGLE:
556 INT16 *ptr = MapSL(in_data);
558 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
561 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
564 UINT16 *ptr = MapSL(in_data);
566 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
569 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
570 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
571 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
572 case GETPHYSPAGESIZE:
573 case GETPRINTINGOFFSET:
574 case GETSCALINGFACTOR:
576 POINT16 *ptr = out_data;
578 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
584 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
585 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
586 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
587 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
588 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
589 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
590 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
591 case ENABLEPAIRKERNING:
592 case ENABLERELATIVEWIDTHS:
599 INT16 *new = MapSL(in_data);
600 INT16 *old = out_data;
602 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
607 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
609 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
611 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
612 * lpvOutData is actually a pointer to the DocInfo structure and used as
613 * a second input parameter */
617 ret = StartDoc16( hdc, out_data );
618 if (ret > 0) ret = StartPage( HDC_32(hdc) );
621 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
623 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
624 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
628 RECT16 *rc16 = MapSL(in_data);
630 rc.left = rc16->left;
632 rc.right = rc16->right;
633 rc.bottom = rc16->bottom;
634 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
637 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
641 RECT16 *rc16 = out_data;
642 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
643 rc16->left = rc.left;
645 rc16->right = rc.right;
646 rc16->bottom = rc.bottom;
649 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
650 case DRAWPATTERNRECT:
653 DRAWPATRECT16 *pr16 = (DRAWPATRECT16*)MapSL(in_data);
655 pr.ptPosition.x = pr16->ptPosition.x;
656 pr.ptPosition.y = pr16->ptPosition.y;
657 pr.ptSize.x = pr16->ptSize.x;
658 pr.ptSize.y = pr16->ptSize.y;
659 pr.wStyle = pr16->wStyle;
660 pr.wPattern = pr16->wPattern;
661 return Escape( HDC_32(hdc), escape, sizeof(pr), (LPCSTR)&pr, NULL );
664 /* Escape(hdc,ABORTDOC,NULL,NULL); */
665 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
666 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
667 /* Escape(hdc,ENDDOC,NULL,NULL); */
668 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
669 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
670 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
671 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
672 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
673 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
674 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
675 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
676 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
677 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
678 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
679 /* Escape(hdc,NEWFRAME,NULL,NULL); */
680 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
681 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
682 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
683 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
684 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
685 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
686 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
695 case GETPAIRKERNTABLE:
696 case GETSETPAPERBINS:
697 case GETSETPRINTORIENT:
698 case GETSETSCREENPARAMS:
700 case GETTRACKKERNTABLE:
706 case SETALLJUSTVALUES:
708 case SET_BACKGROUND_COLOR:
710 /* pass it unmodified to the 32-bit function */
711 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
713 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
714 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
715 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
716 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
717 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
718 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
719 case ENUMPAPERMETRICS:
720 case GETEXTENDEDTEXTMETRICS:
722 case GETSETPAPERMETRICS:
723 case GETVECTORBRUSHSIZE:
724 case GETVECTORPENSIZE:
726 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
727 escape, in_count, MapSL(in_data), out_data );
728 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
733 /***********************************************************************
736 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
738 return RestoreDC( HDC_32(hdc), level );
742 /***********************************************************************
745 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
747 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
751 /***********************************************************************
754 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
755 INT16 nWidth, INT16 nHeight )
757 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
761 /***********************************************************************
764 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
766 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
770 /***********************************************************************
773 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
775 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
779 /***********************************************************************
780 * SelectClipRgn (GDI.44)
782 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
784 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
788 /***********************************************************************
789 * SelectObject (GDI.45)
791 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
793 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
797 /***********************************************************************
798 * CombineRgn (GDI.47)
800 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
802 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
806 /***********************************************************************
807 * CreateBitmap (GDI.48)
809 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
810 UINT16 bpp, LPCVOID bits )
812 return HBITMAP_16( CreateBitmap( width, height, planes & 0xff, bpp & 0xff, bits ) );
816 /***********************************************************************
817 * CreateBitmapIndirect (GDI.49)
819 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
821 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
822 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
826 /***********************************************************************
827 * CreateBrushIndirect (GDI.50)
829 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
833 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
834 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
836 brush32.lbStyle = brush->lbStyle;
837 brush32.lbColor = brush->lbColor;
838 brush32.lbHatch = brush->lbHatch;
839 return HBRUSH_16( CreateBrushIndirect(&brush32) );
843 /***********************************************************************
844 * CreateCompatibleBitmap (GDI.51)
846 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
848 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
852 /***********************************************************************
853 * CreateCompatibleDC (GDI.52)
855 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
857 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
861 /***********************************************************************
864 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
865 const DEVMODEA *initData )
867 return HDC_16( CreateDCA( driver, device, output, initData ) );
871 /***********************************************************************
872 * CreateEllipticRgn (GDI.54)
874 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
876 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
880 /***********************************************************************
881 * CreateEllipticRgnIndirect (GDI.55)
883 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
885 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
889 /***********************************************************************
890 * CreateFont (GDI.56)
892 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
893 INT16 weight, BYTE italic, BYTE underline,
894 BYTE strikeout, BYTE charset, BYTE outpres,
895 BYTE clippres, BYTE quality, BYTE pitch,
898 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
899 strikeout, charset, outpres, clippres, quality, pitch, name ));
902 /***********************************************************************
903 * CreateFontIndirect (GDI.57)
905 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
912 logfont_16_to_W( plf16, &lfW );
913 ret = CreateFontIndirectW( &lfW );
915 else ret = CreateFontIndirectW( NULL );
916 return HFONT_16(ret);
920 /***********************************************************************
921 * CreateHatchBrush (GDI.58)
923 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
925 return HBRUSH_16( CreateHatchBrush( style, color ) );
929 /***********************************************************************
930 * CreatePatternBrush (GDI.60)
932 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
934 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
938 /***********************************************************************
941 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
945 logpen.lopnStyle = style;
946 logpen.lopnWidth.x = width;
947 logpen.lopnWidth.y = 0;
948 logpen.lopnColor = color;
949 return HPEN_16( CreatePenIndirect( &logpen ) );
953 /***********************************************************************
954 * CreatePenIndirect (GDI.62)
956 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
960 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
961 logpen.lopnStyle = pen->lopnStyle;
962 logpen.lopnWidth.x = pen->lopnWidth.x;
963 logpen.lopnWidth.y = pen->lopnWidth.y;
964 logpen.lopnColor = pen->lopnColor;
965 return HPEN_16( CreatePenIndirect( &logpen ) );
969 /***********************************************************************
970 * CreatePolygonRgn (GDI.63)
972 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
974 return CreatePolyPolygonRgn16( points, &count, 1, mode );
978 /***********************************************************************
979 * CreateRectRgn (GDI.64)
981 * NOTE: cf. SetRectRgn16
983 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
987 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
988 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
989 return HRGN_16(hrgn);
993 /***********************************************************************
994 * CreateRectRgnIndirect (GDI.65)
996 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
998 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
1002 /***********************************************************************
1003 * CreateSolidBrush (GDI.66)
1005 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
1007 return HBRUSH_16( CreateSolidBrush( color ) );
1011 /***********************************************************************
1014 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
1016 return DeleteDC( HDC_32(hdc) );
1020 /***********************************************************************
1021 * DeleteObject (GDI.69)
1022 * SysDeleteObject (GDI.605)
1024 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
1026 return DeleteObject( HGDIOBJ_32(obj) );
1030 /***********************************************************************
1031 * EnumObjects (GDI.71)
1033 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1035 struct callback16_info info;
1037 info.proc = (FARPROC16)proc;
1038 info.param = lParam;
1042 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1044 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1050 /***********************************************************************
1053 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1055 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1059 /***********************************************************************
1060 * GetBitmapBits (GDI.74)
1062 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1064 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1068 /***********************************************************************
1069 * GetBkColor (GDI.75)
1071 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1073 return GetBkColor( HDC_32(hdc) );
1077 /***********************************************************************
1078 * GetBkMode (GDI.76)
1080 INT16 WINAPI GetBkMode16( HDC16 hdc )
1082 return GetBkMode( HDC_32(hdc) );
1086 /***********************************************************************
1087 * GetClipBox (GDI.77)
1089 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1092 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1096 rect->left = rect32.left;
1097 rect->top = rect32.top;
1098 rect->right = rect32.right;
1099 rect->bottom = rect32.bottom;
1105 /***********************************************************************
1106 * GetCurrentPosition (GDI.78)
1108 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1111 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1112 return MAKELONG( pt32.x, pt32.y );
1116 /***********************************************************************
1119 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1122 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1127 /***********************************************************************
1128 * GetDeviceCaps (GDI.80)
1130 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1132 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1133 /* some apps don't expect -1 and think it's a B&W screen */
1134 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1139 /***********************************************************************
1140 * GetMapMode (GDI.81)
1142 INT16 WINAPI GetMapMode16( HDC16 hdc )
1144 return GetMapMode( HDC_32(hdc) );
1148 /***********************************************************************
1151 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1153 return GetPixel( HDC_32(hdc), x, y );
1157 /***********************************************************************
1158 * GetPolyFillMode (GDI.84)
1160 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1162 return GetPolyFillMode( HDC_32(hdc) );
1166 /***********************************************************************
1169 INT16 WINAPI GetROP216( HDC16 hdc )
1171 return GetROP2( HDC_32(hdc) );
1175 /***********************************************************************
1176 * GetRelAbs (GDI.86)
1178 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1180 return GetRelAbs( HDC_32(hdc), 0 );
1184 /***********************************************************************
1185 * GetStockObject (GDI.87)
1187 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1189 return HGDIOBJ_16( GetStockObject( obj ) );
1193 /***********************************************************************
1194 * GetStretchBltMode (GDI.88)
1196 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1198 return GetStretchBltMode( HDC_32(hdc) );
1202 /***********************************************************************
1203 * GetTextCharacterExtra (GDI.89)
1205 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1207 return GetTextCharacterExtra( HDC_32(hdc) );
1211 /***********************************************************************
1212 * GetTextColor (GDI.90)
1214 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1216 return GetTextColor( HDC_32(hdc) );
1220 /***********************************************************************
1221 * GetTextExtent (GDI.91)
1223 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1226 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1227 return MAKELONG( size.cx, size.cy );
1231 /***********************************************************************
1232 * GetTextFace (GDI.92)
1234 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1236 return GetTextFaceA( HDC_32(hdc), count, name );
1240 /***********************************************************************
1241 * GetTextMetrics (GDI.93)
1243 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1247 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1249 tm->tmHeight = tm32.tmHeight;
1250 tm->tmAscent = tm32.tmAscent;
1251 tm->tmDescent = tm32.tmDescent;
1252 tm->tmInternalLeading = tm32.tmInternalLeading;
1253 tm->tmExternalLeading = tm32.tmExternalLeading;
1254 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1255 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1256 tm->tmWeight = tm32.tmWeight;
1257 tm->tmOverhang = tm32.tmOverhang;
1258 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1259 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1260 tm->tmFirstChar = tm32.tmFirstChar;
1261 tm->tmLastChar = tm32.tmLastChar;
1262 tm->tmDefaultChar = tm32.tmDefaultChar;
1263 tm->tmBreakChar = tm32.tmBreakChar;
1264 tm->tmItalic = tm32.tmItalic;
1265 tm->tmUnderlined = tm32.tmUnderlined;
1266 tm->tmStruckOut = tm32.tmStruckOut;
1267 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1268 tm->tmCharSet = tm32.tmCharSet;
1273 /***********************************************************************
1274 * GetViewportExt (GDI.94)
1276 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1279 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1280 return MAKELONG( size.cx, size.cy );
1284 /***********************************************************************
1285 * GetViewportOrg (GDI.95)
1287 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1290 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1291 return MAKELONG( pt.x, pt.y );
1295 /***********************************************************************
1296 * GetWindowExt (GDI.96)
1298 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1301 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1302 return MAKELONG( size.cx, size.cy );
1306 /***********************************************************************
1307 * GetWindowOrg (GDI.97)
1309 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1312 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1313 return MAKELONG( pt.x, pt.y );
1319 /**********************************************************************
1322 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1323 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1325 struct callback16_info info;
1326 info.proc = (FARPROC16)proc;
1327 info.param = lParam;
1328 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1332 /***********************************************************************
1333 * OffsetRgn (GDI.101)
1335 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1337 return OffsetRgn( HRGN_32(hrgn), x, y );
1341 /***********************************************************************
1342 * PtVisible (GDI.103)
1344 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1346 return PtVisible( HDC_32(hdc), x, y );
1350 /***********************************************************************
1351 * SetBitmapBits (GDI.106)
1353 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1355 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1359 /***********************************************************************
1360 * AddFontResource (GDI.119)
1362 INT16 WINAPI AddFontResource16( LPCSTR filename )
1364 return AddFontResourceA( filename );
1368 /***********************************************************************
1371 * Disables GDI, switches back to text mode.
1372 * We don't have to do anything here,
1373 * just let console support handle everything
1375 void WINAPI Death16(HDC16 hdc)
1377 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1381 /***********************************************************************
1382 * Resurrection (GDI.122)
1384 * Restores GDI functionality
1386 void WINAPI Resurrection16(HDC16 hdc,
1387 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1389 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1390 hdc, w1, w2, w3, w4, w5, w6);
1394 /**********************************************************************
1395 * CreateMetaFile (GDI.125)
1397 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1399 return HDC_16( CreateMetaFileA( filename ) );
1403 /***********************************************************************
1406 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1409 if (!nDivisor) return -32768;
1410 /* We want to deal with a positive divisor to simplify the logic. */
1413 nMultiplicand = - nMultiplicand;
1414 nDivisor = -nDivisor;
1416 /* If the result is positive, we "add" to round. else,
1417 * we subtract to round. */
1418 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1419 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1420 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1422 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1423 if ((ret > 32767) || (ret < -32767)) return -32768;
1428 /***********************************************************************
1429 * GetRgnBox (GDI.134)
1431 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1434 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1435 rect->left = r.left;
1437 rect->right = r.right;
1438 rect->bottom = r.bottom;
1443 /***********************************************************************
1444 * RemoveFontResource (GDI.136)
1446 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1448 return RemoveFontResourceA(str);
1452 /***********************************************************************
1453 * SetBrushOrg (GDI.148)
1455 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1459 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1460 return MAKELONG( pt.x, pt.y );
1464 /***********************************************************************
1465 * GetBrushOrg (GDI.149)
1467 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1470 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1471 return MAKELONG( pt.x, pt.y );
1475 /***********************************************************************
1476 * UnrealizeObject (GDI.150)
1478 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1480 return UnrealizeObject( HGDIOBJ_32(obj) );
1484 /***********************************************************************
1485 * CreateIC (GDI.153)
1487 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1488 const DEVMODEA* initData )
1490 return HDC_16( CreateICA( driver, device, output, initData ) );
1494 /***********************************************************************
1495 * GetNearestColor (GDI.154)
1497 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1499 return GetNearestColor( HDC_32(hdc), color );
1503 /***********************************************************************
1504 * CreateDiscardableBitmap (GDI.156)
1506 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1508 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1512 /***********************************************************************
1513 * PtInRegion (GDI.161)
1515 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1517 return PtInRegion( HRGN_32(hrgn), x, y );
1521 /***********************************************************************
1522 * GetBitmapDimension (GDI.162)
1524 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1527 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1528 return MAKELONG( size.cx, size.cy );
1532 /***********************************************************************
1533 * SetBitmapDimension (GDI.163)
1535 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1538 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1539 return MAKELONG( size.cx, size.cy );
1543 /***********************************************************************
1544 * SetRectRgn (GDI.172)
1546 * NOTE: Win 3.1 sets region to empty if left > right
1548 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1550 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1551 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1555 /******************************************************************
1556 * PlayMetaFileRecord (GDI.176)
1558 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1560 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1563 for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1564 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1565 for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1566 HeapFree( GetProcessHeap(), 0, ht32 );
1570 /***********************************************************************
1571 * SetBoundsRect (GDI.193)
1573 UINT16 WINAPI SetBoundsRect16( HDC16 hdc, const RECT16* rect, UINT16 flags )
1578 rect32.left = rect->left;
1579 rect32.top = rect->top;
1580 rect32.right = rect->right;
1581 rect32.bottom = rect->bottom;
1582 return SetBoundsRect( HDC_32( hdc ), &rect32, flags );
1584 else return SetBoundsRect( HDC_32( hdc ), NULL, flags );
1588 /***********************************************************************
1589 * GetBoundsRect (GDI.194)
1591 UINT16 WINAPI GetBoundsRect16( HDC16 hdc, LPRECT16 rect, UINT16 flags)
1594 UINT ret = GetBoundsRect( HDC_32( hdc ), &rect32, flags );
1597 rect->left = rect32.left;
1598 rect->top = rect32.top;
1599 rect->right = rect32.right;
1600 rect->bottom = rect32.bottom;
1606 /***********************************************************************
1607 * EngineEnumerateFont (GDI.300)
1609 WORD WINAPI EngineEnumerateFont16(LPSTR fontname, FARPROC16 proc, DWORD data )
1611 FIXME("(%s,%p,%lx),stub\n",fontname,proc,data);
1616 /***********************************************************************
1617 * EngineDeleteFont (GDI.301)
1619 WORD WINAPI EngineDeleteFont16(LPFONTINFO16 lpFontInfo)
1623 /* untested, don't know if it works.
1624 We seem to access some structure that is located after the
1625 FONTINFO. The FONTINFO documentation says that there may
1626 follow some char-width table or font bitmap or vector info.
1627 I think it is some kind of font bitmap that begins at offset 0x52,
1628 as FONTINFO goes up to 0x51.
1629 If this is correct, everything should be implemented correctly.
1631 if ( ((lpFontInfo->dfType & (RASTER_FONTTYPE|DEVICE_FONTTYPE)) == (RASTER_FONTTYPE|DEVICE_FONTTYPE))
1632 && (LOWORD(lpFontInfo->dfFace) == LOWORD(lpFontInfo)+0x6e)
1633 && (handle = *(WORD *)(lpFontInfo+0x54)) )
1635 *(WORD *)(lpFontInfo+0x54) = 0;
1636 GlobalFree16(handle);
1642 /***********************************************************************
1643 * EngineRealizeFont (GDI.302)
1645 WORD WINAPI EngineRealizeFont16(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
1647 FIXME("(%p,%p,%p),stub\n",lplogFont,lptextxform,lpfontInfo);
1653 /***********************************************************************
1654 * EngineRealizeFontExt (GDI.315)
1656 WORD WINAPI EngineRealizeFontExt16(LONG l1, LONG l2, LONG l3, LONG l4)
1658 FIXME("(%08lx,%08lx,%08lx,%08lx),stub\n",l1,l2,l3,l4);
1664 /***********************************************************************
1665 * EngineGetCharWidth (GDI.303)
1667 WORD WINAPI EngineGetCharWidth16(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE lastChar, LPINT16 buffer)
1671 for (i = firstChar; i <= lastChar; i++)
1672 FIXME(" returns font's average width for range %d to %d\n", firstChar, lastChar);
1673 *buffer++ = lpFontInfo->dfAvgWidth; /* insert some charwidth functionality here; use average width for now */
1678 /***********************************************************************
1679 * EngineSetFontContext (GDI.304)
1681 WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data)
1687 /***********************************************************************
1688 * EngineGetGlyphBMP (GDI.305)
1690 WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2,
1691 LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics)
1698 /***********************************************************************
1699 * EngineMakeFontDir (GDI.306)
1701 DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string)
1703 FIXME(" stub! (always fails)\n");
1704 return ~0UL; /* error */
1708 /***********************************************************************
1709 * GetCharABCWidths (GDI.307)
1711 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1715 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1717 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1719 for (i = firstChar; i <= lastChar; i++)
1721 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1722 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1723 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1726 HeapFree( GetProcessHeap(), 0, abc32 );
1731 /***********************************************************************
1732 * GetGlyphOutline (GDI.309)
1734 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1735 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1736 LPVOID lpBuffer, const MAT2 *lpmat2 )
1741 ret = GetGlyphOutlineA( HDC_32(hdc), uChar, fuFormat, &gm32, cbBuffer, lpBuffer, lpmat2);
1742 lpgm->gmBlackBoxX = gm32.gmBlackBoxX;
1743 lpgm->gmBlackBoxY = gm32.gmBlackBoxY;
1744 lpgm->gmptGlyphOrigin.x = gm32.gmptGlyphOrigin.x;
1745 lpgm->gmptGlyphOrigin.y = gm32.gmptGlyphOrigin.y;
1746 lpgm->gmCellIncX = gm32.gmCellIncX;
1747 lpgm->gmCellIncY = gm32.gmCellIncY;
1752 /***********************************************************************
1753 * CreateScalableFontResource (GDI.310)
1755 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1756 LPCSTR fontFile, LPCSTR path )
1758 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1762 /*************************************************************************
1763 * GetFontData (GDI.311)
1766 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1768 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1772 /*************************************************************************
1773 * GetRasterizerCaps (GDI.313)
1775 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1777 return GetRasterizerCaps( lprs, cbNumBytes );
1781 /*************************************************************************
1782 * GetKerningPairs (GDI.332)
1785 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1787 KERNINGPAIR *pairs32;
1790 if (!count) return 0;
1792 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1793 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1795 for (i = 0; i < ret; i++)
1797 pairs->wFirst = pairs32->wFirst;
1798 pairs->wSecond = pairs32->wSecond;
1799 pairs->iKernAmount = pairs32->iKernAmount;
1802 HeapFree( GetProcessHeap(), 0, pairs32 );
1808 /***********************************************************************
1809 * GetTextAlign (GDI.345)
1811 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1813 return GetTextAlign( HDC_32(hdc) );
1817 /***********************************************************************
1818 * SetTextAlign (GDI.346)
1820 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1822 return SetTextAlign( HDC_32(hdc), align );
1826 /***********************************************************************
1829 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1830 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1831 INT16 xend, INT16 yend )
1833 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1837 /***********************************************************************
1838 * SetMapperFlags (GDI.349)
1840 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1842 return SetMapperFlags( HDC_32(hdc), flags );
1846 /***********************************************************************
1847 * GetCharWidth (GDI.350)
1849 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
1851 BOOL retVal = FALSE;
1853 if( firstChar != lastChar )
1855 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
1858 LPINT obuf32 = buf32;
1861 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
1864 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
1866 HeapFree(GetProcessHeap(), 0, obuf32);
1869 else /* happens quite often to warrant a special treatment */
1872 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
1879 /***********************************************************************
1880 * ExtTextOut (GDI.351)
1882 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
1883 const RECT16 *lprect, LPCSTR str, UINT16 count,
1889 LPINT lpdx32 = NULL;
1892 lpdx32 = HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
1893 if(lpdx32 == NULL) return FALSE;
1894 for (i=count;i--;) lpdx32[i]=lpDx[i];
1898 rect32.left = lprect->left;
1899 rect32.top = lprect->top;
1900 rect32.right = lprect->right;
1901 rect32.bottom = lprect->bottom;
1903 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
1904 HeapFree( GetProcessHeap(), 0, lpdx32 );
1909 /***********************************************************************
1910 * CreatePalette (GDI.360)
1912 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
1914 return HPALETTE_16( CreatePalette( palette ) );
1918 /***********************************************************************
1919 * GDISelectPalette (GDI.361)
1921 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
1923 return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
1927 /***********************************************************************
1928 * GDIRealizePalette (GDI.362)
1930 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
1932 return GDIRealizePalette( HDC_32(hdc) );
1936 /***********************************************************************
1937 * GetPaletteEntries (GDI.363)
1939 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1940 UINT16 count, LPPALETTEENTRY entries )
1942 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1946 /***********************************************************************
1947 * SetPaletteEntries (GDI.364)
1949 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1950 UINT16 count, const PALETTEENTRY *entries )
1952 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1956 /**********************************************************************
1957 * UpdateColors (GDI.366)
1959 INT16 WINAPI UpdateColors16( HDC16 hdc )
1961 UpdateColors( HDC_32(hdc) );
1966 /***********************************************************************
1967 * AnimatePalette (GDI.367)
1969 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
1970 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
1972 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
1976 /***********************************************************************
1977 * ResizePalette (GDI.368)
1979 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
1981 return ResizePalette( HPALETTE_32(hpalette), cEntries );
1985 /***********************************************************************
1986 * GetNearestPaletteIndex (GDI.370)
1988 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
1990 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
1994 /**********************************************************************
1995 * ExtFloodFill (GDI.372)
1997 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
2000 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
2004 /***********************************************************************
2005 * SetSystemPaletteUse (GDI.373)
2007 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
2009 return SetSystemPaletteUse( HDC_32(hdc), use );
2013 /***********************************************************************
2014 * GetSystemPaletteUse (GDI.374)
2016 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
2018 return GetSystemPaletteUse( HDC_32(hdc) );
2022 /***********************************************************************
2023 * GetSystemPaletteEntries (GDI.375)
2025 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
2026 LPPALETTEENTRY entries )
2028 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
2032 /***********************************************************************
2035 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
2037 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
2041 /******************************************************************
2042 * StartDoc (GDI.377)
2044 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
2048 docA.cbSize = lpdoc->cbSize;
2049 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
2050 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
2051 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
2052 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
2054 docA.lpszDatatype = NULL;
2055 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
2056 docA.fwType = lpdoc->fwType;
2059 return StartDocA( HDC_32(hdc), &docA );
2063 /******************************************************************
2066 INT16 WINAPI EndDoc16( HDC16 hdc )
2068 return EndDoc( HDC_32(hdc) );
2072 /******************************************************************
2073 * StartPage (GDI.379)
2075 INT16 WINAPI StartPage16( HDC16 hdc )
2077 return StartPage( HDC_32(hdc) );
2081 /******************************************************************
2084 INT16 WINAPI EndPage16( HDC16 hdc )
2086 return EndPage( HDC_32(hdc) );
2090 /******************************************************************************
2091 * AbortDoc (GDI.382)
2093 INT16 WINAPI AbortDoc16( HDC16 hdc )
2095 return AbortDoc( HDC_32(hdc) );
2099 /***********************************************************************
2100 * FastWindowFrame (GDI.400)
2102 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
2103 INT16 width, INT16 height, DWORD rop )
2105 HDC hdc32 = HDC_32(hdc);
2106 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
2107 PatBlt( hdc32, rect->left, rect->top,
2108 rect->right - rect->left - width, height, rop );
2109 PatBlt( hdc32, rect->left, rect->top + height, width,
2110 rect->bottom - rect->top - height, rop );
2111 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
2112 rect->right - rect->left - width, -height, rop );
2113 PatBlt( hdc32, rect->right - 1, rect->top, -width,
2114 rect->bottom - rect->top - height, rop );
2115 SelectObject( hdc32, hbrush );
2120 /***********************************************************************
2121 * CreateUserBitmap (GDI.407)
2123 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
2124 UINT16 bpp, LPCVOID bits )
2126 return CreateBitmap16( width, height, planes, bpp, bits );
2130 /***********************************************************************
2131 * CreateUserDiscardableBitmap (GDI.409)
2133 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
2135 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
2136 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
2138 return HBITMAP_16(ret);
2142 /***********************************************************************
2143 * GetCurLogFont (GDI.411)
2145 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
2147 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
2151 /***********************************************************************
2152 * StretchDIBits (GDI.439)
2154 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
2155 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
2156 INT16 heightSrc, const VOID *bits,
2157 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
2159 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
2160 xSrc, ySrc, widthSrc, heightSrc, bits,
2161 info, wUsage, dwRop );
2165 /***********************************************************************
2166 * SetDIBits (GDI.440)
2168 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2169 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2172 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2176 /***********************************************************************
2177 * GetDIBits (GDI.441)
2179 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2180 UINT16 lines, LPVOID bits, BITMAPINFO * info,
2183 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2187 /***********************************************************************
2188 * CreateDIBitmap (GDI.442)
2190 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
2191 DWORD init, LPCVOID bits, const BITMAPINFO * data,
2194 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
2198 /***********************************************************************
2199 * SetDIBitsToDevice (GDI.443)
2201 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2202 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2203 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2206 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2207 startscan, lines, bits, info, coloruse );
2211 /***********************************************************************
2212 * CreateRoundRectRgn (GDI.444)
2214 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2215 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2216 * we just let CreateRoundRectRgn convert them to +ve values.
2219 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2220 INT16 ellipse_width, INT16 ellipse_height )
2222 if( ellipse_width == 0 || ellipse_height == 0 )
2223 return CreateRectRgn16( left, top, right, bottom );
2225 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2226 ellipse_width, ellipse_height ));
2230 /***********************************************************************
2231 * CreateDIBPatternBrush (GDI.445)
2233 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2238 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2239 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2240 GlobalUnlock16( hbitmap );
2245 /**********************************************************************
2246 * PolyPolygon (GDI.450)
2248 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2257 for (i=polygons;i--;)
2259 pt32 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2260 if(pt32 == NULL) return FALSE;
2263 pt32[i].x = pt[i].x;
2264 pt32[i].y = pt[i].y;
2266 counts32 = HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2267 if(counts32 == NULL) {
2268 HeapFree( GetProcessHeap(), 0, pt32 );
2271 for (i=polygons;i--;) counts32[i]=counts[i];
2273 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2274 HeapFree( GetProcessHeap(), 0, counts32 );
2275 HeapFree( GetProcessHeap(), 0, pt32 );
2280 /***********************************************************************
2281 * CreatePolyPolygonRgn (GDI.451)
2283 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2284 const INT16 *count, INT16 nbpolygons, INT16 mode )
2291 for (i = 0; i < nbpolygons; i++) npts += count[i];
2292 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2293 for (i = 0; i < npts; i++)
2295 points32[i].x = points[i].x;
2296 points32[i].y = points[i].y;
2299 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2300 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2301 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2302 HeapFree( GetProcessHeap(), 0, count32 );
2303 HeapFree( GetProcessHeap(), 0, points32 );
2304 return HRGN_16(hrgn);
2308 /***********************************************************************
2309 * SetObjectOwner (GDI.461)
2311 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2317 /***********************************************************************
2318 * RectVisible (GDI.465)
2319 * RectVisibleOld (GDI.104)
2321 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2325 rect.left = rect16->left;
2326 rect.top = rect16->top;
2327 rect.right = rect16->right;
2328 rect.bottom = rect16->bottom;
2329 return RectVisible( HDC_32(hdc), &rect );
2333 /***********************************************************************
2334 * RectInRegion (GDI.466)
2335 * RectInRegionOld (GDI.181)
2337 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2341 r32.left = rect->left;
2342 r32.top = rect->top;
2343 r32.right = rect->right;
2344 r32.bottom = rect->bottom;
2345 return RectInRegion( HRGN_32(hrgn), &r32 );
2349 /***********************************************************************
2350 * GetBitmapDimensionEx (GDI.468)
2352 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2355 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2359 size->cx = size32.cx;
2360 size->cy = size32.cy;
2366 /***********************************************************************
2367 * GetBrushOrgEx (GDI.469)
2369 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2372 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2379 /***********************************************************************
2380 * GetCurrentPositionEx (GDI.470)
2382 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2385 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2392 /***********************************************************************
2393 * GetTextExtentPoint (GDI.471)
2395 * FIXME: Should this have a bug for compatibility?
2396 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2397 * bugs (-> MSDN KB q147647.txt).
2399 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2402 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2406 size->cx = size32.cx;
2407 size->cy = size32.cy;
2413 /***********************************************************************
2414 * GetViewportExtEx (GDI.472)
2416 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2419 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2420 size->cx = size32.cx;
2421 size->cy = size32.cy;
2426 /***********************************************************************
2427 * GetViewportOrgEx (GDI.473)
2429 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2432 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2439 /***********************************************************************
2440 * GetWindowExtEx (GDI.474)
2442 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2445 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2446 size->cx = size32.cx;
2447 size->cy = size32.cy;
2452 /***********************************************************************
2453 * GetWindowOrgEx (GDI.475)
2455 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2458 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2465 /***********************************************************************
2466 * OffsetViewportOrgEx (GDI.476)
2468 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2471 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2481 /***********************************************************************
2482 * OffsetWindowOrgEx (GDI.477)
2484 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2487 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2497 /***********************************************************************
2498 * SetBitmapDimensionEx (GDI.478)
2500 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2503 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2505 if (ret && prevSize)
2507 prevSize->cx = size32.cx;
2508 prevSize->cy = size32.cy;
2514 /***********************************************************************
2515 * SetViewportExtEx (GDI.479)
2517 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2520 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2521 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2526 /***********************************************************************
2527 * SetViewportOrgEx (GDI.480)
2529 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2532 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2542 /***********************************************************************
2543 * SetWindowExtEx (GDI.481)
2545 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2548 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2549 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2554 /***********************************************************************
2555 * SetWindowOrgEx (GDI.482)
2557 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2560 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2570 /***********************************************************************
2571 * MoveToEx (GDI.483)
2573 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2577 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2587 /***********************************************************************
2588 * ScaleViewportExtEx (GDI.484)
2590 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2591 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2594 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2596 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2601 /***********************************************************************
2602 * ScaleWindowExtEx (GDI.485)
2604 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2605 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2608 BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2610 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2615 /******************************************************************************
2616 * PolyBezier (GDI.502)
2618 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2622 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, cPoints*sizeof(POINT) );
2623 if(!pt32) return FALSE;
2624 for (i=cPoints;i--;)
2626 pt32[i].x = lppt[i].x;
2627 pt32[i].y = lppt[i].y;
2629 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2630 HeapFree( GetProcessHeap(), 0, pt32 );
2635 /******************************************************************************
2636 * PolyBezierTo (GDI.503)
2638 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2642 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0,
2643 cPoints*sizeof(POINT) );
2644 if(!pt32) return FALSE;
2645 for (i=cPoints;i--;)
2647 pt32[i].x = lppt[i].x;
2648 pt32[i].y = lppt[i].y;
2650 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2651 HeapFree( GetProcessHeap(), 0, pt32 );
2656 /******************************************************************************
2657 * ExtSelectClipRgn (GDI.508)
2659 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2661 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2665 /***********************************************************************
2666 * AbortPath (GDI.511)
2668 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2670 return AbortPath( HDC_32(hdc) );
2674 /***********************************************************************
2675 * BeginPath (GDI.512)
2677 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2679 return BeginPath( HDC_32(hdc) );
2683 /***********************************************************************
2684 * CloseFigure (GDI.513)
2686 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2688 return CloseFigure( HDC_32(hdc) );
2692 /***********************************************************************
2695 BOOL16 WINAPI EndPath16(HDC16 hdc)
2697 return EndPath( HDC_32(hdc) );
2701 /***********************************************************************
2702 * FillPath (GDI.515)
2704 BOOL16 WINAPI FillPath16(HDC16 hdc)
2706 return FillPath( HDC_32(hdc) );
2710 /*******************************************************************
2711 * FlattenPath (GDI.516)
2713 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2715 return FlattenPath( HDC_32(hdc) );
2719 /***********************************************************************
2722 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2724 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2729 /***********************************************************************
2730 * PathToRegion (GDI.518)
2732 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2734 return HRGN_16( PathToRegion( HDC_32(hdc) ));
2738 /***********************************************************************
2739 * SelectClipPath (GDI.519)
2741 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2743 return SelectClipPath( HDC_32(hdc), iMode );
2747 /*******************************************************************
2748 * StrokeAndFillPath (GDI.520)
2750 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
2752 return StrokeAndFillPath( HDC_32(hdc) );
2756 /*******************************************************************
2757 * StrokePath (GDI.521)
2759 BOOL16 WINAPI StrokePath16(HDC16 hdc)
2761 return StrokePath( HDC_32(hdc) );
2765 /*******************************************************************
2766 * WidenPath (GDI.522)
2768 BOOL16 WINAPI WidenPath16(HDC16 hdc)
2770 return WidenPath( HDC_32(hdc) );
2774 /***********************************************************************
2775 * GetArcDirection (GDI.524)
2777 INT16 WINAPI GetArcDirection16( HDC16 hdc )
2779 return GetArcDirection( HDC_32(hdc) );
2783 /***********************************************************************
2784 * SetArcDirection (GDI.525)
2786 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
2788 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
2792 /***********************************************************************
2793 * CreateHalftonePalette (GDI.529)
2795 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
2797 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
2801 /***********************************************************************
2802 * SetDIBColorTable (GDI.602)
2804 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2806 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2810 /***********************************************************************
2811 * GetDIBColorTable (GDI.603)
2813 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2815 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2819 /***********************************************************************
2820 * GetRegionData (GDI.607)
2822 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2824 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
2826 return GetRegionData( HRGN_32(hrgn), count, rgndata );
2830 /***********************************************************************
2831 * GetTextCharset (GDI.612)
2833 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
2835 return GetTextCharset( HDC_32(hdc) );
2839 /*************************************************************************
2840 * GetFontLanguageInfo (GDI.616)
2842 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
2844 return GetFontLanguageInfo( HDC_32(hdc) );
2848 /***********************************************************************
2849 * SetLayout (GDI.1000)
2851 * Sets left->right or right->left text layout flags of a dc.
2853 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
2855 return SetLayout( HDC_32(hdc), layout );