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 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
486 count*sizeof(POINT) );
488 if (!pt32) return FALSE;
489 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
490 ret = Polygon(HDC_32(hdc),pt32,count);
491 HeapFree( GetProcessHeap(), 0, pt32 );
496 /**********************************************************************
499 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
503 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
504 count*sizeof(POINT) );
506 if (!pt32) return FALSE;
507 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
508 ret = Polyline(HDC_32(hdc),pt32,count);
509 HeapFree( GetProcessHeap(), 0, pt32 );
514 /***********************************************************************
517 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
523 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
524 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
525 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
526 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
527 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
528 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
529 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
530 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
531 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
532 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
533 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
534 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
535 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
540 case EXT_DEVICE_CAPS:
543 case POSTSCRIPT_IGNORE:
544 case QUERYESCSUPPORT:
545 case SET_ARC_DIRECTION:
547 case SET_SCREEN_ANGLE:
550 INT16 *ptr = MapSL(in_data);
552 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
555 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
558 UINT16 *ptr = MapSL(in_data);
560 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
563 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
564 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
565 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
566 case GETPHYSPAGESIZE:
567 case GETPRINTINGOFFSET:
568 case GETSCALINGFACTOR:
570 POINT16 *ptr = out_data;
572 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
578 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
579 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
580 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
581 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
582 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
583 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
584 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
585 case ENABLEPAIRKERNING:
586 case ENABLERELATIVEWIDTHS:
593 INT16 *new = MapSL(in_data);
594 INT16 *old = out_data;
596 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
601 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
603 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
605 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
606 * lpvOutData is actually a pointer to the DocInfo structure and used as
607 * a second input parameter */
611 ret = StartDoc16( hdc, out_data );
612 if (ret > 0) ret = StartPage( HDC_32(hdc) );
615 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
617 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
618 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
622 RECT16 *rc16 = MapSL(in_data);
624 rc.left = rc16->left;
626 rc.right = rc16->right;
627 rc.bottom = rc16->bottom;
628 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
631 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
635 RECT16 *rc16 = out_data;
636 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
637 rc16->left = rc.left;
639 rc16->right = rc.right;
640 rc16->bottom = rc.bottom;
644 /* Escape(hdc,ABORTDOC,NULL,NULL); */
645 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
646 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
647 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
648 /* Escape(hdc,ENDDOC,NULL,NULL); */
649 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
650 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
651 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
652 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
653 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
654 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
655 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
656 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
657 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
658 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
659 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
660 /* Escape(hdc,NEWFRAME,NULL,NULL); */
661 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
662 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
663 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
664 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
665 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
666 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
667 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
671 case DRAWPATTERNRECT:
677 case GETPAIRKERNTABLE:
678 case GETSETPAPERBINS:
679 case GETSETPRINTORIENT:
680 case GETSETSCREENPARAMS:
682 case GETTRACKKERNTABLE:
688 case SETALLJUSTVALUES:
690 case SET_BACKGROUND_COLOR:
692 /* pass it unmodified to the 32-bit function */
693 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
695 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
696 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
697 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
698 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
699 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
700 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
701 case ENUMPAPERMETRICS:
702 case GETEXTENDEDTEXTMETRICS:
704 case GETSETPAPERMETRICS:
705 case GETVECTORBRUSHSIZE:
706 case GETVECTORPENSIZE:
708 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
709 escape, in_count, MapSL(in_data), out_data );
710 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
715 /***********************************************************************
718 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
720 return RestoreDC( HDC_32(hdc), level );
724 /***********************************************************************
727 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
729 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
733 /***********************************************************************
736 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
737 INT16 nWidth, INT16 nHeight )
739 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
743 /***********************************************************************
746 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
748 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
752 /***********************************************************************
755 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
757 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
761 /***********************************************************************
762 * SelectClipRgn (GDI.44)
764 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
766 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
770 /***********************************************************************
771 * SelectObject (GDI.45)
773 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
775 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
779 /***********************************************************************
780 * CombineRgn (GDI.47)
782 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
784 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
788 /***********************************************************************
789 * CreateBitmap (GDI.48)
791 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
792 UINT16 bpp, LPCVOID bits )
794 return HBITMAP_16( CreateBitmap( width, height, planes, bpp, bits ) );
798 /***********************************************************************
799 * CreateBitmapIndirect (GDI.49)
801 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
803 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
804 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
808 /***********************************************************************
809 * CreateBrushIndirect (GDI.50)
811 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
815 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
816 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
818 brush32.lbStyle = brush->lbStyle;
819 brush32.lbColor = brush->lbColor;
820 brush32.lbHatch = brush->lbHatch;
821 return HBRUSH_16( CreateBrushIndirect(&brush32) );
825 /***********************************************************************
826 * CreateCompatibleBitmap (GDI.51)
828 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
830 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
834 /***********************************************************************
835 * CreateCompatibleDC (GDI.52)
837 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
839 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
843 /***********************************************************************
846 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
847 const DEVMODEA *initData )
849 return HDC_16( CreateDCA( driver, device, output, initData ) );
853 /***********************************************************************
854 * CreateEllipticRgn (GDI.54)
856 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
858 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
862 /***********************************************************************
863 * CreateEllipticRgnIndirect (GDI.55)
865 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
867 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
871 /***********************************************************************
872 * CreateFont (GDI.56)
874 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
875 INT16 weight, BYTE italic, BYTE underline,
876 BYTE strikeout, BYTE charset, BYTE outpres,
877 BYTE clippres, BYTE quality, BYTE pitch,
880 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
881 strikeout, charset, outpres, clippres, quality, pitch, name ));
884 /***********************************************************************
885 * CreateFontIndirect (GDI.57)
887 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
894 logfont_16_to_W( plf16, &lfW );
895 ret = CreateFontIndirectW( &lfW );
897 else ret = CreateFontIndirectW( NULL );
898 return HFONT_16(ret);
902 /***********************************************************************
903 * CreateHatchBrush (GDI.58)
905 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
907 return HBRUSH_16( CreateHatchBrush( style, color ) );
911 /***********************************************************************
912 * CreatePatternBrush (GDI.60)
914 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
916 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
920 /***********************************************************************
923 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
927 logpen.lopnStyle = style;
928 logpen.lopnWidth.x = width;
929 logpen.lopnWidth.y = 0;
930 logpen.lopnColor = color;
931 return HPEN_16( CreatePenIndirect( &logpen ) );
935 /***********************************************************************
936 * CreatePenIndirect (GDI.62)
938 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
942 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
943 logpen.lopnStyle = pen->lopnStyle;
944 logpen.lopnWidth.x = pen->lopnWidth.x;
945 logpen.lopnWidth.y = pen->lopnWidth.y;
946 logpen.lopnColor = pen->lopnColor;
947 return HPEN_16( CreatePenIndirect( &logpen ) );
951 /***********************************************************************
952 * CreatePolygonRgn (GDI.63)
954 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
956 return CreatePolyPolygonRgn16( points, &count, 1, mode );
960 /***********************************************************************
961 * CreateRectRgn (GDI.64)
963 * NOTE: cf. SetRectRgn16
965 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
969 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
970 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
971 return HRGN_16(hrgn);
975 /***********************************************************************
976 * CreateRectRgnIndirect (GDI.65)
978 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
980 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
984 /***********************************************************************
985 * CreateSolidBrush (GDI.66)
987 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
989 return HBRUSH_16( CreateSolidBrush( color ) );
993 /***********************************************************************
996 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
998 return DeleteDC( HDC_32(hdc) );
1002 /***********************************************************************
1003 * DeleteObject (GDI.69)
1004 * SysDeleteObject (GDI.605)
1006 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
1008 return DeleteObject( HGDIOBJ_32(obj) );
1012 /***********************************************************************
1013 * EnumObjects (GDI.71)
1015 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1017 struct callback16_info info;
1019 info.proc = (FARPROC16)proc;
1020 info.param = lParam;
1024 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1026 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1032 /***********************************************************************
1035 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1037 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1041 /***********************************************************************
1042 * GetBitmapBits (GDI.74)
1044 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1046 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1050 /***********************************************************************
1051 * GetBkColor (GDI.75)
1053 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1055 return GetBkColor( HDC_32(hdc) );
1059 /***********************************************************************
1060 * GetBkMode (GDI.76)
1062 INT16 WINAPI GetBkMode16( HDC16 hdc )
1064 return GetBkMode( HDC_32(hdc) );
1068 /***********************************************************************
1069 * GetClipBox (GDI.77)
1071 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1074 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1078 rect->left = rect32.left;
1079 rect->top = rect32.top;
1080 rect->right = rect32.right;
1081 rect->bottom = rect32.bottom;
1087 /***********************************************************************
1088 * GetCurrentPosition (GDI.78)
1090 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1093 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1094 return MAKELONG( pt32.x, pt32.y );
1098 /***********************************************************************
1101 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1104 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1109 /***********************************************************************
1110 * GetDeviceCaps (GDI.80)
1112 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1114 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1115 /* some apps don't expect -1 and think it's a B&W screen */
1116 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1121 /***********************************************************************
1122 * GetMapMode (GDI.81)
1124 INT16 WINAPI GetMapMode16( HDC16 hdc )
1126 return GetMapMode( HDC_32(hdc) );
1130 /***********************************************************************
1133 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1135 return GetPixel( HDC_32(hdc), x, y );
1139 /***********************************************************************
1140 * GetPolyFillMode (GDI.84)
1142 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1144 return GetPolyFillMode( HDC_32(hdc) );
1148 /***********************************************************************
1151 INT16 WINAPI GetROP216( HDC16 hdc )
1153 return GetROP2( HDC_32(hdc) );
1157 /***********************************************************************
1158 * GetRelAbs (GDI.86)
1160 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1162 return GetRelAbs( HDC_32(hdc), 0 );
1166 /***********************************************************************
1167 * GetStockObject (GDI.87)
1169 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1171 return HGDIOBJ_16( GetStockObject( obj ) );
1175 /***********************************************************************
1176 * GetStretchBltMode (GDI.88)
1178 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1180 return GetStretchBltMode( HDC_32(hdc) );
1184 /***********************************************************************
1185 * GetTextCharacterExtra (GDI.89)
1187 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1189 return GetTextCharacterExtra( HDC_32(hdc) );
1193 /***********************************************************************
1194 * GetTextColor (GDI.90)
1196 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1198 return GetTextColor( HDC_32(hdc) );
1202 /***********************************************************************
1203 * GetTextExtent (GDI.91)
1205 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1208 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1209 return MAKELONG( size.cx, size.cy );
1213 /***********************************************************************
1214 * GetTextFace (GDI.92)
1216 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1218 return GetTextFaceA( HDC_32(hdc), count, name );
1222 /***********************************************************************
1223 * GetTextMetrics (GDI.93)
1225 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1229 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1231 tm->tmHeight = tm32.tmHeight;
1232 tm->tmAscent = tm32.tmAscent;
1233 tm->tmDescent = tm32.tmDescent;
1234 tm->tmInternalLeading = tm32.tmInternalLeading;
1235 tm->tmExternalLeading = tm32.tmExternalLeading;
1236 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1237 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1238 tm->tmWeight = tm32.tmWeight;
1239 tm->tmOverhang = tm32.tmOverhang;
1240 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1241 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1242 tm->tmFirstChar = tm32.tmFirstChar;
1243 tm->tmLastChar = tm32.tmLastChar;
1244 tm->tmDefaultChar = tm32.tmDefaultChar;
1245 tm->tmBreakChar = tm32.tmBreakChar;
1246 tm->tmItalic = tm32.tmItalic;
1247 tm->tmUnderlined = tm32.tmUnderlined;
1248 tm->tmStruckOut = tm32.tmStruckOut;
1249 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1250 tm->tmCharSet = tm32.tmCharSet;
1255 /***********************************************************************
1256 * GetViewportExt (GDI.94)
1258 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1261 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1262 return MAKELONG( size.cx, size.cy );
1266 /***********************************************************************
1267 * GetViewportOrg (GDI.95)
1269 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1272 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1273 return MAKELONG( pt.x, pt.y );
1277 /***********************************************************************
1278 * GetWindowExt (GDI.96)
1280 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1283 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1284 return MAKELONG( size.cx, size.cy );
1288 /***********************************************************************
1289 * GetWindowOrg (GDI.97)
1291 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1294 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1295 return MAKELONG( pt.x, pt.y );
1301 /**********************************************************************
1304 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1305 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1307 struct callback16_info info;
1308 info.proc = (FARPROC16)proc;
1309 info.param = lParam;
1310 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1314 /***********************************************************************
1315 * OffsetRgn (GDI.101)
1317 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1319 return OffsetRgn( HRGN_32(hrgn), x, y );
1323 /***********************************************************************
1324 * PtVisible (GDI.103)
1326 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1328 return PtVisible( HDC_32(hdc), x, y );
1332 /***********************************************************************
1333 * SetBitmapBits (GDI.106)
1335 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1337 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1341 /***********************************************************************
1342 * AddFontResource (GDI.119)
1344 INT16 WINAPI AddFontResource16( LPCSTR filename )
1346 return AddFontResourceA( filename );
1350 /***********************************************************************
1353 * Disables GDI, switches back to text mode.
1354 * We don't have to do anything here,
1355 * just let console support handle everything
1357 void WINAPI Death16(HDC16 hdc)
1359 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1363 /***********************************************************************
1364 * Resurrection (GDI.122)
1366 * Restores GDI functionality
1368 void WINAPI Resurrection16(HDC16 hdc,
1369 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1371 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1372 hdc, w1, w2, w3, w4, w5, w6);
1376 /**********************************************************************
1377 * CreateMetaFile (GDI.125)
1379 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1381 return HDC_16( CreateMetaFileA( filename ) );
1385 /***********************************************************************
1388 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1391 if (!nDivisor) return -32768;
1392 /* We want to deal with a positive divisor to simplify the logic. */
1395 nMultiplicand = - nMultiplicand;
1396 nDivisor = -nDivisor;
1398 /* If the result is positive, we "add" to round. else,
1399 * we subtract to round. */
1400 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1401 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1402 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1404 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1405 if ((ret > 32767) || (ret < -32767)) return -32768;
1410 /***********************************************************************
1411 * GetRgnBox (GDI.134)
1413 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1416 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1417 CONV_RECT32TO16( &r, rect );
1422 /***********************************************************************
1423 * RemoveFontResource (GDI.136)
1425 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1427 return RemoveFontResourceA(str);
1431 /***********************************************************************
1432 * SetBrushOrg (GDI.148)
1434 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1438 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1439 return MAKELONG( pt.x, pt.y );
1443 /***********************************************************************
1444 * GetBrushOrg (GDI.149)
1446 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1449 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1450 return MAKELONG( pt.x, pt.y );
1454 /***********************************************************************
1455 * UnrealizeObject (GDI.150)
1457 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1459 return UnrealizeObject( HGDIOBJ_32(obj) );
1463 /***********************************************************************
1464 * CreateIC (GDI.153)
1466 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1467 const DEVMODEA* initData )
1469 return HDC_16( CreateICA( driver, device, output, initData ) );
1473 /***********************************************************************
1474 * GetNearestColor (GDI.154)
1476 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1478 return GetNearestColor( HDC_32(hdc), color );
1482 /***********************************************************************
1483 * CreateDiscardableBitmap (GDI.156)
1485 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1487 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1491 /***********************************************************************
1492 * PtInRegion (GDI.161)
1494 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1496 return PtInRegion( HRGN_32(hrgn), x, y );
1500 /***********************************************************************
1501 * GetBitmapDimension (GDI.162)
1503 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1506 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1507 return MAKELONG( size.cx, size.cy );
1511 /***********************************************************************
1512 * SetBitmapDimension (GDI.163)
1514 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1517 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1518 return MAKELONG( size.cx, size.cy );
1522 /***********************************************************************
1523 * SetRectRgn (GDI.172)
1525 * NOTE: Win 3.1 sets region to empty if left > right
1527 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1529 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1530 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1534 /******************************************************************
1535 * PlayMetaFileRecord (GDI.176)
1537 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1539 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1542 for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1543 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1544 for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1545 HeapFree( GetProcessHeap(), 0, ht32 );
1549 /***********************************************************************
1550 * EngineEnumerateFont (GDI.300)
1552 WORD WINAPI EngineEnumerateFont16(LPSTR fontname, FARPROC16 proc, DWORD data )
1554 FIXME("(%s,%p,%lx),stub\n",fontname,proc,data);
1559 /***********************************************************************
1560 * EngineDeleteFont (GDI.301)
1562 WORD WINAPI EngineDeleteFont16(LPFONTINFO16 lpFontInfo)
1566 /* untested, don't know if it works.
1567 We seem to access some structure that is located after the
1568 FONTINFO. The FONTINFO documentation says that there may
1569 follow some char-width table or font bitmap or vector info.
1570 I think it is some kind of font bitmap that begins at offset 0x52,
1571 as FONTINFO goes up to 0x51.
1572 If this is correct, everything should be implemented correctly.
1574 if ( ((lpFontInfo->dfType & (RASTER_FONTTYPE|DEVICE_FONTTYPE)) == (RASTER_FONTTYPE|DEVICE_FONTTYPE))
1575 && (LOWORD(lpFontInfo->dfFace) == LOWORD(lpFontInfo)+0x6e)
1576 && (handle = *(WORD *)(lpFontInfo+0x54)) )
1578 *(WORD *)(lpFontInfo+0x54) = 0;
1579 GlobalFree16(handle);
1585 /***********************************************************************
1586 * EngineRealizeFont (GDI.302)
1588 WORD WINAPI EngineRealizeFont16(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
1590 FIXME("(%p,%p,%p),stub\n",lplogFont,lptextxform,lpfontInfo);
1596 /***********************************************************************
1597 * EngineRealizeFontExt (GDI.315)
1599 WORD WINAPI EngineRealizeFontExt16(LONG l1, LONG l2, LONG l3, LONG l4)
1601 FIXME("(%08lx,%08lx,%08lx,%08lx),stub\n",l1,l2,l3,l4);
1607 /***********************************************************************
1608 * EngineGetCharWidth (GDI.303)
1610 WORD WINAPI EngineGetCharWidth16(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE lastChar, LPINT16 buffer)
1614 for (i = firstChar; i <= lastChar; i++)
1615 FIXME(" returns font's average width for range %d to %d\n", firstChar, lastChar);
1616 *buffer++ = lpFontInfo->dfAvgWidth; /* insert some charwidth functionality here; use average width for now */
1621 /***********************************************************************
1622 * EngineSetFontContext (GDI.304)
1624 WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data)
1630 /***********************************************************************
1631 * EngineGetGlyphBMP (GDI.305)
1633 WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2,
1634 LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics)
1641 /***********************************************************************
1642 * EngineMakeFontDir (GDI.306)
1644 DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string)
1646 FIXME(" stub! (always fails)\n");
1647 return ~0UL; /* error */
1651 /***********************************************************************
1652 * GetCharABCWidths (GDI.307)
1654 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1658 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1660 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1662 for (i = firstChar; i <= lastChar; i++)
1664 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1665 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1666 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1669 HeapFree( GetProcessHeap(), 0, abc32 );
1674 /***********************************************************************
1675 * CreateScalableFontResource (GDI.310)
1677 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1678 LPCSTR fontFile, LPCSTR path )
1680 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1684 /*************************************************************************
1685 * GetFontData (GDI.311)
1688 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1690 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1694 /*************************************************************************
1695 * GetRasterizerCaps (GDI.313)
1697 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1699 return GetRasterizerCaps( lprs, cbNumBytes );
1703 /*************************************************************************
1704 * GetKerningPairs (GDI.332)
1707 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1709 KERNINGPAIR *pairs32;
1712 if (!count) return 0;
1714 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1715 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1717 for (i = 0; i < ret; i++)
1719 pairs->wFirst = pairs32->wFirst;
1720 pairs->wSecond = pairs32->wSecond;
1721 pairs->iKernAmount = pairs32->iKernAmount;
1724 HeapFree( GetProcessHeap(), 0, pairs32 );
1730 /***********************************************************************
1731 * GetTextAlign (GDI.345)
1733 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1735 return GetTextAlign( HDC_32(hdc) );
1739 /***********************************************************************
1740 * SetTextAlign (GDI.346)
1742 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1744 return SetTextAlign( HDC_32(hdc), align );
1748 /***********************************************************************
1751 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1752 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1753 INT16 xend, INT16 yend )
1755 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1759 /***********************************************************************
1760 * SetMapperFlags (GDI.349)
1762 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1764 return SetMapperFlags( HDC_32(hdc), flags );
1768 /***********************************************************************
1769 * GetCharWidth (GDI.350)
1771 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
1773 BOOL retVal = FALSE;
1775 if( firstChar != lastChar )
1777 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
1780 LPINT obuf32 = buf32;
1783 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
1786 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
1788 HeapFree(GetProcessHeap(), 0, obuf32);
1791 else /* happens quite often to warrant a special treatment */
1794 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
1801 /***********************************************************************
1802 * ExtTextOut (GDI.351)
1804 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
1805 const RECT16 *lprect, LPCSTR str, UINT16 count,
1811 LPINT lpdx32 = NULL;
1814 lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
1815 if(lpdx32 == NULL) return FALSE;
1816 for (i=count;i--;) lpdx32[i]=lpDx[i];
1818 if (lprect) CONV_RECT16TO32(lprect,&rect32);
1819 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
1820 if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
1825 /***********************************************************************
1826 * CreatePalette (GDI.360)
1828 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
1830 return HPALETTE_16( CreatePalette( palette ) );
1834 /***********************************************************************
1835 * GDISelectPalette (GDI.361)
1837 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
1839 return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
1843 /***********************************************************************
1844 * GDIRealizePalette (GDI.362)
1846 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
1848 return GDIRealizePalette( HDC_32(hdc) );
1852 /***********************************************************************
1853 * GetPaletteEntries (GDI.363)
1855 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1856 UINT16 count, LPPALETTEENTRY entries )
1858 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1862 /***********************************************************************
1863 * SetPaletteEntries (GDI.364)
1865 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1866 UINT16 count, const PALETTEENTRY *entries )
1868 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1872 /**********************************************************************
1873 * UpdateColors (GDI.366)
1875 INT16 WINAPI UpdateColors16( HDC16 hdc )
1877 UpdateColors( HDC_32(hdc) );
1882 /***********************************************************************
1883 * AnimatePalette (GDI.367)
1885 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
1886 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
1888 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
1892 /***********************************************************************
1893 * ResizePalette (GDI.368)
1895 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
1897 return ResizePalette( HPALETTE_32(hpalette), cEntries );
1901 /***********************************************************************
1902 * GetNearestPaletteIndex (GDI.370)
1904 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
1906 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
1910 /**********************************************************************
1911 * ExtFloodFill (GDI.372)
1913 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
1916 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
1920 /***********************************************************************
1921 * SetSystemPaletteUse (GDI.373)
1923 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
1925 return SetSystemPaletteUse( HDC_32(hdc), use );
1929 /***********************************************************************
1930 * GetSystemPaletteUse (GDI.374)
1932 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
1934 return GetSystemPaletteUse( HDC_32(hdc) );
1938 /***********************************************************************
1939 * GetSystemPaletteEntries (GDI.375)
1941 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
1942 LPPALETTEENTRY entries )
1944 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
1948 /***********************************************************************
1951 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
1953 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
1957 /******************************************************************
1958 * StartDoc (GDI.377)
1960 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
1964 docA.cbSize = lpdoc->cbSize;
1965 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
1966 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
1967 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
1968 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
1970 docA.lpszDatatype = NULL;
1971 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
1972 docA.fwType = lpdoc->fwType;
1975 return StartDocA( HDC_32(hdc), &docA );
1979 /******************************************************************
1982 INT16 WINAPI EndDoc16( HDC16 hdc )
1984 return EndDoc( HDC_32(hdc) );
1988 /******************************************************************
1989 * StartPage (GDI.379)
1991 INT16 WINAPI StartPage16( HDC16 hdc )
1993 return StartPage( HDC_32(hdc) );
1997 /******************************************************************
2000 INT16 WINAPI EndPage16( HDC16 hdc )
2002 return EndPage( HDC_32(hdc) );
2006 /******************************************************************************
2007 * AbortDoc (GDI.382)
2009 INT16 WINAPI AbortDoc16( HDC16 hdc )
2011 return AbortDoc( HDC_32(hdc) );
2015 /***********************************************************************
2016 * FastWindowFrame (GDI.400)
2018 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
2019 INT16 width, INT16 height, DWORD rop )
2021 HDC hdc32 = HDC_32(hdc);
2022 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
2023 PatBlt( hdc32, rect->left, rect->top,
2024 rect->right - rect->left - width, height, rop );
2025 PatBlt( hdc32, rect->left, rect->top + height, width,
2026 rect->bottom - rect->top - height, rop );
2027 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
2028 rect->right - rect->left - width, -height, rop );
2029 PatBlt( hdc32, rect->right - 1, rect->top, -width,
2030 rect->bottom - rect->top - height, rop );
2031 SelectObject( hdc32, hbrush );
2036 /***********************************************************************
2037 * CreateUserBitmap (GDI.407)
2039 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
2040 UINT16 bpp, LPCVOID bits )
2042 return CreateBitmap16( width, height, planes, bpp, bits );
2046 /***********************************************************************
2047 * CreateUserDiscardableBitmap (GDI.409)
2049 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
2051 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
2052 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
2054 return HBITMAP_16(ret);
2058 /***********************************************************************
2059 * GetCurLogFont (GDI.411)
2061 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
2063 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
2067 /***********************************************************************
2068 * StretchDIBits (GDI.439)
2070 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
2071 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
2072 INT16 heightSrc, const VOID *bits,
2073 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
2075 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
2076 xSrc, ySrc, widthSrc, heightSrc, bits,
2077 info, wUsage, dwRop );
2081 /***********************************************************************
2082 * SetDIBits (GDI.440)
2084 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2085 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2088 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2092 /***********************************************************************
2093 * GetDIBits (GDI.441)
2095 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2096 UINT16 lines, LPVOID bits, BITMAPINFO * info,
2099 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2103 /***********************************************************************
2104 * CreateDIBitmap (GDI.442)
2106 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
2107 DWORD init, LPCVOID bits, const BITMAPINFO * data,
2110 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
2114 /***********************************************************************
2115 * SetDIBitsToDevice (GDI.443)
2117 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2118 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2119 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2122 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2123 startscan, lines, bits, info, coloruse );
2127 /***********************************************************************
2128 * CreateRoundRectRgn (GDI.444)
2130 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2131 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2132 * we just let CreateRoundRectRgn convert them to +ve values.
2135 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2136 INT16 ellipse_width, INT16 ellipse_height )
2138 if( ellipse_width == 0 || ellipse_height == 0 )
2139 return CreateRectRgn16( left, top, right, bottom );
2141 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2142 ellipse_width, ellipse_height ));
2146 /***********************************************************************
2147 * CreateDIBPatternBrush (GDI.445)
2149 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2154 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2155 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2156 GlobalUnlock16( hbitmap );
2161 /**********************************************************************
2162 * PolyPolygon (GDI.450)
2164 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2173 for (i=polygons;i--;)
2175 pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2176 if(pt32 == NULL) return FALSE;
2178 CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
2179 counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2180 if(counts32 == NULL) {
2181 HeapFree( GetProcessHeap(), 0, pt32 );
2184 for (i=polygons;i--;) counts32[i]=counts[i];
2186 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2187 HeapFree( GetProcessHeap(), 0, counts32 );
2188 HeapFree( GetProcessHeap(), 0, pt32 );
2193 /***********************************************************************
2194 * CreatePolyPolygonRgn (GDI.451)
2196 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2197 const INT16 *count, INT16 nbpolygons, INT16 mode )
2204 for (i = 0; i < nbpolygons; i++) npts += count[i];
2205 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2206 for (i = 0; i < npts; i++) CONV_POINT16TO32( &(points[i]), &(points32[i]) );
2208 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2209 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2210 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2211 HeapFree( GetProcessHeap(), 0, count32 );
2212 HeapFree( GetProcessHeap(), 0, points32 );
2213 return HRGN_16(hrgn);
2217 /***********************************************************************
2218 * SetObjectOwner (GDI.461)
2220 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2226 /***********************************************************************
2227 * RectVisible (GDI.465)
2228 * RectVisibleOld (GDI.104)
2230 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2233 CONV_RECT16TO32( rect16, &rect );
2234 return RectVisible( HDC_32(hdc), &rect );
2238 /***********************************************************************
2239 * RectInRegion (GDI.466)
2240 * RectInRegionOld (GDI.181)
2242 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2246 CONV_RECT16TO32(rect, &r32);
2247 return RectInRegion( HRGN_32(hrgn), &r32 );
2251 /***********************************************************************
2252 * GetBitmapDimensionEx (GDI.468)
2254 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2257 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2261 size->cx = size32.cx;
2262 size->cy = size32.cy;
2268 /***********************************************************************
2269 * GetBrushOrgEx (GDI.469)
2271 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2274 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2281 /***********************************************************************
2282 * GetCurrentPositionEx (GDI.470)
2284 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2287 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2294 /***********************************************************************
2295 * GetTextExtentPoint (GDI.471)
2297 * FIXME: Should this have a bug for compatibility?
2298 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2299 * bugs (-> MSDN KB q147647.txt).
2301 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2304 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2308 size->cx = size32.cx;
2309 size->cy = size32.cy;
2315 /***********************************************************************
2316 * GetViewportExtEx (GDI.472)
2318 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2321 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2322 size->cx = size32.cx;
2323 size->cy = size32.cy;
2328 /***********************************************************************
2329 * GetViewportOrgEx (GDI.473)
2331 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2334 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2341 /***********************************************************************
2342 * GetWindowExtEx (GDI.474)
2344 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2347 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2348 size->cx = size32.cx;
2349 size->cy = size32.cy;
2354 /***********************************************************************
2355 * GetWindowOrgEx (GDI.475)
2357 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2360 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2367 /***********************************************************************
2368 * OffsetViewportOrgEx (GDI.476)
2370 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2373 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2374 if (pt) CONV_POINT32TO16( &pt32, pt );
2379 /***********************************************************************
2380 * OffsetWindowOrgEx (GDI.477)
2382 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2385 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2386 if (pt) CONV_POINT32TO16( &pt32, pt );
2391 /***********************************************************************
2392 * SetBitmapDimensionEx (GDI.478)
2394 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2397 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2399 if (ret && prevSize)
2401 prevSize->cx = size32.cx;
2402 prevSize->cy = size32.cy;
2408 /***********************************************************************
2409 * SetViewportExtEx (GDI.479)
2411 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2414 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2415 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2420 /***********************************************************************
2421 * SetViewportOrgEx (GDI.480)
2423 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2426 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2427 if (pt) CONV_POINT32TO16( &pt32, pt );
2432 /***********************************************************************
2433 * SetWindowExtEx (GDI.481)
2435 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2438 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2439 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2444 /***********************************************************************
2445 * SetWindowOrgEx (GDI.482)
2447 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2450 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2451 if (pt) CONV_POINT32TO16( &pt32, pt );
2456 /***********************************************************************
2457 * MoveToEx (GDI.483)
2459 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2463 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2464 if (pt) CONV_POINT32TO16( &pt32, pt );
2469 /***********************************************************************
2470 * ScaleViewportExtEx (GDI.484)
2472 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2473 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2476 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2478 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2483 /***********************************************************************
2484 * ScaleWindowExtEx (GDI.485)
2486 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2487 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2490 BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2492 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2497 /******************************************************************************
2498 * PolyBezier (GDI.502)
2500 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2504 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2505 cPoints*sizeof(POINT) );
2506 if(!pt32) return FALSE;
2507 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2508 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2509 HeapFree( GetProcessHeap(), 0, pt32 );
2514 /******************************************************************************
2515 * PolyBezierTo (GDI.503)
2517 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2521 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2522 cPoints*sizeof(POINT) );
2523 if(!pt32) return FALSE;
2524 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2525 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2526 HeapFree( GetProcessHeap(), 0, pt32 );
2531 /******************************************************************************
2532 * ExtSelectClipRgn (GDI.508)
2534 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2536 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2540 /***********************************************************************
2541 * AbortPath (GDI.511)
2543 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2545 return AbortPath( HDC_32(hdc) );
2549 /***********************************************************************
2550 * BeginPath (GDI.512)
2552 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2554 return BeginPath( HDC_32(hdc) );
2558 /***********************************************************************
2559 * CloseFigure (GDI.513)
2561 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2563 return CloseFigure( HDC_32(hdc) );
2567 /***********************************************************************
2570 BOOL16 WINAPI EndPath16(HDC16 hdc)
2572 return EndPath( HDC_32(hdc) );
2576 /***********************************************************************
2577 * FillPath (GDI.515)
2579 BOOL16 WINAPI FillPath16(HDC16 hdc)
2581 return FillPath( HDC_32(hdc) );
2585 /*******************************************************************
2586 * FlattenPath (GDI.516)
2588 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2590 return FlattenPath( HDC_32(hdc) );
2594 /***********************************************************************
2597 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2599 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2604 /***********************************************************************
2605 * PathToRegion (GDI.518)
2607 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2609 return HRGN_16( PathToRegion( HDC_32(hdc) ));
2613 /***********************************************************************
2614 * SelectClipPath (GDI.519)
2616 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2618 return SelectClipPath( HDC_32(hdc), iMode );
2622 /*******************************************************************
2623 * StrokeAndFillPath (GDI.520)
2625 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
2627 return StrokeAndFillPath( HDC_32(hdc) );
2631 /*******************************************************************
2632 * StrokePath (GDI.521)
2634 BOOL16 WINAPI StrokePath16(HDC16 hdc)
2636 return StrokePath( HDC_32(hdc) );
2640 /*******************************************************************
2641 * WidenPath (GDI.522)
2643 BOOL16 WINAPI WidenPath16(HDC16 hdc)
2645 return WidenPath( HDC_32(hdc) );
2649 /***********************************************************************
2650 * GetArcDirection (GDI.524)
2652 INT16 WINAPI GetArcDirection16( HDC16 hdc )
2654 return GetArcDirection( HDC_32(hdc) );
2658 /***********************************************************************
2659 * SetArcDirection (GDI.525)
2661 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
2663 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
2667 /***********************************************************************
2668 * CreateHalftonePalette (GDI.529)
2670 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
2672 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
2676 /***********************************************************************
2677 * SetDIBColorTable (GDI.602)
2679 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2681 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2685 /***********************************************************************
2686 * GetDIBColorTable (GDI.603)
2688 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2690 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2694 /***********************************************************************
2695 * GetRegionData (GDI.607)
2697 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2699 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
2701 return GetRegionData( HRGN_32(hrgn), count, rgndata );
2705 /***********************************************************************
2706 * GetTextCharset (GDI.612)
2708 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
2710 return GetTextCharset( HDC_32(hdc) );
2714 /*************************************************************************
2715 * GetFontLanguageInfo (GDI.616)
2717 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
2719 return GetFontLanguageInfo( HDC_32(hdc) );
2723 /***********************************************************************
2724 * SetLayout (GDI.1000)
2726 * Sets left->right or right->left text layout flags of a dc.
2728 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
2730 return SetLayout( HDC_32(hdc), layout );