Release 20030408.
[wine/gsoc-2012-control.git] / dlls / gdi / gdi16.c
blobd52298c34b7fd13cd1d60cfcf2900755cb668337
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 "winbase.h"
22 #include "wingdi.h"
23 #include "wownt32.h"
24 #include "wine/wingdi16.h"
25 #include "gdi.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
30 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
31 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
33 struct callback16_info
35 FARPROC16 proc;
36 LPARAM param;
39 /* callback for LineDDA16 */
40 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
42 const struct callback16_info *info = (struct callback16_info *)param;
43 WORD args[4];
45 args[3] = x;
46 args[2] = y;
47 args[1] = HIWORD(info->param);
48 args[0] = LOWORD(info->param);
49 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, NULL );
52 /* callback for EnumObjects16 */
53 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
55 const struct callback16_info *info = (struct callback16_info *)param;
56 LOGPEN *pen = ptr;
57 LOGPEN16 pen16;
58 SEGPTR segptr;
59 DWORD ret;
60 WORD args[4];
62 pen16.lopnStyle = pen->lopnStyle;
63 pen16.lopnWidth.x = pen->lopnWidth.x;
64 pen16.lopnWidth.y = pen->lopnWidth.y;
65 pen16.lopnColor = pen->lopnColor;
66 segptr = MapLS( &pen16 );
67 args[3] = SELECTOROF(segptr);
68 args[2] = OFFSETOF(segptr);
69 args[1] = HIWORD(info->param);
70 args[0] = LOWORD(info->param);
71 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
72 UnMapLS( segptr );
73 return LOWORD(ret);
76 /* callback for EnumObjects16 */
77 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
79 const struct callback16_info *info = (struct callback16_info *)param;
80 LOGBRUSH *brush = ptr;
81 LOGBRUSH16 brush16;
82 SEGPTR segptr;
83 DWORD ret;
84 WORD args[4];
86 brush16.lbStyle = brush->lbStyle;
87 brush16.lbColor = brush->lbColor;
88 brush16.lbHatch = brush->lbHatch;
89 segptr = MapLS( &brush16 );
90 args[3] = SELECTOROF(segptr);
91 args[2] = OFFSETOF(segptr);
92 args[1] = HIWORD(info->param);
93 args[0] = LOWORD(info->param);
94 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
95 UnMapLS( segptr );
96 return ret;
99 /* convert a LOGFONT16 to a LOGFONTW */
100 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
102 font32->lfHeight = font16->lfHeight;
103 font32->lfWidth = font16->lfWidth;
104 font32->lfEscapement = font16->lfEscapement;
105 font32->lfOrientation = font16->lfOrientation;
106 font32->lfWeight = font16->lfWeight;
107 font32->lfItalic = font16->lfItalic;
108 font32->lfUnderline = font16->lfUnderline;
109 font32->lfStrikeOut = font16->lfStrikeOut;
110 font32->lfCharSet = font16->lfCharSet;
111 font32->lfOutPrecision = font16->lfOutPrecision;
112 font32->lfClipPrecision = font16->lfClipPrecision;
113 font32->lfQuality = font16->lfQuality;
114 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
115 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
116 font32->lfFaceName[LF_FACESIZE-1] = 0;
120 /***********************************************************************
121 * SetBkColor (GDI.1)
123 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
125 return SetBkColor( HDC_32(hdc), color );
129 /***********************************************************************
130 * SetBkMode (GDI.2)
132 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
134 return SetBkMode( HDC_32(hdc), mode );
138 /***********************************************************************
139 * SetMapMode (GDI.3)
141 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
143 return SetMapMode( HDC_32(hdc), mode );
147 /***********************************************************************
148 * SetROP2 (GDI.4)
150 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
152 return SetROP2( HDC_32(hdc), mode );
156 /***********************************************************************
157 * SetRelAbs (GDI.5)
159 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
161 return SetRelAbs( HDC_32(hdc), mode );
165 /***********************************************************************
166 * SetPolyFillMode (GDI.6)
168 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
170 return SetPolyFillMode( HDC_32(hdc), mode );
174 /***********************************************************************
175 * SetStretchBltMode (GDI.7)
177 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
179 return SetStretchBltMode( HDC_32(hdc), mode );
183 /***********************************************************************
184 * SetTextCharacterExtra (GDI.8)
186 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
188 return SetTextCharacterExtra( HDC_32(hdc), extra );
192 /***********************************************************************
193 * SetTextColor (GDI.9)
195 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
197 return SetTextColor( HDC_32(hdc), color );
201 /***********************************************************************
202 * SetTextJustification (GDI.10)
204 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
206 return SetTextJustification( HDC_32(hdc), extra, breaks );
210 /***********************************************************************
211 * SetWindowOrg (GDI.11)
213 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
215 POINT pt;
216 if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
217 return MAKELONG( pt.x, pt.y );
221 /***********************************************************************
222 * SetWindowExt (GDI.12)
224 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
226 SIZE size;
227 if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
228 return MAKELONG( size.cx, size.cy );
232 /***********************************************************************
233 * SetViewportOrg (GDI.13)
235 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
237 POINT pt;
238 if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
239 return MAKELONG( pt.x, pt.y );
243 /***********************************************************************
244 * SetViewportExt (GDI.14)
246 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
248 SIZE size;
249 if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
250 return MAKELONG( size.cx, size.cy );
254 /***********************************************************************
255 * OffsetWindowOrg (GDI.15)
257 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
259 POINT pt;
260 if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
261 return MAKELONG( pt.x, pt.y );
265 /***********************************************************************
266 * ScaleWindowExt (GDI.16)
268 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
269 INT16 yNum, INT16 yDenom )
271 SIZE size;
272 if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
273 return FALSE;
274 return MAKELONG( size.cx, size.cy );
278 /***********************************************************************
279 * OffsetViewportOrg (GDI.17)
281 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
283 POINT pt;
284 if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
285 return MAKELONG( pt.x, pt.y );
289 /***********************************************************************
290 * ScaleViewportExt (GDI.18)
292 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
293 INT16 yNum, INT16 yDenom )
295 SIZE size;
296 if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
297 return FALSE;
298 return MAKELONG( size.cx, size.cy );
302 /***********************************************************************
303 * LineTo (GDI.19)
305 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
307 return LineTo( HDC_32(hdc), x, y );
311 /***********************************************************************
312 * MoveTo (GDI.20)
314 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
316 POINT pt;
318 if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
319 return MAKELONG(pt.x,pt.y);
323 /***********************************************************************
324 * ExcludeClipRect (GDI.21)
326 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
327 INT16 right, INT16 bottom )
329 return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
333 /***********************************************************************
334 * IntersectClipRect (GDI.22)
336 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
337 INT16 right, INT16 bottom )
339 return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
343 /***********************************************************************
344 * Arc (GDI.23)
346 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
347 INT16 bottom, INT16 xstart, INT16 ystart,
348 INT16 xend, INT16 yend )
350 return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
354 /***********************************************************************
355 * Ellipse (GDI.24)
357 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
358 INT16 right, INT16 bottom )
360 return Ellipse( HDC_32(hdc), left, top, right, bottom );
364 /**********************************************************************
365 * FloodFill (GDI.25)
367 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
369 return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
373 /***********************************************************************
374 * Pie (GDI.26)
376 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
377 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
378 INT16 xend, INT16 yend )
380 return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
384 /***********************************************************************
385 * Rectangle (GDI.27)
387 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
388 INT16 right, INT16 bottom )
390 return Rectangle( HDC_32(hdc), left, top, right, bottom );
394 /***********************************************************************
395 * RoundRect (GDI.28)
397 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
398 INT16 bottom, INT16 ell_width, INT16 ell_height )
400 return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
404 /***********************************************************************
405 * PatBlt (GDI.29)
407 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
408 INT16 width, INT16 height, DWORD rop)
410 return PatBlt( HDC_32(hdc), left, top, width, height, rop );
414 /***********************************************************************
415 * SaveDC (GDI.30)
417 INT16 WINAPI SaveDC16( HDC16 hdc )
419 return SaveDC( HDC_32(hdc) );
423 /***********************************************************************
424 * SetPixel (GDI.31)
426 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
428 return SetPixel( HDC_32(hdc), x, y, color );
432 /***********************************************************************
433 * OffsetClipRgn (GDI.32)
435 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
437 return OffsetClipRgn( HDC_32(hdc), x, y );
441 /***********************************************************************
442 * TextOut (GDI.33)
444 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
446 return TextOutA( HDC_32(hdc), x, y, str, count );
450 /***********************************************************************
451 * BitBlt (GDI.34)
453 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
454 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
455 DWORD rop )
457 return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
461 /***********************************************************************
462 * StretchBlt (GDI.35)
464 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
465 INT16 widthDst, INT16 heightDst,
466 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
467 INT16 widthSrc, INT16 heightSrc, DWORD rop )
469 return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
470 HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
474 /**********************************************************************
475 * Polygon (GDI.36)
477 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
479 register int i;
480 BOOL ret;
481 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
482 count*sizeof(POINT) );
484 if (!pt32) return FALSE;
485 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
486 ret = Polygon(HDC_32(hdc),pt32,count);
487 HeapFree( GetProcessHeap(), 0, pt32 );
488 return ret;
492 /**********************************************************************
493 * Polyline (GDI.37)
495 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
497 register int i;
498 BOOL16 ret;
499 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
500 count*sizeof(POINT) );
502 if (!pt32) return FALSE;
503 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
504 ret = Polyline(HDC_32(hdc),pt32,count);
505 HeapFree( GetProcessHeap(), 0, pt32 );
506 return ret;
510 /***********************************************************************
511 * Escape (GDI.38)
513 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
515 INT ret;
517 switch(escape)
519 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
520 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
521 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
522 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
523 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
524 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
525 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
526 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
527 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
528 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
529 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
530 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
531 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
532 case CLIP_TO_PATH:
533 case DRAFTMODE:
534 case ENUMPAPERBINS:
535 case EPSPRINTING:
536 case EXT_DEVICE_CAPS:
537 case GETCOLORTABLE:
538 case MOUSETRAILS:
539 case POSTSCRIPT_IGNORE:
540 case QUERYESCSUPPORT:
541 case SET_ARC_DIRECTION:
542 case SET_POLY_MODE:
543 case SET_SCREEN_ANGLE:
544 case SET_SPREAD:
546 INT16 *ptr = MapSL(in_data);
547 INT data = *ptr;
548 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
551 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
552 case ENABLEDUPLEX:
554 UINT16 *ptr = MapSL(in_data);
555 UINT data = *ptr;
556 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
559 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
560 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
561 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
562 case GETPHYSPAGESIZE:
563 case GETPRINTINGOFFSET:
564 case GETSCALINGFACTOR:
566 POINT16 *ptr = out_data;
567 POINT pt32;
568 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
569 ptr->x = pt32.x;
570 ptr->y = pt32.y;
571 return ret;
574 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
575 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
576 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
577 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
578 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
579 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
580 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
581 case ENABLEPAIRKERNING:
582 case ENABLERELATIVEWIDTHS:
583 case SETCOPYCOUNT:
584 case SETKERNTRACK:
585 case SETLINECAP:
586 case SETLINEJOIN:
587 case SETMITERLIMIT:
589 INT16 *new = MapSL(in_data);
590 INT16 *old = out_data;
591 INT out, in = *new;
592 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
593 *old = out;
594 return ret;
597 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
598 case SETABORTPROC:
599 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
601 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
602 * lpvOutData is actually a pointer to the DocInfo structure and used as
603 * a second input parameter */
604 case STARTDOC:
605 if (out_data)
607 ret = StartDoc16( hdc, out_data );
608 if (ret > 0) ret = StartPage( HDC_32(hdc) );
609 return ret;
611 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
613 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
614 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
615 case SET_BOUNDS:
616 case SET_CLIP_BOX:
618 RECT16 *rc16 = MapSL(in_data);
619 RECT rc;
620 rc.left = rc16->left;
621 rc.top = rc16->top;
622 rc.right = rc16->right;
623 rc.bottom = rc16->bottom;
624 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
627 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
628 case NEXTBAND:
630 RECT rc;
631 RECT16 *rc16 = out_data;
632 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
633 rc16->left = rc.left;
634 rc16->top = rc.top;
635 rc16->right = rc.right;
636 rc16->bottom = rc.bottom;
637 return ret;
640 /* Escape(hdc,ABORTDOC,NULL,NULL); */
641 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
642 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
643 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
644 /* Escape(hdc,ENDDOC,NULL,NULL); */
645 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
646 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
647 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
648 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
649 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
650 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
651 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
652 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
653 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
654 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
655 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
656 /* Escape(hdc,NEWFRAME,NULL,NULL); */
657 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
658 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
659 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
660 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
661 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
662 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
663 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
664 case ABORTDOC:
665 case BANDINFO:
666 case BEGIN_PATH:
667 case DRAWPATTERNRECT:
668 case ENDDOC:
669 case END_PATH:
670 case EXTTEXTOUT:
671 case FLUSHOUTPUT:
672 case GETFACENAME:
673 case GETPAIRKERNTABLE:
674 case GETSETPAPERBINS:
675 case GETSETPRINTORIENT:
676 case GETSETSCREENPARAMS:
677 case GETTECHNOLOGY:
678 case GETTRACKKERNTABLE:
679 case MFCOMMENT:
680 case NEWFRAME:
681 case PASSTHROUGH:
682 case RESTORE_CTM:
683 case SAVE_CTM:
684 case SETALLJUSTVALUES:
685 case SETCOLORTABLE:
686 case SET_BACKGROUND_COLOR:
687 case TRANSFORM_CTM:
688 /* pass it unmodified to the 32-bit function */
689 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
691 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
692 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
693 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
694 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
695 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
696 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
697 case ENUMPAPERMETRICS:
698 case GETEXTENDEDTEXTMETRICS:
699 case GETEXTENTTABLE:
700 case GETSETPAPERMETRICS:
701 case GETVECTORBRUSHSIZE:
702 case GETVECTORPENSIZE:
703 default:
704 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
705 escape, in_count, MapSL(in_data), out_data );
706 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
711 /***********************************************************************
712 * RestoreDC (GDI.39)
714 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
716 return RestoreDC( HDC_32(hdc), level );
720 /***********************************************************************
721 * FillRgn (GDI.40)
723 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
725 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
729 /***********************************************************************
730 * FrameRgn (GDI.41)
732 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
733 INT16 nWidth, INT16 nHeight )
735 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
739 /***********************************************************************
740 * InvertRgn (GDI.42)
742 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
744 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
748 /***********************************************************************
749 * PaintRgn (GDI.43)
751 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
753 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
757 /***********************************************************************
758 * SelectClipRgn (GDI.44)
760 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
762 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
766 /***********************************************************************
767 * SelectObject (GDI.45)
769 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
771 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
775 /***********************************************************************
776 * CombineRgn (GDI.47)
778 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
780 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
784 /***********************************************************************
785 * CreateBitmap (GDI.48)
787 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
788 UINT16 bpp, LPCVOID bits )
790 return HBITMAP_16( CreateBitmap( width, height, planes, bpp, bits ) );
794 /***********************************************************************
795 * CreateBitmapIndirect (GDI.49)
797 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
799 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
800 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
804 /***********************************************************************
805 * CreateBrushIndirect (GDI.50)
807 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
809 LOGBRUSH brush32;
811 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
812 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
814 brush32.lbStyle = brush->lbStyle;
815 brush32.lbColor = brush->lbColor;
816 brush32.lbHatch = brush->lbHatch;
817 return HBRUSH_16( CreateBrushIndirect(&brush32) );
821 /***********************************************************************
822 * CreateCompatibleBitmap (GDI.51)
824 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
826 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
830 /***********************************************************************
831 * CreateCompatibleDC (GDI.52)
833 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
835 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
839 /***********************************************************************
840 * CreateDC (GDI.53)
842 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
843 const DEVMODEA *initData )
845 return HDC_16( CreateDCA( driver, device, output, initData ) );
849 /***********************************************************************
850 * CreateEllipticRgn (GDI.54)
852 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
854 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
858 /***********************************************************************
859 * CreateEllipticRgnIndirect (GDI.55)
861 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
863 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
867 /***********************************************************************
868 * CreateFont (GDI.56)
870 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
871 INT16 weight, BYTE italic, BYTE underline,
872 BYTE strikeout, BYTE charset, BYTE outpres,
873 BYTE clippres, BYTE quality, BYTE pitch,
874 LPCSTR name )
876 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
877 strikeout, charset, outpres, clippres, quality, pitch, name ));
880 /***********************************************************************
881 * CreateFontIndirect (GDI.57)
883 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
885 HFONT ret;
887 if (plf16)
889 LOGFONTW lfW;
890 logfont_16_to_W( plf16, &lfW );
891 ret = CreateFontIndirectW( &lfW );
893 else ret = CreateFontIndirectW( NULL );
894 return HFONT_16(ret);
898 /***********************************************************************
899 * CreateHatchBrush (GDI.58)
901 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
903 return HBRUSH_16( CreateHatchBrush( style, color ) );
907 /***********************************************************************
908 * CreatePatternBrush (GDI.60)
910 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
912 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
916 /***********************************************************************
917 * CreatePen (GDI.61)
919 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
921 LOGPEN logpen;
923 logpen.lopnStyle = style;
924 logpen.lopnWidth.x = width;
925 logpen.lopnWidth.y = 0;
926 logpen.lopnColor = color;
927 return HPEN_16( CreatePenIndirect( &logpen ) );
931 /***********************************************************************
932 * CreatePenIndirect (GDI.62)
934 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
936 LOGPEN logpen;
938 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
939 logpen.lopnStyle = pen->lopnStyle;
940 logpen.lopnWidth.x = pen->lopnWidth.x;
941 logpen.lopnWidth.y = pen->lopnWidth.y;
942 logpen.lopnColor = pen->lopnColor;
943 return HPEN_16( CreatePenIndirect( &logpen ) );
947 /***********************************************************************
948 * CreatePolygonRgn (GDI.63)
950 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
952 return CreatePolyPolygonRgn16( points, &count, 1, mode );
956 /***********************************************************************
957 * CreateRectRgn (GDI.64)
959 * NOTE: cf. SetRectRgn16
961 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
963 HRGN hrgn;
965 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
966 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
967 return HRGN_16(hrgn);
971 /***********************************************************************
972 * CreateRectRgnIndirect (GDI.65)
974 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
976 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
980 /***********************************************************************
981 * CreateSolidBrush (GDI.66)
983 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
985 return HBRUSH_16( CreateSolidBrush( color ) );
989 /***********************************************************************
990 * DeleteDC (GDI.68)
992 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
994 return DeleteDC( HDC_32(hdc) );
998 /***********************************************************************
999 * DeleteObject (GDI.69)
1000 * SysDeleteObject (GDI.605)
1002 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
1004 return DeleteObject( HGDIOBJ_32(obj) );
1008 /***********************************************************************
1009 * EnumObjects (GDI.71)
1011 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1013 struct callback16_info info;
1015 info.proc = (FARPROC16)proc;
1016 info.param = lParam;
1017 switch(obj)
1019 case OBJ_PEN:
1020 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1021 case OBJ_BRUSH:
1022 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1024 return 0;
1028 /***********************************************************************
1029 * EqualRgn (GDI.72)
1031 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1033 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1037 /***********************************************************************
1038 * GetBitmapBits (GDI.74)
1040 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1042 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1046 /***********************************************************************
1047 * GetBkColor (GDI.75)
1049 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1051 return GetBkColor( HDC_32(hdc) );
1055 /***********************************************************************
1056 * GetBkMode (GDI.76)
1058 INT16 WINAPI GetBkMode16( HDC16 hdc )
1060 return GetBkMode( HDC_32(hdc) );
1064 /***********************************************************************
1065 * GetClipBox (GDI.77)
1067 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1069 RECT rect32;
1070 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1072 if (ret != ERROR)
1074 rect->left = rect32.left;
1075 rect->top = rect32.top;
1076 rect->right = rect32.right;
1077 rect->bottom = rect32.bottom;
1079 return ret;
1083 /***********************************************************************
1084 * GetCurrentPosition (GDI.78)
1086 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1088 POINT pt32;
1089 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1090 return MAKELONG( pt32.x, pt32.y );
1094 /***********************************************************************
1095 * GetDCOrg (GDI.79)
1097 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1099 POINT pt;
1100 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1101 return 0;
1105 /***********************************************************************
1106 * GetDeviceCaps (GDI.80)
1108 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1110 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1111 /* some apps don't expect -1 and think it's a B&W screen */
1112 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1113 return ret;
1117 /***********************************************************************
1118 * GetMapMode (GDI.81)
1120 INT16 WINAPI GetMapMode16( HDC16 hdc )
1122 return GetMapMode( HDC_32(hdc) );
1126 /***********************************************************************
1127 * GetPixel (GDI.83)
1129 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1131 return GetPixel( HDC_32(hdc), x, y );
1135 /***********************************************************************
1136 * GetPolyFillMode (GDI.84)
1138 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1140 return GetPolyFillMode( HDC_32(hdc) );
1144 /***********************************************************************
1145 * GetROP2 (GDI.85)
1147 INT16 WINAPI GetROP216( HDC16 hdc )
1149 return GetROP2( HDC_32(hdc) );
1153 /***********************************************************************
1154 * GetRelAbs (GDI.86)
1156 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1158 return GetRelAbs( HDC_32(hdc), 0 );
1162 /***********************************************************************
1163 * GetStockObject (GDI.87)
1165 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1167 return HGDIOBJ_16( GetStockObject( obj ) );
1171 /***********************************************************************
1172 * GetStretchBltMode (GDI.88)
1174 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1176 return GetStretchBltMode( HDC_32(hdc) );
1180 /***********************************************************************
1181 * GetTextCharacterExtra (GDI.89)
1183 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1185 return GetTextCharacterExtra( HDC_32(hdc) );
1189 /***********************************************************************
1190 * GetTextColor (GDI.90)
1192 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1194 return GetTextColor( HDC_32(hdc) );
1198 /***********************************************************************
1199 * GetTextExtent (GDI.91)
1201 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1203 SIZE size;
1204 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1205 return MAKELONG( size.cx, size.cy );
1209 /***********************************************************************
1210 * GetTextFace (GDI.92)
1212 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1214 return GetTextFaceA( HDC_32(hdc), count, name );
1218 /***********************************************************************
1219 * GetTextMetrics (GDI.93)
1221 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1223 TEXTMETRICW tm32;
1225 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1227 tm->tmHeight = tm32.tmHeight;
1228 tm->tmAscent = tm32.tmAscent;
1229 tm->tmDescent = tm32.tmDescent;
1230 tm->tmInternalLeading = tm32.tmInternalLeading;
1231 tm->tmExternalLeading = tm32.tmExternalLeading;
1232 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1233 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1234 tm->tmWeight = tm32.tmWeight;
1235 tm->tmOverhang = tm32.tmOverhang;
1236 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1237 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1238 tm->tmFirstChar = tm32.tmFirstChar;
1239 tm->tmLastChar = tm32.tmLastChar;
1240 tm->tmDefaultChar = tm32.tmDefaultChar;
1241 tm->tmBreakChar = tm32.tmBreakChar;
1242 tm->tmItalic = tm32.tmItalic;
1243 tm->tmUnderlined = tm32.tmUnderlined;
1244 tm->tmStruckOut = tm32.tmStruckOut;
1245 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1246 tm->tmCharSet = tm32.tmCharSet;
1247 return TRUE;
1251 /***********************************************************************
1252 * GetViewportExt (GDI.94)
1254 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1256 SIZE size;
1257 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1258 return MAKELONG( size.cx, size.cy );
1262 /***********************************************************************
1263 * GetViewportOrg (GDI.95)
1265 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1267 POINT pt;
1268 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1269 return MAKELONG( pt.x, pt.y );
1273 /***********************************************************************
1274 * GetWindowExt (GDI.96)
1276 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1278 SIZE size;
1279 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1280 return MAKELONG( size.cx, size.cy );
1284 /***********************************************************************
1285 * GetWindowOrg (GDI.97)
1287 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1289 POINT pt;
1290 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1291 return MAKELONG( pt.x, pt.y );
1297 /**********************************************************************
1298 * LineDDA (GDI.100)
1300 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1301 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1303 struct callback16_info info;
1304 info.proc = (FARPROC16)proc;
1305 info.param = lParam;
1306 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1310 /***********************************************************************
1311 * OffsetRgn (GDI.101)
1313 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1315 return OffsetRgn( HRGN_32(hrgn), x, y );
1319 /***********************************************************************
1320 * PtVisible (GDI.103)
1322 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1324 return PtVisible( HDC_32(hdc), x, y );
1328 /***********************************************************************
1329 * SetBitmapBits (GDI.106)
1331 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1333 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1337 /***********************************************************************
1338 * AddFontResource (GDI.119)
1340 INT16 WINAPI AddFontResource16( LPCSTR filename )
1342 return AddFontResourceA( filename );
1346 /***********************************************************************
1347 * Death (GDI.121)
1349 * Disables GDI, switches back to text mode.
1350 * We don't have to do anything here,
1351 * just let console support handle everything
1353 void WINAPI Death16(HDC16 hdc)
1355 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1359 /***********************************************************************
1360 * Resurrection (GDI.122)
1362 * Restores GDI functionality
1364 void WINAPI Resurrection16(HDC16 hdc,
1365 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1367 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1368 hdc, w1, w2, w3, w4, w5, w6);
1372 /**********************************************************************
1373 * CreateMetaFile (GDI.125)
1375 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1377 return HDC_16( CreateMetaFileA( filename ) );
1381 /***********************************************************************
1382 * MulDiv (GDI.128)
1384 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1386 INT ret;
1387 if (!nDivisor) return -32768;
1388 /* We want to deal with a positive divisor to simplify the logic. */
1389 if (nDivisor < 0)
1391 nMultiplicand = - nMultiplicand;
1392 nDivisor = -nDivisor;
1394 /* If the result is positive, we "add" to round. else,
1395 * we subtract to round. */
1396 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1397 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1398 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1399 else
1400 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1401 if ((ret > 32767) || (ret < -32767)) return -32768;
1402 return (INT16) ret;
1406 /***********************************************************************
1407 * GetRgnBox (GDI.134)
1409 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1411 RECT r;
1412 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1413 CONV_RECT32TO16( &r, rect );
1414 return ret;
1418 /***********************************************************************
1419 * RemoveFontResource (GDI.136)
1421 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1423 return RemoveFontResourceA(str);
1427 /***********************************************************************
1428 * SetBrushOrg (GDI.148)
1430 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1432 POINT pt;
1434 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1435 return MAKELONG( pt.x, pt.y );
1439 /***********************************************************************
1440 * GetBrushOrg (GDI.149)
1442 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1444 POINT pt;
1445 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1446 return MAKELONG( pt.x, pt.y );
1450 /***********************************************************************
1451 * UnrealizeObject (GDI.150)
1453 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1455 return UnrealizeObject( HGDIOBJ_32(obj) );
1459 /***********************************************************************
1460 * CreateIC (GDI.153)
1462 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1463 const DEVMODEA* initData )
1465 return HDC_16( CreateICA( driver, device, output, initData ) );
1469 /***********************************************************************
1470 * GetNearestColor (GDI.154)
1472 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1474 return GetNearestColor( HDC_32(hdc), color );
1478 /***********************************************************************
1479 * CreateDiscardableBitmap (GDI.156)
1481 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1483 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1487 /***********************************************************************
1488 * PtInRegion (GDI.161)
1490 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1492 return PtInRegion( HRGN_32(hrgn), x, y );
1496 /***********************************************************************
1497 * GetBitmapDimension (GDI.162)
1499 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1501 SIZE16 size;
1502 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1503 return MAKELONG( size.cx, size.cy );
1507 /***********************************************************************
1508 * SetBitmapDimension (GDI.163)
1510 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1512 SIZE16 size;
1513 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1514 return MAKELONG( size.cx, size.cy );
1518 /***********************************************************************
1519 * SetRectRgn (GDI.172)
1521 * NOTE: Win 3.1 sets region to empty if left > right
1523 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1525 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1526 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1530 /******************************************************************
1531 * PlayMetaFileRecord (GDI.176)
1533 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1535 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1536 unsigned int i;
1538 for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1539 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1540 for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1541 HeapFree( GetProcessHeap(), 0, ht32 );
1545 /***********************************************************************
1546 * GetCharABCWidths (GDI.307)
1548 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1550 BOOL ret;
1551 UINT i;
1552 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1554 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1556 for (i = firstChar; i <= lastChar; i++)
1558 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1559 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1560 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1563 HeapFree( GetProcessHeap(), 0, abc32 );
1564 return ret;
1568 /***********************************************************************
1569 * CreateScalableFontResource (GDI.310)
1571 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1572 LPCSTR fontFile, LPCSTR path )
1574 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1578 /*************************************************************************
1579 * GetFontData (GDI.311)
1582 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1584 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1588 /*************************************************************************
1589 * GetRasterizerCaps (GDI.313)
1591 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1593 return GetRasterizerCaps( lprs, cbNumBytes );
1597 /*************************************************************************
1598 * GetKerningPairs (GDI.332)
1601 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1603 KERNINGPAIR *pairs32;
1604 INT i, ret;
1606 if (!count) return 0;
1608 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1609 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1611 for (i = 0; i < ret; i++)
1613 pairs->wFirst = pairs32->wFirst;
1614 pairs->wSecond = pairs32->wSecond;
1615 pairs->iKernAmount = pairs32->iKernAmount;
1618 HeapFree( GetProcessHeap(), 0, pairs32 );
1619 return ret;
1624 /***********************************************************************
1625 * GetTextAlign (GDI.345)
1627 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1629 return GetTextAlign( HDC_32(hdc) );
1633 /***********************************************************************
1634 * SetTextAlign (GDI.346)
1636 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1638 return SetTextAlign( HDC_32(hdc), align );
1642 /***********************************************************************
1643 * Chord (GDI.348)
1645 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1646 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1647 INT16 xend, INT16 yend )
1649 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1653 /***********************************************************************
1654 * SetMapperFlags (GDI.349)
1656 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1658 return SetMapperFlags( HDC_32(hdc), flags );
1662 /***********************************************************************
1663 * GetCharWidth (GDI.350)
1665 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
1667 BOOL retVal = FALSE;
1669 if( firstChar != lastChar )
1671 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
1672 if( buf32 )
1674 LPINT obuf32 = buf32;
1675 int i;
1677 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
1678 if (retVal)
1680 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
1682 HeapFree(GetProcessHeap(), 0, obuf32);
1685 else /* happens quite often to warrant a special treatment */
1687 INT chWidth;
1688 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
1689 *buffer = chWidth;
1691 return retVal;
1695 /***********************************************************************
1696 * ExtTextOut (GDI.351)
1698 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
1699 const RECT16 *lprect, LPCSTR str, UINT16 count,
1700 const INT16 *lpDx )
1702 BOOL ret;
1703 int i;
1704 RECT rect32;
1705 LPINT lpdx32 = NULL;
1707 if (lpDx) {
1708 lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
1709 if(lpdx32 == NULL) return FALSE;
1710 for (i=count;i--;) lpdx32[i]=lpDx[i];
1712 if (lprect) CONV_RECT16TO32(lprect,&rect32);
1713 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
1714 if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
1715 return ret;
1719 /***********************************************************************
1720 * CreatePalette (GDI.360)
1722 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
1724 return HPALETTE_16( CreatePalette( palette ) );
1728 /***********************************************************************
1729 * GDISelectPalette (GDI.361)
1731 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
1733 return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
1737 /***********************************************************************
1738 * GDIRealizePalette (GDI.362)
1740 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
1742 return GDIRealizePalette( HDC_32(hdc) );
1746 /***********************************************************************
1747 * GetPaletteEntries (GDI.363)
1749 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1750 UINT16 count, LPPALETTEENTRY entries )
1752 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1756 /***********************************************************************
1757 * SetPaletteEntries (GDI.364)
1759 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1760 UINT16 count, const PALETTEENTRY *entries )
1762 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1766 /**********************************************************************
1767 * UpdateColors (GDI.366)
1769 INT16 WINAPI UpdateColors16( HDC16 hdc )
1771 UpdateColors( HDC_32(hdc) );
1772 return TRUE;
1776 /***********************************************************************
1777 * AnimatePalette (GDI.367)
1779 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
1780 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
1782 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
1786 /***********************************************************************
1787 * ResizePalette (GDI.368)
1789 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
1791 return ResizePalette( HPALETTE_32(hpalette), cEntries );
1795 /***********************************************************************
1796 * GetNearestPaletteIndex (GDI.370)
1798 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
1800 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
1804 /**********************************************************************
1805 * ExtFloodFill (GDI.372)
1807 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
1808 UINT16 fillType )
1810 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
1814 /***********************************************************************
1815 * SetSystemPaletteUse (GDI.373)
1817 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
1819 return SetSystemPaletteUse( HDC_32(hdc), use );
1823 /***********************************************************************
1824 * GetSystemPaletteUse (GDI.374)
1826 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
1828 return GetSystemPaletteUse( HDC_32(hdc) );
1832 /***********************************************************************
1833 * GetSystemPaletteEntries (GDI.375)
1835 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
1836 LPPALETTEENTRY entries )
1838 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
1842 /***********************************************************************
1843 * ResetDC (GDI.376)
1845 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
1847 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
1851 /******************************************************************
1852 * StartDoc (GDI.377)
1854 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
1856 DOCINFOA docA;
1858 docA.cbSize = lpdoc->cbSize;
1859 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
1860 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
1861 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
1862 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
1863 else
1864 docA.lpszDatatype = NULL;
1865 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
1866 docA.fwType = lpdoc->fwType;
1867 else
1868 docA.fwType = 0;
1869 return StartDocA( HDC_32(hdc), &docA );
1873 /******************************************************************
1874 * EndDoc (GDI.378)
1876 INT16 WINAPI EndDoc16( HDC16 hdc )
1878 return EndDoc( HDC_32(hdc) );
1882 /******************************************************************
1883 * StartPage (GDI.379)
1885 INT16 WINAPI StartPage16( HDC16 hdc )
1887 return StartPage( HDC_32(hdc) );
1891 /******************************************************************
1892 * EndPage (GDI.380)
1894 INT16 WINAPI EndPage16( HDC16 hdc )
1896 return EndPage( HDC_32(hdc) );
1900 /******************************************************************************
1901 * AbortDoc (GDI.382)
1903 INT16 WINAPI AbortDoc16( HDC16 hdc )
1905 return AbortDoc( HDC_32(hdc) );
1909 /***********************************************************************
1910 * FastWindowFrame (GDI.400)
1912 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
1913 INT16 width, INT16 height, DWORD rop )
1915 HDC hdc32 = HDC_32(hdc);
1916 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
1917 PatBlt( hdc32, rect->left, rect->top,
1918 rect->right - rect->left - width, height, rop );
1919 PatBlt( hdc32, rect->left, rect->top + height, width,
1920 rect->bottom - rect->top - height, rop );
1921 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
1922 rect->right - rect->left - width, -height, rop );
1923 PatBlt( hdc32, rect->right - 1, rect->top, -width,
1924 rect->bottom - rect->top - height, rop );
1925 SelectObject( hdc32, hbrush );
1926 return TRUE;
1930 /***********************************************************************
1931 * CreateUserBitmap (GDI.407)
1933 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
1934 UINT16 bpp, LPCVOID bits )
1936 return CreateBitmap16( width, height, planes, bpp, bits );
1940 /***********************************************************************
1941 * CreateUserDiscardableBitmap (GDI.409)
1943 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
1945 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
1946 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
1947 DeleteDC( hdc );
1948 return HBITMAP_16(ret);
1952 /***********************************************************************
1953 * GetCurLogFont (GDI.411)
1955 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
1957 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
1961 /***********************************************************************
1962 * StretchDIBits (GDI.439)
1964 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
1965 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
1966 INT16 heightSrc, const VOID *bits,
1967 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
1969 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
1970 xSrc, ySrc, widthSrc, heightSrc, bits,
1971 info, wUsage, dwRop );
1975 /***********************************************************************
1976 * SetDIBits (GDI.440)
1978 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1979 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
1980 UINT16 coloruse )
1982 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
1986 /***********************************************************************
1987 * GetDIBits (GDI.441)
1989 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1990 UINT16 lines, LPVOID bits, BITMAPINFO * info,
1991 UINT16 coloruse )
1993 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
1997 /***********************************************************************
1998 * CreateDIBitmap (GDI.442)
2000 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
2001 DWORD init, LPCVOID bits, const BITMAPINFO * data,
2002 UINT16 coloruse )
2004 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
2008 /***********************************************************************
2009 * SetDIBitsToDevice (GDI.443)
2011 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2012 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2013 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2014 UINT16 coloruse )
2016 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2017 startscan, lines, bits, info, coloruse );
2021 /***********************************************************************
2022 * CreateRoundRectRgn (GDI.444)
2024 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2025 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2026 * we just let CreateRoundRectRgn convert them to +ve values.
2029 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2030 INT16 ellipse_width, INT16 ellipse_height )
2032 if( ellipse_width == 0 || ellipse_height == 0 )
2033 return CreateRectRgn16( left, top, right, bottom );
2034 else
2035 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2036 ellipse_width, ellipse_height ));
2040 /***********************************************************************
2041 * CreateDIBPatternBrush (GDI.445)
2043 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2045 BITMAPINFO *bmi;
2046 HBRUSH16 ret;
2048 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2049 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2050 GlobalUnlock16( hbitmap );
2051 return ret;
2055 /**********************************************************************
2056 * PolyPolygon (GDI.450)
2058 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2059 UINT16 polygons )
2061 int i,nrpts;
2062 LPPOINT pt32;
2063 LPINT counts32;
2064 BOOL16 ret;
2066 nrpts=0;
2067 for (i=polygons;i--;)
2068 nrpts+=counts[i];
2069 pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2070 if(pt32 == NULL) return FALSE;
2071 for (i=nrpts;i--;)
2072 CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
2073 counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2074 if(counts32 == NULL) {
2075 HeapFree( GetProcessHeap(), 0, pt32 );
2076 return FALSE;
2078 for (i=polygons;i--;) counts32[i]=counts[i];
2080 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2081 HeapFree( GetProcessHeap(), 0, counts32 );
2082 HeapFree( GetProcessHeap(), 0, pt32 );
2083 return ret;
2087 /***********************************************************************
2088 * CreatePolyPolygonRgn (GDI.451)
2090 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2091 const INT16 *count, INT16 nbpolygons, INT16 mode )
2093 HRGN hrgn;
2094 int i, npts = 0;
2095 INT *count32;
2096 POINT *points32;
2098 for (i = 0; i < nbpolygons; i++) npts += count[i];
2099 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2100 for (i = 0; i < npts; i++) CONV_POINT16TO32( &(points[i]), &(points32[i]) );
2102 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2103 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2104 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2105 HeapFree( GetProcessHeap(), 0, count32 );
2106 HeapFree( GetProcessHeap(), 0, points32 );
2107 return HRGN_16(hrgn);
2111 /***********************************************************************
2112 * SetObjectOwner (GDI.461)
2114 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2116 /* Nothing to do */
2120 /***********************************************************************
2121 * RectVisible (GDI.465)
2122 * RectVisibleOld (GDI.104)
2124 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2126 RECT rect;
2127 CONV_RECT16TO32( rect16, &rect );
2128 return RectVisible( HDC_32(hdc), &rect );
2132 /***********************************************************************
2133 * RectInRegion (GDI.466)
2134 * RectInRegionOld (GDI.181)
2136 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2138 RECT r32;
2140 CONV_RECT16TO32(rect, &r32);
2141 return RectInRegion( HRGN_32(hrgn), &r32 );
2145 /***********************************************************************
2146 * GetBitmapDimensionEx (GDI.468)
2148 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2150 SIZE size32;
2151 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2153 if (ret)
2155 size->cx = size32.cx;
2156 size->cy = size32.cy;
2158 return ret;
2162 /***********************************************************************
2163 * GetBrushOrgEx (GDI.469)
2165 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2167 POINT pt32;
2168 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2169 pt->x = pt32.x;
2170 pt->y = pt32.y;
2171 return TRUE;
2175 /***********************************************************************
2176 * GetCurrentPositionEx (GDI.470)
2178 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2180 POINT pt32;
2181 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2182 pt->x = pt32.x;
2183 pt->y = pt32.y;
2184 return TRUE;
2188 /***********************************************************************
2189 * GetTextExtentPoint (GDI.471)
2191 * FIXME: Should this have a bug for compatibility?
2192 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2193 * bugs (-> MSDN KB q147647.txt).
2195 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2197 SIZE size32;
2198 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2200 if (ret)
2202 size->cx = size32.cx;
2203 size->cy = size32.cy;
2205 return ret;
2209 /***********************************************************************
2210 * GetViewportExtEx (GDI.472)
2212 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2214 SIZE size32;
2215 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2216 size->cx = size32.cx;
2217 size->cy = size32.cy;
2218 return TRUE;
2222 /***********************************************************************
2223 * GetViewportOrgEx (GDI.473)
2225 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2227 POINT pt32;
2228 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2229 pt->x = pt32.x;
2230 pt->y = pt32.y;
2231 return TRUE;
2235 /***********************************************************************
2236 * GetWindowExtEx (GDI.474)
2238 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2240 SIZE size32;
2241 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2242 size->cx = size32.cx;
2243 size->cy = size32.cy;
2244 return TRUE;
2248 /***********************************************************************
2249 * GetWindowOrgEx (GDI.475)
2251 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2253 POINT pt32;
2254 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2255 pt->x = pt32.x;
2256 pt->y = pt32.y;
2257 return TRUE;
2261 /***********************************************************************
2262 * OffsetViewportOrgEx (GDI.476)
2264 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2266 POINT pt32;
2267 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2268 if (pt) CONV_POINT32TO16( &pt32, pt );
2269 return ret;
2273 /***********************************************************************
2274 * OffsetWindowOrgEx (GDI.477)
2276 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2278 POINT pt32;
2279 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2280 if (pt) CONV_POINT32TO16( &pt32, pt );
2281 return ret;
2285 /***********************************************************************
2286 * SetBitmapDimensionEx (GDI.478)
2288 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2290 SIZE size32;
2291 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2293 if (ret && prevSize)
2295 prevSize->cx = size32.cx;
2296 prevSize->cy = size32.cy;
2298 return ret;
2302 /***********************************************************************
2303 * SetViewportExtEx (GDI.479)
2305 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2307 SIZE size32;
2308 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2309 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2310 return ret;
2314 /***********************************************************************
2315 * SetViewportOrgEx (GDI.480)
2317 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2319 POINT pt32;
2320 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2321 if (pt) CONV_POINT32TO16( &pt32, pt );
2322 return ret;
2326 /***********************************************************************
2327 * SetWindowExtEx (GDI.481)
2329 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2331 SIZE size32;
2332 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2333 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2334 return ret;
2338 /***********************************************************************
2339 * SetWindowOrgEx (GDI.482)
2341 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2343 POINT pt32;
2344 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2345 if (pt) CONV_POINT32TO16( &pt32, pt );
2346 return ret;
2350 /***********************************************************************
2351 * MoveToEx (GDI.483)
2353 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2355 POINT pt32;
2357 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2358 if (pt) CONV_POINT32TO16( &pt32, pt );
2359 return TRUE;
2363 /***********************************************************************
2364 * ScaleViewportExtEx (GDI.484)
2366 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2367 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2369 SIZE size32;
2370 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2371 &size32 );
2372 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2373 return ret;
2377 /***********************************************************************
2378 * ScaleWindowExtEx (GDI.485)
2380 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2381 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2383 SIZE size32;
2384 BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2385 &size32 );
2386 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2387 return ret;
2391 /******************************************************************************
2392 * PolyBezier (GDI.502)
2394 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2396 int i;
2397 BOOL16 ret;
2398 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2399 cPoints*sizeof(POINT) );
2400 if(!pt32) return FALSE;
2401 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2402 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2403 HeapFree( GetProcessHeap(), 0, pt32 );
2404 return ret;
2408 /******************************************************************************
2409 * PolyBezierTo (GDI.503)
2411 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2413 int i;
2414 BOOL16 ret;
2415 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2416 cPoints*sizeof(POINT) );
2417 if(!pt32) return FALSE;
2418 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2419 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2420 HeapFree( GetProcessHeap(), 0, pt32 );
2421 return ret;
2425 /******************************************************************************
2426 * ExtSelectClipRgn (GDI.508)
2428 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2430 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2434 /***********************************************************************
2435 * AbortPath (GDI.511)
2437 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2439 return AbortPath( HDC_32(hdc) );
2443 /***********************************************************************
2444 * BeginPath (GDI.512)
2446 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2448 return BeginPath( HDC_32(hdc) );
2452 /***********************************************************************
2453 * CloseFigure (GDI.513)
2455 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2457 return CloseFigure( HDC_32(hdc) );
2461 /***********************************************************************
2462 * EndPath (GDI.514)
2464 BOOL16 WINAPI EndPath16(HDC16 hdc)
2466 return EndPath( HDC_32(hdc) );
2470 /***********************************************************************
2471 * FillPath (GDI.515)
2473 BOOL16 WINAPI FillPath16(HDC16 hdc)
2475 return FillPath( HDC_32(hdc) );
2479 /*******************************************************************
2480 * FlattenPath (GDI.516)
2482 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2484 return FlattenPath( HDC_32(hdc) );
2488 /***********************************************************************
2489 * GetPath (GDI.517)
2491 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2493 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2494 return 0;
2498 /***********************************************************************
2499 * PathToRegion (GDI.518)
2501 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2503 return HRGN_16( PathToRegion( HDC_32(hdc) ));
2507 /***********************************************************************
2508 * SelectClipPath (GDI.519)
2510 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2512 return SelectClipPath( HDC_32(hdc), iMode );
2516 /*******************************************************************
2517 * StrokeAndFillPath (GDI.520)
2519 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
2521 return StrokeAndFillPath( HDC_32(hdc) );
2525 /*******************************************************************
2526 * StrokePath (GDI.521)
2528 BOOL16 WINAPI StrokePath16(HDC16 hdc)
2530 return StrokePath( HDC_32(hdc) );
2534 /*******************************************************************
2535 * WidenPath (GDI.522)
2537 BOOL16 WINAPI WidenPath16(HDC16 hdc)
2539 return WidenPath( HDC_32(hdc) );
2543 /***********************************************************************
2544 * GetArcDirection (GDI.524)
2546 INT16 WINAPI GetArcDirection16( HDC16 hdc )
2548 return GetArcDirection( HDC_32(hdc) );
2552 /***********************************************************************
2553 * SetArcDirection (GDI.525)
2555 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
2557 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
2561 /***********************************************************************
2562 * CreateHalftonePalette (GDI.529)
2564 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
2566 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
2570 /***********************************************************************
2571 * SetDIBColorTable (GDI.602)
2573 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2575 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2579 /***********************************************************************
2580 * GetDIBColorTable (GDI.603)
2582 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2584 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2588 /***********************************************************************
2589 * GetRegionData (GDI.607)
2591 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2593 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
2595 return GetRegionData( HRGN_32(hrgn), count, rgndata );
2599 /***********************************************************************
2600 * GetTextCharset (GDI.612)
2602 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
2604 return GetTextCharset( HDC_32(hdc) );
2608 /*************************************************************************
2609 * GetFontLanguageInfo (GDI.616)
2611 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
2613 return GetFontLanguageInfo( HDC_32(hdc) );
2617 /***********************************************************************
2618 * SetLayout (GDI.1000)
2620 * Sets left->right or right->left text layout flags of a dc.
2622 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
2624 return SetLayout( HDC_32(hdc), layout );