Always print a message for generic stubs.
[wine/dcerpc.git] / dlls / gdi / gdi16.c
blobaa3084ff8126e92f978114371dde942a39d9db8b
1 /*
2 * GDI 16-bit functions
4 * Copyright 2002 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "wownt32.h"
27 #include "wine/wingdi16.h"
28 #include "gdi.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
33 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
34 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
36 struct callback16_info
38 FARPROC16 proc;
39 LPARAM param;
42 /* callback for LineDDA16 */
43 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
45 const struct callback16_info *info = (struct callback16_info *)param;
46 WORD args[4];
48 args[3] = x;
49 args[2] = y;
50 args[1] = HIWORD(info->param);
51 args[0] = LOWORD(info->param);
52 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, NULL );
55 /* callback for EnumObjects16 */
56 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
58 const struct callback16_info *info = (struct callback16_info *)param;
59 LOGPEN *pen = ptr;
60 LOGPEN16 pen16;
61 SEGPTR segptr;
62 DWORD ret;
63 WORD args[4];
65 pen16.lopnStyle = pen->lopnStyle;
66 pen16.lopnWidth.x = pen->lopnWidth.x;
67 pen16.lopnWidth.y = pen->lopnWidth.y;
68 pen16.lopnColor = pen->lopnColor;
69 segptr = MapLS( &pen16 );
70 args[3] = SELECTOROF(segptr);
71 args[2] = OFFSETOF(segptr);
72 args[1] = HIWORD(info->param);
73 args[0] = LOWORD(info->param);
74 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
75 UnMapLS( segptr );
76 return LOWORD(ret);
79 /* callback for EnumObjects16 */
80 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
82 const struct callback16_info *info = (struct callback16_info *)param;
83 LOGBRUSH *brush = ptr;
84 LOGBRUSH16 brush16;
85 SEGPTR segptr;
86 DWORD ret;
87 WORD args[4];
89 brush16.lbStyle = brush->lbStyle;
90 brush16.lbColor = brush->lbColor;
91 brush16.lbHatch = brush->lbHatch;
92 segptr = MapLS( &brush16 );
93 args[3] = SELECTOROF(segptr);
94 args[2] = OFFSETOF(segptr);
95 args[1] = HIWORD(info->param);
96 args[0] = LOWORD(info->param);
97 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
98 UnMapLS( segptr );
99 return ret;
102 /* convert a LOGFONT16 to a LOGFONTW */
103 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
105 font32->lfHeight = font16->lfHeight;
106 font32->lfWidth = font16->lfWidth;
107 font32->lfEscapement = font16->lfEscapement;
108 font32->lfOrientation = font16->lfOrientation;
109 font32->lfWeight = font16->lfWeight;
110 font32->lfItalic = font16->lfItalic;
111 font32->lfUnderline = font16->lfUnderline;
112 font32->lfStrikeOut = font16->lfStrikeOut;
113 font32->lfCharSet = font16->lfCharSet;
114 font32->lfOutPrecision = font16->lfOutPrecision;
115 font32->lfClipPrecision = font16->lfClipPrecision;
116 font32->lfQuality = font16->lfQuality;
117 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
118 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
119 font32->lfFaceName[LF_FACESIZE-1] = 0;
123 /***********************************************************************
124 * SetBkColor (GDI.1)
126 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
128 return SetBkColor( HDC_32(hdc), color );
132 /***********************************************************************
133 * SetBkMode (GDI.2)
135 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
137 return SetBkMode( HDC_32(hdc), mode );
141 /***********************************************************************
142 * SetMapMode (GDI.3)
144 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
146 return SetMapMode( HDC_32(hdc), mode );
150 /***********************************************************************
151 * SetROP2 (GDI.4)
153 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
155 return SetROP2( HDC_32(hdc), mode );
159 /***********************************************************************
160 * SetRelAbs (GDI.5)
162 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
164 return SetRelAbs( HDC_32(hdc), mode );
168 /***********************************************************************
169 * SetPolyFillMode (GDI.6)
171 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
173 return SetPolyFillMode( HDC_32(hdc), mode );
177 /***********************************************************************
178 * SetStretchBltMode (GDI.7)
180 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
182 return SetStretchBltMode( HDC_32(hdc), mode );
186 /***********************************************************************
187 * SetTextCharacterExtra (GDI.8)
189 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
191 return SetTextCharacterExtra( HDC_32(hdc), extra );
195 /***********************************************************************
196 * SetTextColor (GDI.9)
198 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
200 return SetTextColor( HDC_32(hdc), color );
204 /***********************************************************************
205 * SetTextJustification (GDI.10)
207 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
209 return SetTextJustification( HDC_32(hdc), extra, breaks );
213 /***********************************************************************
214 * SetWindowOrg (GDI.11)
216 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
218 POINT pt;
219 if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
220 return MAKELONG( pt.x, pt.y );
224 /***********************************************************************
225 * SetWindowExt (GDI.12)
227 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
229 SIZE size;
230 if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
231 return MAKELONG( size.cx, size.cy );
235 /***********************************************************************
236 * SetViewportOrg (GDI.13)
238 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
240 POINT pt;
241 if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
242 return MAKELONG( pt.x, pt.y );
246 /***********************************************************************
247 * SetViewportExt (GDI.14)
249 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
251 SIZE size;
252 if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
253 return MAKELONG( size.cx, size.cy );
257 /***********************************************************************
258 * OffsetWindowOrg (GDI.15)
260 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
262 POINT pt;
263 if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
264 return MAKELONG( pt.x, pt.y );
268 /***********************************************************************
269 * ScaleWindowExt (GDI.16)
271 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
272 INT16 yNum, INT16 yDenom )
274 SIZE size;
275 if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
276 return FALSE;
277 return MAKELONG( size.cx, size.cy );
281 /***********************************************************************
282 * OffsetViewportOrg (GDI.17)
284 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
286 POINT pt;
287 if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
288 return MAKELONG( pt.x, pt.y );
292 /***********************************************************************
293 * ScaleViewportExt (GDI.18)
295 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
296 INT16 yNum, INT16 yDenom )
298 SIZE size;
299 if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
300 return FALSE;
301 return MAKELONG( size.cx, size.cy );
305 /***********************************************************************
306 * LineTo (GDI.19)
308 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
310 return LineTo( HDC_32(hdc), x, y );
314 /***********************************************************************
315 * MoveTo (GDI.20)
317 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
319 POINT pt;
321 if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
322 return MAKELONG(pt.x,pt.y);
326 /***********************************************************************
327 * ExcludeClipRect (GDI.21)
329 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
330 INT16 right, INT16 bottom )
332 return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
336 /***********************************************************************
337 * IntersectClipRect (GDI.22)
339 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
340 INT16 right, INT16 bottom )
342 return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
346 /***********************************************************************
347 * Arc (GDI.23)
349 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
350 INT16 bottom, INT16 xstart, INT16 ystart,
351 INT16 xend, INT16 yend )
353 return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
357 /***********************************************************************
358 * Ellipse (GDI.24)
360 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
361 INT16 right, INT16 bottom )
363 return Ellipse( HDC_32(hdc), left, top, right, bottom );
367 /**********************************************************************
368 * FloodFill (GDI.25)
370 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
372 return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
376 /***********************************************************************
377 * Pie (GDI.26)
379 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
380 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
381 INT16 xend, INT16 yend )
383 return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
387 /***********************************************************************
388 * Rectangle (GDI.27)
390 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
391 INT16 right, INT16 bottom )
393 return Rectangle( HDC_32(hdc), left, top, right, bottom );
397 /***********************************************************************
398 * RoundRect (GDI.28)
400 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
401 INT16 bottom, INT16 ell_width, INT16 ell_height )
403 return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
407 /***********************************************************************
408 * PatBlt (GDI.29)
410 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
411 INT16 width, INT16 height, DWORD rop)
413 return PatBlt( HDC_32(hdc), left, top, width, height, rop );
417 /***********************************************************************
418 * SaveDC (GDI.30)
420 INT16 WINAPI SaveDC16( HDC16 hdc )
422 return SaveDC( HDC_32(hdc) );
426 /***********************************************************************
427 * SetPixel (GDI.31)
429 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
431 return SetPixel( HDC_32(hdc), x, y, color );
435 /***********************************************************************
436 * OffsetClipRgn (GDI.32)
438 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
440 return OffsetClipRgn( HDC_32(hdc), x, y );
444 /***********************************************************************
445 * TextOut (GDI.33)
447 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
449 return TextOutA( HDC_32(hdc), x, y, str, count );
453 /***********************************************************************
454 * BitBlt (GDI.34)
456 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
457 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
458 DWORD rop )
460 return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
464 /***********************************************************************
465 * StretchBlt (GDI.35)
467 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
468 INT16 widthDst, INT16 heightDst,
469 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
470 INT16 widthSrc, INT16 heightSrc, DWORD rop )
472 return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
473 HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
477 /**********************************************************************
478 * Polygon (GDI.36)
480 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
482 register int i;
483 BOOL ret;
484 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
485 count*sizeof(POINT) );
487 if (!pt32) return FALSE;
488 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
489 ret = Polygon(HDC_32(hdc),pt32,count);
490 HeapFree( GetProcessHeap(), 0, pt32 );
491 return ret;
495 /**********************************************************************
496 * Polyline (GDI.37)
498 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
500 register int i;
501 BOOL16 ret;
502 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
503 count*sizeof(POINT) );
505 if (!pt32) return FALSE;
506 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
507 ret = Polyline(HDC_32(hdc),pt32,count);
508 HeapFree( GetProcessHeap(), 0, pt32 );
509 return ret;
513 /***********************************************************************
514 * Escape (GDI.38)
516 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
518 INT ret;
520 switch(escape)
522 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
523 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
524 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
525 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
526 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
527 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
528 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
529 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
530 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
531 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
532 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
533 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
534 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
535 case CLIP_TO_PATH:
536 case DRAFTMODE:
537 case ENUMPAPERBINS:
538 case EPSPRINTING:
539 case EXT_DEVICE_CAPS:
540 case GETCOLORTABLE:
541 case MOUSETRAILS:
542 case POSTSCRIPT_IGNORE:
543 case QUERYESCSUPPORT:
544 case SET_ARC_DIRECTION:
545 case SET_POLY_MODE:
546 case SET_SCREEN_ANGLE:
547 case SET_SPREAD:
549 INT16 *ptr = MapSL(in_data);
550 INT data = *ptr;
551 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
554 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
555 case ENABLEDUPLEX:
557 UINT16 *ptr = MapSL(in_data);
558 UINT data = *ptr;
559 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
562 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
563 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
564 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
565 case GETPHYSPAGESIZE:
566 case GETPRINTINGOFFSET:
567 case GETSCALINGFACTOR:
569 POINT16 *ptr = out_data;
570 POINT pt32;
571 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
572 ptr->x = pt32.x;
573 ptr->y = pt32.y;
574 return ret;
577 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
578 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
579 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
580 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
581 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
582 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
583 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
584 case ENABLEPAIRKERNING:
585 case ENABLERELATIVEWIDTHS:
586 case SETCOPYCOUNT:
587 case SETKERNTRACK:
588 case SETLINECAP:
589 case SETLINEJOIN:
590 case SETMITERLIMIT:
592 INT16 *new = MapSL(in_data);
593 INT16 *old = out_data;
594 INT out, in = *new;
595 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
596 *old = out;
597 return ret;
600 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
601 case SETABORTPROC:
602 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
604 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
605 * lpvOutData is actually a pointer to the DocInfo structure and used as
606 * a second input parameter */
607 case STARTDOC:
608 if (out_data)
610 ret = StartDoc16( hdc, out_data );
611 if (ret > 0) ret = StartPage( HDC_32(hdc) );
612 return ret;
614 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
616 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
617 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
618 case SET_BOUNDS:
619 case SET_CLIP_BOX:
621 RECT16 *rc16 = MapSL(in_data);
622 RECT rc;
623 rc.left = rc16->left;
624 rc.top = rc16->top;
625 rc.right = rc16->right;
626 rc.bottom = rc16->bottom;
627 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
630 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
631 case NEXTBAND:
633 RECT rc;
634 RECT16 *rc16 = out_data;
635 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
636 rc16->left = rc.left;
637 rc16->top = rc.top;
638 rc16->right = rc.right;
639 rc16->bottom = rc.bottom;
640 return ret;
643 /* Escape(hdc,ABORTDOC,NULL,NULL); */
644 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
645 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
646 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
647 /* Escape(hdc,ENDDOC,NULL,NULL); */
648 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
649 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
650 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
651 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
652 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
653 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
654 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
655 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
656 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
657 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
658 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
659 /* Escape(hdc,NEWFRAME,NULL,NULL); */
660 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
661 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
662 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
663 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
664 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
665 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
666 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
667 case ABORTDOC:
668 case BANDINFO:
669 case BEGIN_PATH:
670 case DRAWPATTERNRECT:
671 case ENDDOC:
672 case END_PATH:
673 case EXTTEXTOUT:
674 case FLUSHOUTPUT:
675 case GETFACENAME:
676 case GETPAIRKERNTABLE:
677 case GETSETPAPERBINS:
678 case GETSETPRINTORIENT:
679 case GETSETSCREENPARAMS:
680 case GETTECHNOLOGY:
681 case GETTRACKKERNTABLE:
682 case MFCOMMENT:
683 case NEWFRAME:
684 case PASSTHROUGH:
685 case RESTORE_CTM:
686 case SAVE_CTM:
687 case SETALLJUSTVALUES:
688 case SETCOLORTABLE:
689 case SET_BACKGROUND_COLOR:
690 case TRANSFORM_CTM:
691 /* pass it unmodified to the 32-bit function */
692 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
694 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
695 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
696 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
697 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
698 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
699 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
700 case ENUMPAPERMETRICS:
701 case GETEXTENDEDTEXTMETRICS:
702 case GETEXTENTTABLE:
703 case GETSETPAPERMETRICS:
704 case GETVECTORBRUSHSIZE:
705 case GETVECTORPENSIZE:
706 default:
707 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
708 escape, in_count, MapSL(in_data), out_data );
709 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
714 /***********************************************************************
715 * RestoreDC (GDI.39)
717 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
719 return RestoreDC( HDC_32(hdc), level );
723 /***********************************************************************
724 * FillRgn (GDI.40)
726 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
728 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
732 /***********************************************************************
733 * FrameRgn (GDI.41)
735 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
736 INT16 nWidth, INT16 nHeight )
738 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
742 /***********************************************************************
743 * InvertRgn (GDI.42)
745 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
747 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
751 /***********************************************************************
752 * PaintRgn (GDI.43)
754 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
756 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
760 /***********************************************************************
761 * SelectClipRgn (GDI.44)
763 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
765 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
769 /***********************************************************************
770 * SelectObject (GDI.45)
772 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
774 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
778 /***********************************************************************
779 * CombineRgn (GDI.47)
781 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
783 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
787 /***********************************************************************
788 * CreateBitmap (GDI.48)
790 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
791 UINT16 bpp, LPCVOID bits )
793 return HBITMAP_16( CreateBitmap( width, height, planes, bpp, bits ) );
797 /***********************************************************************
798 * CreateBitmapIndirect (GDI.49)
800 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
802 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
803 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
807 /***********************************************************************
808 * CreateBrushIndirect (GDI.50)
810 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
812 LOGBRUSH brush32;
814 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
815 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
817 brush32.lbStyle = brush->lbStyle;
818 brush32.lbColor = brush->lbColor;
819 brush32.lbHatch = brush->lbHatch;
820 return HBRUSH_16( CreateBrushIndirect(&brush32) );
824 /***********************************************************************
825 * CreateCompatibleBitmap (GDI.51)
827 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
829 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
833 /***********************************************************************
834 * CreateCompatibleDC (GDI.52)
836 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
838 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
842 /***********************************************************************
843 * CreateDC (GDI.53)
845 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
846 const DEVMODEA *initData )
848 return HDC_16( CreateDCA( driver, device, output, initData ) );
852 /***********************************************************************
853 * CreateEllipticRgn (GDI.54)
855 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
857 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
861 /***********************************************************************
862 * CreateEllipticRgnIndirect (GDI.55)
864 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
866 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
870 /***********************************************************************
871 * CreateFont (GDI.56)
873 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
874 INT16 weight, BYTE italic, BYTE underline,
875 BYTE strikeout, BYTE charset, BYTE outpres,
876 BYTE clippres, BYTE quality, BYTE pitch,
877 LPCSTR name )
879 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
880 strikeout, charset, outpres, clippres, quality, pitch, name ));
883 /***********************************************************************
884 * CreateFontIndirect (GDI.57)
886 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
888 HFONT ret;
890 if (plf16)
892 LOGFONTW lfW;
893 logfont_16_to_W( plf16, &lfW );
894 ret = CreateFontIndirectW( &lfW );
896 else ret = CreateFontIndirectW( NULL );
897 return HFONT_16(ret);
901 /***********************************************************************
902 * CreateHatchBrush (GDI.58)
904 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
906 return HBRUSH_16( CreateHatchBrush( style, color ) );
910 /***********************************************************************
911 * CreatePatternBrush (GDI.60)
913 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
915 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
919 /***********************************************************************
920 * CreatePen (GDI.61)
922 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
924 LOGPEN logpen;
926 logpen.lopnStyle = style;
927 logpen.lopnWidth.x = width;
928 logpen.lopnWidth.y = 0;
929 logpen.lopnColor = color;
930 return HPEN_16( CreatePenIndirect( &logpen ) );
934 /***********************************************************************
935 * CreatePenIndirect (GDI.62)
937 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
939 LOGPEN logpen;
941 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
942 logpen.lopnStyle = pen->lopnStyle;
943 logpen.lopnWidth.x = pen->lopnWidth.x;
944 logpen.lopnWidth.y = pen->lopnWidth.y;
945 logpen.lopnColor = pen->lopnColor;
946 return HPEN_16( CreatePenIndirect( &logpen ) );
950 /***********************************************************************
951 * CreatePolygonRgn (GDI.63)
953 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
955 return CreatePolyPolygonRgn16( points, &count, 1, mode );
959 /***********************************************************************
960 * CreateRectRgn (GDI.64)
962 * NOTE: cf. SetRectRgn16
964 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
966 HRGN hrgn;
968 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
969 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
970 return HRGN_16(hrgn);
974 /***********************************************************************
975 * CreateRectRgnIndirect (GDI.65)
977 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
979 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
983 /***********************************************************************
984 * CreateSolidBrush (GDI.66)
986 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
988 return HBRUSH_16( CreateSolidBrush( color ) );
992 /***********************************************************************
993 * DeleteDC (GDI.68)
995 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
997 return DeleteDC( HDC_32(hdc) );
1001 /***********************************************************************
1002 * DeleteObject (GDI.69)
1003 * SysDeleteObject (GDI.605)
1005 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
1007 return DeleteObject( HGDIOBJ_32(obj) );
1011 /***********************************************************************
1012 * EnumObjects (GDI.71)
1014 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1016 struct callback16_info info;
1018 info.proc = (FARPROC16)proc;
1019 info.param = lParam;
1020 switch(obj)
1022 case OBJ_PEN:
1023 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1024 case OBJ_BRUSH:
1025 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1027 return 0;
1031 /***********************************************************************
1032 * EqualRgn (GDI.72)
1034 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1036 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1040 /***********************************************************************
1041 * GetBitmapBits (GDI.74)
1043 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1045 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1049 /***********************************************************************
1050 * GetBkColor (GDI.75)
1052 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1054 return GetBkColor( HDC_32(hdc) );
1058 /***********************************************************************
1059 * GetBkMode (GDI.76)
1061 INT16 WINAPI GetBkMode16( HDC16 hdc )
1063 return GetBkMode( HDC_32(hdc) );
1067 /***********************************************************************
1068 * GetClipBox (GDI.77)
1070 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1072 RECT rect32;
1073 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1075 if (ret != ERROR)
1077 rect->left = rect32.left;
1078 rect->top = rect32.top;
1079 rect->right = rect32.right;
1080 rect->bottom = rect32.bottom;
1082 return ret;
1086 /***********************************************************************
1087 * GetCurrentPosition (GDI.78)
1089 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1091 POINT pt32;
1092 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1093 return MAKELONG( pt32.x, pt32.y );
1097 /***********************************************************************
1098 * GetDCOrg (GDI.79)
1100 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1102 POINT pt;
1103 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1104 return 0;
1108 /***********************************************************************
1109 * GetDeviceCaps (GDI.80)
1111 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1113 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1114 /* some apps don't expect -1 and think it's a B&W screen */
1115 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1116 return ret;
1120 /***********************************************************************
1121 * GetMapMode (GDI.81)
1123 INT16 WINAPI GetMapMode16( HDC16 hdc )
1125 return GetMapMode( HDC_32(hdc) );
1129 /***********************************************************************
1130 * GetPixel (GDI.83)
1132 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1134 return GetPixel( HDC_32(hdc), x, y );
1138 /***********************************************************************
1139 * GetPolyFillMode (GDI.84)
1141 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1143 return GetPolyFillMode( HDC_32(hdc) );
1147 /***********************************************************************
1148 * GetROP2 (GDI.85)
1150 INT16 WINAPI GetROP216( HDC16 hdc )
1152 return GetROP2( HDC_32(hdc) );
1156 /***********************************************************************
1157 * GetRelAbs (GDI.86)
1159 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1161 return GetRelAbs( HDC_32(hdc), 0 );
1165 /***********************************************************************
1166 * GetStockObject (GDI.87)
1168 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1170 return HGDIOBJ_16( GetStockObject( obj ) );
1174 /***********************************************************************
1175 * GetStretchBltMode (GDI.88)
1177 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1179 return GetStretchBltMode( HDC_32(hdc) );
1183 /***********************************************************************
1184 * GetTextCharacterExtra (GDI.89)
1186 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1188 return GetTextCharacterExtra( HDC_32(hdc) );
1192 /***********************************************************************
1193 * GetTextColor (GDI.90)
1195 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1197 return GetTextColor( HDC_32(hdc) );
1201 /***********************************************************************
1202 * GetTextExtent (GDI.91)
1204 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1206 SIZE size;
1207 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1208 return MAKELONG( size.cx, size.cy );
1212 /***********************************************************************
1213 * GetTextFace (GDI.92)
1215 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1217 return GetTextFaceA( HDC_32(hdc), count, name );
1221 /***********************************************************************
1222 * GetTextMetrics (GDI.93)
1224 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1226 TEXTMETRICW tm32;
1228 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1230 tm->tmHeight = tm32.tmHeight;
1231 tm->tmAscent = tm32.tmAscent;
1232 tm->tmDescent = tm32.tmDescent;
1233 tm->tmInternalLeading = tm32.tmInternalLeading;
1234 tm->tmExternalLeading = tm32.tmExternalLeading;
1235 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1236 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1237 tm->tmWeight = tm32.tmWeight;
1238 tm->tmOverhang = tm32.tmOverhang;
1239 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1240 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1241 tm->tmFirstChar = tm32.tmFirstChar;
1242 tm->tmLastChar = tm32.tmLastChar;
1243 tm->tmDefaultChar = tm32.tmDefaultChar;
1244 tm->tmBreakChar = tm32.tmBreakChar;
1245 tm->tmItalic = tm32.tmItalic;
1246 tm->tmUnderlined = tm32.tmUnderlined;
1247 tm->tmStruckOut = tm32.tmStruckOut;
1248 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1249 tm->tmCharSet = tm32.tmCharSet;
1250 return TRUE;
1254 /***********************************************************************
1255 * GetViewportExt (GDI.94)
1257 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1259 SIZE size;
1260 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1261 return MAKELONG( size.cx, size.cy );
1265 /***********************************************************************
1266 * GetViewportOrg (GDI.95)
1268 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1270 POINT pt;
1271 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1272 return MAKELONG( pt.x, pt.y );
1276 /***********************************************************************
1277 * GetWindowExt (GDI.96)
1279 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1281 SIZE size;
1282 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1283 return MAKELONG( size.cx, size.cy );
1287 /***********************************************************************
1288 * GetWindowOrg (GDI.97)
1290 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1292 POINT pt;
1293 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1294 return MAKELONG( pt.x, pt.y );
1300 /**********************************************************************
1301 * LineDDA (GDI.100)
1303 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1304 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1306 struct callback16_info info;
1307 info.proc = (FARPROC16)proc;
1308 info.param = lParam;
1309 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1313 /***********************************************************************
1314 * OffsetRgn (GDI.101)
1316 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1318 return OffsetRgn( HRGN_32(hrgn), x, y );
1322 /***********************************************************************
1323 * PtVisible (GDI.103)
1325 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1327 return PtVisible( HDC_32(hdc), x, y );
1331 /***********************************************************************
1332 * SetBitmapBits (GDI.106)
1334 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1336 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1340 /***********************************************************************
1341 * AddFontResource (GDI.119)
1343 INT16 WINAPI AddFontResource16( LPCSTR filename )
1345 return AddFontResourceA( filename );
1349 /***********************************************************************
1350 * Death (GDI.121)
1352 * Disables GDI, switches back to text mode.
1353 * We don't have to do anything here,
1354 * just let console support handle everything
1356 void WINAPI Death16(HDC16 hdc)
1358 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1362 /***********************************************************************
1363 * Resurrection (GDI.122)
1365 * Restores GDI functionality
1367 void WINAPI Resurrection16(HDC16 hdc,
1368 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1370 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1371 hdc, w1, w2, w3, w4, w5, w6);
1375 /**********************************************************************
1376 * CreateMetaFile (GDI.125)
1378 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1380 return HDC_16( CreateMetaFileA( filename ) );
1384 /***********************************************************************
1385 * MulDiv (GDI.128)
1387 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1389 INT ret;
1390 if (!nDivisor) return -32768;
1391 /* We want to deal with a positive divisor to simplify the logic. */
1392 if (nDivisor < 0)
1394 nMultiplicand = - nMultiplicand;
1395 nDivisor = -nDivisor;
1397 /* If the result is positive, we "add" to round. else,
1398 * we subtract to round. */
1399 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1400 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1401 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1402 else
1403 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1404 if ((ret > 32767) || (ret < -32767)) return -32768;
1405 return (INT16) ret;
1409 /***********************************************************************
1410 * GetRgnBox (GDI.134)
1412 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1414 RECT r;
1415 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1416 CONV_RECT32TO16( &r, rect );
1417 return ret;
1421 /***********************************************************************
1422 * RemoveFontResource (GDI.136)
1424 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1426 return RemoveFontResourceA(str);
1430 /***********************************************************************
1431 * SetBrushOrg (GDI.148)
1433 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1435 POINT pt;
1437 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1438 return MAKELONG( pt.x, pt.y );
1442 /***********************************************************************
1443 * GetBrushOrg (GDI.149)
1445 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1447 POINT pt;
1448 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1449 return MAKELONG( pt.x, pt.y );
1453 /***********************************************************************
1454 * UnrealizeObject (GDI.150)
1456 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1458 return UnrealizeObject( HGDIOBJ_32(obj) );
1462 /***********************************************************************
1463 * CreateIC (GDI.153)
1465 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1466 const DEVMODEA* initData )
1468 return HDC_16( CreateICA( driver, device, output, initData ) );
1472 /***********************************************************************
1473 * GetNearestColor (GDI.154)
1475 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1477 return GetNearestColor( HDC_32(hdc), color );
1481 /***********************************************************************
1482 * CreateDiscardableBitmap (GDI.156)
1484 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1486 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1490 /***********************************************************************
1491 * PtInRegion (GDI.161)
1493 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1495 return PtInRegion( HRGN_32(hrgn), x, y );
1499 /***********************************************************************
1500 * GetBitmapDimension (GDI.162)
1502 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1504 SIZE16 size;
1505 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1506 return MAKELONG( size.cx, size.cy );
1510 /***********************************************************************
1511 * SetBitmapDimension (GDI.163)
1513 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1515 SIZE16 size;
1516 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1517 return MAKELONG( size.cx, size.cy );
1521 /***********************************************************************
1522 * SetRectRgn (GDI.172)
1524 * NOTE: Win 3.1 sets region to empty if left > right
1526 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1528 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1529 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1533 /******************************************************************
1534 * PlayMetaFileRecord (GDI.176)
1536 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1538 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1539 unsigned int i;
1541 for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1542 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1543 for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1544 HeapFree( GetProcessHeap(), 0, ht32 );
1548 /***********************************************************************
1549 * GetCharABCWidths (GDI.307)
1551 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1553 BOOL ret;
1554 UINT i;
1555 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1557 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1559 for (i = firstChar; i <= lastChar; i++)
1561 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1562 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1563 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1566 HeapFree( GetProcessHeap(), 0, abc32 );
1567 return ret;
1571 /***********************************************************************
1572 * CreateScalableFontResource (GDI.310)
1574 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1575 LPCSTR fontFile, LPCSTR path )
1577 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1581 /*************************************************************************
1582 * GetFontData (GDI.311)
1585 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1587 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1591 /*************************************************************************
1592 * GetRasterizerCaps (GDI.313)
1594 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1596 return GetRasterizerCaps( lprs, cbNumBytes );
1600 /*************************************************************************
1601 * GetKerningPairs (GDI.332)
1604 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1606 KERNINGPAIR *pairs32;
1607 INT i, ret;
1609 if (!count) return 0;
1611 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1612 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1614 for (i = 0; i < ret; i++)
1616 pairs->wFirst = pairs32->wFirst;
1617 pairs->wSecond = pairs32->wSecond;
1618 pairs->iKernAmount = pairs32->iKernAmount;
1621 HeapFree( GetProcessHeap(), 0, pairs32 );
1622 return ret;
1627 /***********************************************************************
1628 * GetTextAlign (GDI.345)
1630 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1632 return GetTextAlign( HDC_32(hdc) );
1636 /***********************************************************************
1637 * SetTextAlign (GDI.346)
1639 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1641 return SetTextAlign( HDC_32(hdc), align );
1645 /***********************************************************************
1646 * Chord (GDI.348)
1648 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1649 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1650 INT16 xend, INT16 yend )
1652 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1656 /***********************************************************************
1657 * SetMapperFlags (GDI.349)
1659 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1661 return SetMapperFlags( HDC_32(hdc), flags );
1665 /***********************************************************************
1666 * GetCharWidth (GDI.350)
1668 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
1670 BOOL retVal = FALSE;
1672 if( firstChar != lastChar )
1674 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
1675 if( buf32 )
1677 LPINT obuf32 = buf32;
1678 int i;
1680 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
1681 if (retVal)
1683 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
1685 HeapFree(GetProcessHeap(), 0, obuf32);
1688 else /* happens quite often to warrant a special treatment */
1690 INT chWidth;
1691 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
1692 *buffer = chWidth;
1694 return retVal;
1698 /***********************************************************************
1699 * ExtTextOut (GDI.351)
1701 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
1702 const RECT16 *lprect, LPCSTR str, UINT16 count,
1703 const INT16 *lpDx )
1705 BOOL ret;
1706 int i;
1707 RECT rect32;
1708 LPINT lpdx32 = NULL;
1710 if (lpDx) {
1711 lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
1712 if(lpdx32 == NULL) return FALSE;
1713 for (i=count;i--;) lpdx32[i]=lpDx[i];
1715 if (lprect) CONV_RECT16TO32(lprect,&rect32);
1716 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
1717 if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
1718 return ret;
1722 /***********************************************************************
1723 * CreatePalette (GDI.360)
1725 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
1727 return HPALETTE_16( CreatePalette( palette ) );
1731 /***********************************************************************
1732 * GDISelectPalette (GDI.361)
1734 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
1736 return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
1740 /***********************************************************************
1741 * GDIRealizePalette (GDI.362)
1743 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
1745 return GDIRealizePalette( HDC_32(hdc) );
1749 /***********************************************************************
1750 * GetPaletteEntries (GDI.363)
1752 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1753 UINT16 count, LPPALETTEENTRY entries )
1755 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1759 /***********************************************************************
1760 * SetPaletteEntries (GDI.364)
1762 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1763 UINT16 count, const PALETTEENTRY *entries )
1765 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1769 /**********************************************************************
1770 * UpdateColors (GDI.366)
1772 INT16 WINAPI UpdateColors16( HDC16 hdc )
1774 UpdateColors( HDC_32(hdc) );
1775 return TRUE;
1779 /***********************************************************************
1780 * AnimatePalette (GDI.367)
1782 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
1783 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
1785 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
1789 /***********************************************************************
1790 * ResizePalette (GDI.368)
1792 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
1794 return ResizePalette( HPALETTE_32(hpalette), cEntries );
1798 /***********************************************************************
1799 * GetNearestPaletteIndex (GDI.370)
1801 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
1803 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
1807 /**********************************************************************
1808 * ExtFloodFill (GDI.372)
1810 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
1811 UINT16 fillType )
1813 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
1817 /***********************************************************************
1818 * SetSystemPaletteUse (GDI.373)
1820 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
1822 return SetSystemPaletteUse( HDC_32(hdc), use );
1826 /***********************************************************************
1827 * GetSystemPaletteUse (GDI.374)
1829 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
1831 return GetSystemPaletteUse( HDC_32(hdc) );
1835 /***********************************************************************
1836 * GetSystemPaletteEntries (GDI.375)
1838 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
1839 LPPALETTEENTRY entries )
1841 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
1845 /***********************************************************************
1846 * ResetDC (GDI.376)
1848 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
1850 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
1854 /******************************************************************
1855 * StartDoc (GDI.377)
1857 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
1859 DOCINFOA docA;
1861 docA.cbSize = lpdoc->cbSize;
1862 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
1863 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
1864 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
1865 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
1866 else
1867 docA.lpszDatatype = NULL;
1868 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
1869 docA.fwType = lpdoc->fwType;
1870 else
1871 docA.fwType = 0;
1872 return StartDocA( HDC_32(hdc), &docA );
1876 /******************************************************************
1877 * EndDoc (GDI.378)
1879 INT16 WINAPI EndDoc16( HDC16 hdc )
1881 return EndDoc( HDC_32(hdc) );
1885 /******************************************************************
1886 * StartPage (GDI.379)
1888 INT16 WINAPI StartPage16( HDC16 hdc )
1890 return StartPage( HDC_32(hdc) );
1894 /******************************************************************
1895 * EndPage (GDI.380)
1897 INT16 WINAPI EndPage16( HDC16 hdc )
1899 return EndPage( HDC_32(hdc) );
1903 /******************************************************************************
1904 * AbortDoc (GDI.382)
1906 INT16 WINAPI AbortDoc16( HDC16 hdc )
1908 return AbortDoc( HDC_32(hdc) );
1912 /***********************************************************************
1913 * FastWindowFrame (GDI.400)
1915 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
1916 INT16 width, INT16 height, DWORD rop )
1918 HDC hdc32 = HDC_32(hdc);
1919 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
1920 PatBlt( hdc32, rect->left, rect->top,
1921 rect->right - rect->left - width, height, rop );
1922 PatBlt( hdc32, rect->left, rect->top + height, width,
1923 rect->bottom - rect->top - height, rop );
1924 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
1925 rect->right - rect->left - width, -height, rop );
1926 PatBlt( hdc32, rect->right - 1, rect->top, -width,
1927 rect->bottom - rect->top - height, rop );
1928 SelectObject( hdc32, hbrush );
1929 return TRUE;
1933 /***********************************************************************
1934 * CreateUserBitmap (GDI.407)
1936 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
1937 UINT16 bpp, LPCVOID bits )
1939 return CreateBitmap16( width, height, planes, bpp, bits );
1943 /***********************************************************************
1944 * CreateUserDiscardableBitmap (GDI.409)
1946 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
1948 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
1949 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
1950 DeleteDC( hdc );
1951 return HBITMAP_16(ret);
1955 /***********************************************************************
1956 * GetCurLogFont (GDI.411)
1958 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
1960 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
1964 /***********************************************************************
1965 * StretchDIBits (GDI.439)
1967 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
1968 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
1969 INT16 heightSrc, const VOID *bits,
1970 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
1972 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
1973 xSrc, ySrc, widthSrc, heightSrc, bits,
1974 info, wUsage, dwRop );
1978 /***********************************************************************
1979 * SetDIBits (GDI.440)
1981 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1982 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
1983 UINT16 coloruse )
1985 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
1989 /***********************************************************************
1990 * GetDIBits (GDI.441)
1992 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1993 UINT16 lines, LPVOID bits, BITMAPINFO * info,
1994 UINT16 coloruse )
1996 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2000 /***********************************************************************
2001 * CreateDIBitmap (GDI.442)
2003 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
2004 DWORD init, LPCVOID bits, const BITMAPINFO * data,
2005 UINT16 coloruse )
2007 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
2011 /***********************************************************************
2012 * SetDIBitsToDevice (GDI.443)
2014 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2015 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2016 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2017 UINT16 coloruse )
2019 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2020 startscan, lines, bits, info, coloruse );
2024 /***********************************************************************
2025 * CreateRoundRectRgn (GDI.444)
2027 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2028 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2029 * we just let CreateRoundRectRgn convert them to +ve values.
2032 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2033 INT16 ellipse_width, INT16 ellipse_height )
2035 if( ellipse_width == 0 || ellipse_height == 0 )
2036 return CreateRectRgn16( left, top, right, bottom );
2037 else
2038 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2039 ellipse_width, ellipse_height ));
2043 /***********************************************************************
2044 * CreateDIBPatternBrush (GDI.445)
2046 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2048 BITMAPINFO *bmi;
2049 HBRUSH16 ret;
2051 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2052 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2053 GlobalUnlock16( hbitmap );
2054 return ret;
2058 /**********************************************************************
2059 * PolyPolygon (GDI.450)
2061 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2062 UINT16 polygons )
2064 int i,nrpts;
2065 LPPOINT pt32;
2066 LPINT counts32;
2067 BOOL16 ret;
2069 nrpts=0;
2070 for (i=polygons;i--;)
2071 nrpts+=counts[i];
2072 pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2073 if(pt32 == NULL) return FALSE;
2074 for (i=nrpts;i--;)
2075 CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
2076 counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2077 if(counts32 == NULL) {
2078 HeapFree( GetProcessHeap(), 0, pt32 );
2079 return FALSE;
2081 for (i=polygons;i--;) counts32[i]=counts[i];
2083 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2084 HeapFree( GetProcessHeap(), 0, counts32 );
2085 HeapFree( GetProcessHeap(), 0, pt32 );
2086 return ret;
2090 /***********************************************************************
2091 * CreatePolyPolygonRgn (GDI.451)
2093 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2094 const INT16 *count, INT16 nbpolygons, INT16 mode )
2096 HRGN hrgn;
2097 int i, npts = 0;
2098 INT *count32;
2099 POINT *points32;
2101 for (i = 0; i < nbpolygons; i++) npts += count[i];
2102 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2103 for (i = 0; i < npts; i++) CONV_POINT16TO32( &(points[i]), &(points32[i]) );
2105 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2106 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2107 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2108 HeapFree( GetProcessHeap(), 0, count32 );
2109 HeapFree( GetProcessHeap(), 0, points32 );
2110 return HRGN_16(hrgn);
2114 /***********************************************************************
2115 * SetObjectOwner (GDI.461)
2117 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2119 /* Nothing to do */
2123 /***********************************************************************
2124 * RectVisible (GDI.465)
2125 * RectVisibleOld (GDI.104)
2127 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2129 RECT rect;
2130 CONV_RECT16TO32( rect16, &rect );
2131 return RectVisible( HDC_32(hdc), &rect );
2135 /***********************************************************************
2136 * RectInRegion (GDI.466)
2137 * RectInRegionOld (GDI.181)
2139 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2141 RECT r32;
2143 CONV_RECT16TO32(rect, &r32);
2144 return RectInRegion( HRGN_32(hrgn), &r32 );
2148 /***********************************************************************
2149 * GetBitmapDimensionEx (GDI.468)
2151 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2153 SIZE size32;
2154 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2156 if (ret)
2158 size->cx = size32.cx;
2159 size->cy = size32.cy;
2161 return ret;
2165 /***********************************************************************
2166 * GetBrushOrgEx (GDI.469)
2168 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2170 POINT pt32;
2171 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2172 pt->x = pt32.x;
2173 pt->y = pt32.y;
2174 return TRUE;
2178 /***********************************************************************
2179 * GetCurrentPositionEx (GDI.470)
2181 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2183 POINT pt32;
2184 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2185 pt->x = pt32.x;
2186 pt->y = pt32.y;
2187 return TRUE;
2191 /***********************************************************************
2192 * GetTextExtentPoint (GDI.471)
2194 * FIXME: Should this have a bug for compatibility?
2195 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2196 * bugs (-> MSDN KB q147647.txt).
2198 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2200 SIZE size32;
2201 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2203 if (ret)
2205 size->cx = size32.cx;
2206 size->cy = size32.cy;
2208 return ret;
2212 /***********************************************************************
2213 * GetViewportExtEx (GDI.472)
2215 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2217 SIZE size32;
2218 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2219 size->cx = size32.cx;
2220 size->cy = size32.cy;
2221 return TRUE;
2225 /***********************************************************************
2226 * GetViewportOrgEx (GDI.473)
2228 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2230 POINT pt32;
2231 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2232 pt->x = pt32.x;
2233 pt->y = pt32.y;
2234 return TRUE;
2238 /***********************************************************************
2239 * GetWindowExtEx (GDI.474)
2241 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2243 SIZE size32;
2244 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2245 size->cx = size32.cx;
2246 size->cy = size32.cy;
2247 return TRUE;
2251 /***********************************************************************
2252 * GetWindowOrgEx (GDI.475)
2254 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2256 POINT pt32;
2257 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2258 pt->x = pt32.x;
2259 pt->y = pt32.y;
2260 return TRUE;
2264 /***********************************************************************
2265 * OffsetViewportOrgEx (GDI.476)
2267 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2269 POINT pt32;
2270 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2271 if (pt) CONV_POINT32TO16( &pt32, pt );
2272 return ret;
2276 /***********************************************************************
2277 * OffsetWindowOrgEx (GDI.477)
2279 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2281 POINT pt32;
2282 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2283 if (pt) CONV_POINT32TO16( &pt32, pt );
2284 return ret;
2288 /***********************************************************************
2289 * SetBitmapDimensionEx (GDI.478)
2291 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2293 SIZE size32;
2294 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2296 if (ret && prevSize)
2298 prevSize->cx = size32.cx;
2299 prevSize->cy = size32.cy;
2301 return ret;
2305 /***********************************************************************
2306 * SetViewportExtEx (GDI.479)
2308 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2310 SIZE size32;
2311 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2312 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2313 return ret;
2317 /***********************************************************************
2318 * SetViewportOrgEx (GDI.480)
2320 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2322 POINT pt32;
2323 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2324 if (pt) CONV_POINT32TO16( &pt32, pt );
2325 return ret;
2329 /***********************************************************************
2330 * SetWindowExtEx (GDI.481)
2332 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2334 SIZE size32;
2335 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2336 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2337 return ret;
2341 /***********************************************************************
2342 * SetWindowOrgEx (GDI.482)
2344 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2346 POINT pt32;
2347 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2348 if (pt) CONV_POINT32TO16( &pt32, pt );
2349 return ret;
2353 /***********************************************************************
2354 * MoveToEx (GDI.483)
2356 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2358 POINT pt32;
2360 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2361 if (pt) CONV_POINT32TO16( &pt32, pt );
2362 return TRUE;
2366 /***********************************************************************
2367 * ScaleViewportExtEx (GDI.484)
2369 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2370 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2372 SIZE size32;
2373 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2374 &size32 );
2375 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2376 return ret;
2380 /***********************************************************************
2381 * ScaleWindowExtEx (GDI.485)
2383 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2384 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2386 SIZE size32;
2387 BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2388 &size32 );
2389 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2390 return ret;
2394 /******************************************************************************
2395 * PolyBezier (GDI.502)
2397 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2399 int i;
2400 BOOL16 ret;
2401 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2402 cPoints*sizeof(POINT) );
2403 if(!pt32) return FALSE;
2404 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2405 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2406 HeapFree( GetProcessHeap(), 0, pt32 );
2407 return ret;
2411 /******************************************************************************
2412 * PolyBezierTo (GDI.503)
2414 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2416 int i;
2417 BOOL16 ret;
2418 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2419 cPoints*sizeof(POINT) );
2420 if(!pt32) return FALSE;
2421 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2422 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2423 HeapFree( GetProcessHeap(), 0, pt32 );
2424 return ret;
2428 /******************************************************************************
2429 * ExtSelectClipRgn (GDI.508)
2431 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2433 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2437 /***********************************************************************
2438 * AbortPath (GDI.511)
2440 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2442 return AbortPath( HDC_32(hdc) );
2446 /***********************************************************************
2447 * BeginPath (GDI.512)
2449 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2451 return BeginPath( HDC_32(hdc) );
2455 /***********************************************************************
2456 * CloseFigure (GDI.513)
2458 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2460 return CloseFigure( HDC_32(hdc) );
2464 /***********************************************************************
2465 * EndPath (GDI.514)
2467 BOOL16 WINAPI EndPath16(HDC16 hdc)
2469 return EndPath( HDC_32(hdc) );
2473 /***********************************************************************
2474 * FillPath (GDI.515)
2476 BOOL16 WINAPI FillPath16(HDC16 hdc)
2478 return FillPath( HDC_32(hdc) );
2482 /*******************************************************************
2483 * FlattenPath (GDI.516)
2485 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2487 return FlattenPath( HDC_32(hdc) );
2491 /***********************************************************************
2492 * GetPath (GDI.517)
2494 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2496 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2497 return 0;
2501 /***********************************************************************
2502 * PathToRegion (GDI.518)
2504 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2506 return HRGN_16( PathToRegion( HDC_32(hdc) ));
2510 /***********************************************************************
2511 * SelectClipPath (GDI.519)
2513 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2515 return SelectClipPath( HDC_32(hdc), iMode );
2519 /*******************************************************************
2520 * StrokeAndFillPath (GDI.520)
2522 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
2524 return StrokeAndFillPath( HDC_32(hdc) );
2528 /*******************************************************************
2529 * StrokePath (GDI.521)
2531 BOOL16 WINAPI StrokePath16(HDC16 hdc)
2533 return StrokePath( HDC_32(hdc) );
2537 /*******************************************************************
2538 * WidenPath (GDI.522)
2540 BOOL16 WINAPI WidenPath16(HDC16 hdc)
2542 return WidenPath( HDC_32(hdc) );
2546 /***********************************************************************
2547 * GetArcDirection (GDI.524)
2549 INT16 WINAPI GetArcDirection16( HDC16 hdc )
2551 return GetArcDirection( HDC_32(hdc) );
2555 /***********************************************************************
2556 * SetArcDirection (GDI.525)
2558 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
2560 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
2564 /***********************************************************************
2565 * CreateHalftonePalette (GDI.529)
2567 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
2569 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
2573 /***********************************************************************
2574 * SetDIBColorTable (GDI.602)
2576 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2578 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2582 /***********************************************************************
2583 * GetDIBColorTable (GDI.603)
2585 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2587 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2591 /***********************************************************************
2592 * GetRegionData (GDI.607)
2594 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2596 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
2598 return GetRegionData( HRGN_32(hrgn), count, rgndata );
2602 /***********************************************************************
2603 * GetTextCharset (GDI.612)
2605 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
2607 return GetTextCharset( HDC_32(hdc) );
2611 /*************************************************************************
2612 * GetFontLanguageInfo (GDI.616)
2614 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
2616 return GetFontLanguageInfo( HDC_32(hdc) );
2620 /***********************************************************************
2621 * SetLayout (GDI.1000)
2623 * Sets left->right or right->left text layout flags of a dc.
2625 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
2627 return SetLayout( HDC_32(hdc), layout );