Fixed the list of accepted types passed to HttpOpenRequestA.
[wine/dcerpc.git] / dlls / gdi / gdi16.c
blob510437c5594b187da72b3f8e07595f453a7dbab1
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 /* ### start build ### */
34 extern WORD CALLBACK GDI_CallTo16_word_ll(FARPROC16,LONG,LONG);
35 extern WORD CALLBACK GDI_CallTo16_word_wwl(FARPROC16,WORD,WORD,LONG);
36 /* ### stop build ### */
38 struct callback16_info
40 FARPROC16 proc;
41 LPARAM param;
44 /* callback for LineDDA16 */
45 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
47 const struct callback16_info *info = (struct callback16_info *)param;
48 GDI_CallTo16_word_wwl( info->proc, x, y, info->param );
51 /* callback for EnumObjects16 */
52 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
54 const struct callback16_info *info = (struct callback16_info *)param;
55 LOGPEN *pen = ptr;
56 LOGPEN16 pen16;
57 SEGPTR segptr;
58 INT ret;
60 pen16.lopnStyle = pen->lopnStyle;
61 pen16.lopnWidth.x = pen->lopnWidth.x;
62 pen16.lopnWidth.y = pen->lopnWidth.y;
63 pen16.lopnColor = pen->lopnColor;
64 segptr = MapLS( &pen16 );
65 ret = GDI_CallTo16_word_ll( info->proc, segptr, info->param );
66 UnMapLS( segptr );
67 return ret;
70 /* callback for EnumObjects16 */
71 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
73 const struct callback16_info *info = (struct callback16_info *)param;
74 LOGBRUSH *brush = ptr;
75 LOGBRUSH16 brush16;
76 SEGPTR segptr;
77 INT ret;
79 brush16.lbStyle = brush->lbStyle;
80 brush16.lbColor = brush->lbColor;
81 brush16.lbHatch = brush->lbHatch;
82 segptr = MapLS( &brush16 );
83 ret = GDI_CallTo16_word_ll( info->proc, segptr, info->param );
84 UnMapLS( segptr );
85 return ret;
88 /* convert a LOGFONT16 to a LOGFONTW */
89 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
91 font32->lfHeight = font16->lfHeight;
92 font32->lfWidth = font16->lfWidth;
93 font32->lfEscapement = font16->lfEscapement;
94 font32->lfOrientation = font16->lfOrientation;
95 font32->lfWeight = font16->lfWeight;
96 font32->lfItalic = font16->lfItalic;
97 font32->lfUnderline = font16->lfUnderline;
98 font32->lfStrikeOut = font16->lfStrikeOut;
99 font32->lfCharSet = font16->lfCharSet;
100 font32->lfOutPrecision = font16->lfOutPrecision;
101 font32->lfClipPrecision = font16->lfClipPrecision;
102 font32->lfQuality = font16->lfQuality;
103 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
104 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
105 font32->lfFaceName[LF_FACESIZE-1] = 0;
109 /***********************************************************************
110 * SetBkColor (GDI.1)
112 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
114 return SetBkColor( HDC_32(hdc), color );
118 /***********************************************************************
119 * SetBkMode (GDI.2)
121 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
123 return SetBkMode( HDC_32(hdc), mode );
127 /***********************************************************************
128 * SetMapMode (GDI.3)
130 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
132 return SetMapMode( HDC_32(hdc), mode );
136 /***********************************************************************
137 * SetROP2 (GDI.4)
139 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
141 return SetROP2( HDC_32(hdc), mode );
145 /***********************************************************************
146 * SetRelAbs (GDI.5)
148 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
150 return SetRelAbs( HDC_32(hdc), mode );
154 /***********************************************************************
155 * SetPolyFillMode (GDI.6)
157 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
159 return SetPolyFillMode( HDC_32(hdc), mode );
163 /***********************************************************************
164 * SetStretchBltMode (GDI.7)
166 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
168 return SetStretchBltMode( HDC_32(hdc), mode );
172 /***********************************************************************
173 * SetTextCharacterExtra (GDI.8)
175 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
177 return SetTextCharacterExtra( HDC_32(hdc), extra );
181 /***********************************************************************
182 * SetTextColor (GDI.9)
184 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
186 return SetTextColor( HDC_32(hdc), color );
190 /***********************************************************************
191 * SetTextJustification (GDI.10)
193 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
195 return SetTextJustification( HDC_32(hdc), extra, breaks );
199 /***********************************************************************
200 * SetWindowOrg (GDI.11)
202 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
204 POINT pt;
205 if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
206 return MAKELONG( pt.x, pt.y );
210 /***********************************************************************
211 * SetWindowExt (GDI.12)
213 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
215 SIZE size;
216 if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
217 return MAKELONG( size.cx, size.cy );
221 /***********************************************************************
222 * SetViewportOrg (GDI.13)
224 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
226 POINT pt;
227 if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
228 return MAKELONG( pt.x, pt.y );
232 /***********************************************************************
233 * SetViewportExt (GDI.14)
235 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
237 SIZE size;
238 if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
239 return MAKELONG( size.cx, size.cy );
243 /***********************************************************************
244 * OffsetWindowOrg (GDI.15)
246 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
248 POINT pt;
249 if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
250 return MAKELONG( pt.x, pt.y );
254 /***********************************************************************
255 * ScaleWindowExt (GDI.16)
257 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
258 INT16 yNum, INT16 yDenom )
260 SIZE size;
261 if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
262 return FALSE;
263 return MAKELONG( size.cx, size.cy );
267 /***********************************************************************
268 * OffsetViewportOrg (GDI.17)
270 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
272 POINT pt;
273 if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
274 return MAKELONG( pt.x, pt.y );
278 /***********************************************************************
279 * ScaleViewportExt (GDI.18)
281 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
282 INT16 yNum, INT16 yDenom )
284 SIZE size;
285 if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
286 return FALSE;
287 return MAKELONG( size.cx, size.cy );
291 /***********************************************************************
292 * LineTo (GDI.19)
294 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
296 return LineTo( HDC_32(hdc), x, y );
300 /***********************************************************************
301 * MoveTo (GDI.20)
303 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
305 POINT pt;
307 if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
308 return MAKELONG(pt.x,pt.y);
312 /***********************************************************************
313 * ExcludeClipRect (GDI.21)
315 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
316 INT16 right, INT16 bottom )
318 return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
322 /***********************************************************************
323 * IntersectClipRect (GDI.22)
325 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
326 INT16 right, INT16 bottom )
328 return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
332 /***********************************************************************
333 * Arc (GDI.23)
335 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
336 INT16 bottom, INT16 xstart, INT16 ystart,
337 INT16 xend, INT16 yend )
339 return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
343 /***********************************************************************
344 * Ellipse (GDI.24)
346 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
347 INT16 right, INT16 bottom )
349 return Ellipse( HDC_32(hdc), left, top, right, bottom );
353 /**********************************************************************
354 * FloodFill (GDI.25)
356 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
358 return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
362 /***********************************************************************
363 * Pie (GDI.26)
365 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
366 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
367 INT16 xend, INT16 yend )
369 return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
373 /***********************************************************************
374 * Rectangle (GDI.27)
376 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
377 INT16 right, INT16 bottom )
379 return Rectangle( HDC_32(hdc), left, top, right, bottom );
383 /***********************************************************************
384 * RoundRect (GDI.28)
386 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
387 INT16 bottom, INT16 ell_width, INT16 ell_height )
389 return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
393 /***********************************************************************
394 * PatBlt (GDI.29)
396 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
397 INT16 width, INT16 height, DWORD rop)
399 return PatBlt( HDC_32(hdc), left, top, width, height, rop );
403 /***********************************************************************
404 * SaveDC (GDI.30)
406 INT16 WINAPI SaveDC16( HDC16 hdc )
408 return SaveDC( HDC_32(hdc) );
412 /***********************************************************************
413 * SetPixel (GDI.31)
415 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
417 return SetPixel( HDC_32(hdc), x, y, color );
421 /***********************************************************************
422 * OffsetClipRgn (GDI.32)
424 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
426 return OffsetClipRgn( HDC_32(hdc), x, y );
430 /***********************************************************************
431 * TextOut (GDI.33)
433 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
435 return TextOutA( HDC_32(hdc), x, y, str, count );
439 /***********************************************************************
440 * BitBlt (GDI.34)
442 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
443 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
444 DWORD rop )
446 return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
450 /***********************************************************************
451 * StretchBlt (GDI.35)
453 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
454 INT16 widthDst, INT16 heightDst,
455 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
456 INT16 widthSrc, INT16 heightSrc, DWORD rop )
458 return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
459 HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
463 /**********************************************************************
464 * Polygon (GDI.36)
466 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
468 register int i;
469 BOOL ret;
470 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
471 count*sizeof(POINT) );
473 if (!pt32) return FALSE;
474 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
475 ret = Polygon(HDC_32(hdc),pt32,count);
476 HeapFree( GetProcessHeap(), 0, pt32 );
477 return ret;
481 /**********************************************************************
482 * Polyline (GDI.37)
484 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
486 register int i;
487 BOOL16 ret;
488 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
489 count*sizeof(POINT) );
491 if (!pt32) return FALSE;
492 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
493 ret = Polyline(HDC_32(hdc),pt32,count);
494 HeapFree( GetProcessHeap(), 0, pt32 );
495 return ret;
499 /***********************************************************************
500 * Escape (GDI.38)
502 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
504 INT ret;
506 switch(escape)
508 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
509 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
510 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
511 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
512 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
513 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
514 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
515 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
516 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
517 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
518 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
519 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
520 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
521 case CLIP_TO_PATH:
522 case DRAFTMODE:
523 case ENUMPAPERBINS:
524 case EPSPRINTING:
525 case EXT_DEVICE_CAPS:
526 case GETCOLORTABLE:
527 case MOUSETRAILS:
528 case POSTSCRIPT_IGNORE:
529 case QUERYESCSUPPORT:
530 case SET_ARC_DIRECTION:
531 case SET_POLY_MODE:
532 case SET_SCREEN_ANGLE:
533 case SET_SPREAD:
535 INT16 *ptr = MapSL(in_data);
536 INT data = *ptr;
537 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
540 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
541 case ENABLEDUPLEX:
543 UINT16 *ptr = MapSL(in_data);
544 UINT data = *ptr;
545 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
548 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
549 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
550 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
551 case GETPHYSPAGESIZE:
552 case GETPRINTINGOFFSET:
553 case GETSCALINGFACTOR:
555 POINT16 *ptr = out_data;
556 POINT pt32;
557 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
558 ptr->x = pt32.x;
559 ptr->y = pt32.y;
560 return ret;
563 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
564 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
565 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
566 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
567 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
568 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
569 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
570 case ENABLEPAIRKERNING:
571 case ENABLERELATIVEWIDTHS:
572 case SETCOPYCOUNT:
573 case SETKERNTRACK:
574 case SETLINECAP:
575 case SETLINEJOIN:
576 case SETMITERLIMIT:
578 INT16 *new = MapSL(in_data);
579 INT16 *old = out_data;
580 INT out, in = *new;
581 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
582 *old = out;
583 return ret;
586 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
587 case SETABORTPROC:
588 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
590 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
591 * lpvOutData is actually a pointer to the DocInfo structure and used as
592 * a second input parameter */
593 case STARTDOC:
594 if (out_data)
596 ret = StartDoc16( hdc, out_data );
597 if (ret > 0) ret = StartPage( HDC_32(hdc) );
598 return ret;
600 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
602 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
603 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
604 case SET_BOUNDS:
605 case SET_CLIP_BOX:
607 RECT16 *rc16 = MapSL(in_data);
608 RECT rc;
609 rc.left = rc16->left;
610 rc.top = rc16->top;
611 rc.right = rc16->right;
612 rc.bottom = rc16->bottom;
613 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
616 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
617 case NEXTBAND:
619 RECT rc;
620 RECT16 *rc16 = out_data;
621 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
622 rc16->left = rc.left;
623 rc16->top = rc.top;
624 rc16->right = rc.right;
625 rc16->bottom = rc.bottom;
626 return ret;
629 /* Escape(hdc,ABORTDOC,NULL,NULL); */
630 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
631 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
632 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
633 /* Escape(hdc,ENDDOC,NULL,NULL); */
634 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
635 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
636 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
637 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
638 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
639 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
640 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
641 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
642 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
643 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
644 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
645 /* Escape(hdc,NEWFRAME,NULL,NULL); */
646 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
647 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
648 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
649 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
650 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
651 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
652 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
653 case ABORTDOC:
654 case BANDINFO:
655 case BEGIN_PATH:
656 case DRAWPATTERNRECT:
657 case ENDDOC:
658 case END_PATH:
659 case EXTTEXTOUT:
660 case FLUSHOUTPUT:
661 case GETFACENAME:
662 case GETPAIRKERNTABLE:
663 case GETSETPAPERBINS:
664 case GETSETPRINTORIENT:
665 case GETSETSCREENPARAMS:
666 case GETTECHNOLOGY:
667 case GETTRACKKERNTABLE:
668 case MFCOMMENT:
669 case NEWFRAME:
670 case PASSTHROUGH:
671 case RESTORE_CTM:
672 case SAVE_CTM:
673 case SETALLJUSTVALUES:
674 case SETCOLORTABLE:
675 case SET_BACKGROUND_COLOR:
676 case TRANSFORM_CTM:
677 /* pass it unmodified to the 32-bit function */
678 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
680 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
681 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
682 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
683 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
684 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
685 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
686 case ENUMPAPERMETRICS:
687 case GETEXTENDEDTEXTMETRICS:
688 case GETEXTENTTABLE:
689 case GETSETPAPERMETRICS:
690 case GETVECTORBRUSHSIZE:
691 case GETVECTORPENSIZE:
692 default:
693 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
694 escape, in_count, MapSL(in_data), out_data );
695 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
700 /***********************************************************************
701 * RestoreDC (GDI.39)
703 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
705 return RestoreDC( HDC_32(hdc), level );
709 /***********************************************************************
710 * FillRgn (GDI.40)
712 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
714 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
718 /***********************************************************************
719 * FrameRgn (GDI.41)
721 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
722 INT16 nWidth, INT16 nHeight )
724 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
728 /***********************************************************************
729 * InvertRgn (GDI.42)
731 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
733 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
737 /***********************************************************************
738 * PaintRgn (GDI.43)
740 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
742 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
746 /***********************************************************************
747 * SelectClipRgn (GDI.44)
749 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
751 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
755 /***********************************************************************
756 * SelectObject (GDI.45)
758 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
760 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
764 /***********************************************************************
765 * CombineRgn (GDI.47)
767 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
769 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
773 /***********************************************************************
774 * CreateBitmap (GDI.48)
776 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
777 UINT16 bpp, LPCVOID bits )
779 return HBITMAP_16( CreateBitmap( width, height, planes, bpp, bits ) );
783 /***********************************************************************
784 * CreateBitmapIndirect (GDI.49)
786 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
788 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
789 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
793 /***********************************************************************
794 * CreateBrushIndirect (GDI.50)
796 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
798 LOGBRUSH brush32;
800 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
801 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
803 brush32.lbStyle = brush->lbStyle;
804 brush32.lbColor = brush->lbColor;
805 brush32.lbHatch = brush->lbHatch;
806 return HBRUSH_16( CreateBrushIndirect(&brush32) );
810 /***********************************************************************
811 * CreateCompatibleBitmap (GDI.51)
813 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
815 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
819 /***********************************************************************
820 * CreateCompatibleDC (GDI.52)
822 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
824 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
828 /***********************************************************************
829 * CreateDC (GDI.53)
831 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
832 const DEVMODEA *initData )
834 return HDC_16( CreateDCA( driver, device, output, initData ) );
838 /***********************************************************************
839 * CreateEllipticRgn (GDI.54)
841 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
843 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
847 /***********************************************************************
848 * CreateEllipticRgnIndirect (GDI.55)
850 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
852 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
856 /***********************************************************************
857 * CreateFont (GDI.56)
859 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
860 INT16 weight, BYTE italic, BYTE underline,
861 BYTE strikeout, BYTE charset, BYTE outpres,
862 BYTE clippres, BYTE quality, BYTE pitch,
863 LPCSTR name )
865 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
866 strikeout, charset, outpres, clippres, quality, pitch, name ));
869 /***********************************************************************
870 * CreateFontIndirect (GDI.57)
872 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
874 HFONT ret;
876 if (plf16)
878 LOGFONTW lfW;
879 logfont_16_to_W( plf16, &lfW );
880 ret = CreateFontIndirectW( &lfW );
882 else ret = CreateFontIndirectW( NULL );
883 return HFONT_16(ret);
887 /***********************************************************************
888 * CreateHatchBrush (GDI.58)
890 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
892 return HBRUSH_16( CreateHatchBrush( style, color ) );
896 /***********************************************************************
897 * CreatePatternBrush (GDI.60)
899 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
901 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
905 /***********************************************************************
906 * CreatePen (GDI.61)
908 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
910 LOGPEN logpen;
912 logpen.lopnStyle = style;
913 logpen.lopnWidth.x = width;
914 logpen.lopnWidth.y = 0;
915 logpen.lopnColor = color;
916 return HPEN_16( CreatePenIndirect( &logpen ) );
920 /***********************************************************************
921 * CreatePenIndirect (GDI.62)
923 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
925 LOGPEN logpen;
927 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
928 logpen.lopnStyle = pen->lopnStyle;
929 logpen.lopnWidth.x = pen->lopnWidth.x;
930 logpen.lopnWidth.y = pen->lopnWidth.y;
931 logpen.lopnColor = pen->lopnColor;
932 return HPEN_16( CreatePenIndirect( &logpen ) );
936 /***********************************************************************
937 * CreatePolygonRgn (GDI.63)
939 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
941 return CreatePolyPolygonRgn16( points, &count, 1, mode );
945 /***********************************************************************
946 * CreateRectRgn (GDI.64)
948 * NOTE: cf. SetRectRgn16
950 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
952 HRGN hrgn;
954 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
955 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
956 return HRGN_16(hrgn);
960 /***********************************************************************
961 * CreateRectRgnIndirect (GDI.65)
963 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
965 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
969 /***********************************************************************
970 * CreateSolidBrush (GDI.66)
972 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
974 return HBRUSH_16( CreateSolidBrush( color ) );
978 /***********************************************************************
979 * DeleteDC (GDI.68)
981 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
983 return DeleteDC( HDC_32(hdc) );
987 /***********************************************************************
988 * DeleteObject (GDI.69)
989 * SysDeleteObject (GDI.605)
991 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
993 return DeleteObject( HGDIOBJ_32(obj) );
997 /***********************************************************************
998 * EnumObjects (GDI.71)
1000 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1002 struct callback16_info info;
1004 info.proc = (FARPROC16)proc;
1005 info.param = lParam;
1006 switch(obj)
1008 case OBJ_PEN:
1009 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1010 case OBJ_BRUSH:
1011 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1013 return 0;
1017 /***********************************************************************
1018 * EqualRgn (GDI.72)
1020 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1022 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1026 /***********************************************************************
1027 * GetBitmapBits (GDI.74)
1029 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1031 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1035 /***********************************************************************
1036 * GetBkColor (GDI.75)
1038 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1040 return GetBkColor( HDC_32(hdc) );
1044 /***********************************************************************
1045 * GetBkMode (GDI.76)
1047 INT16 WINAPI GetBkMode16( HDC16 hdc )
1049 return GetBkMode( HDC_32(hdc) );
1053 /***********************************************************************
1054 * GetClipBox (GDI.77)
1056 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1058 RECT rect32;
1059 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1061 if (ret != ERROR)
1063 rect->left = rect32.left;
1064 rect->top = rect32.top;
1065 rect->right = rect32.right;
1066 rect->bottom = rect32.bottom;
1068 return ret;
1072 /***********************************************************************
1073 * GetCurrentPosition (GDI.78)
1075 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1077 POINT pt32;
1078 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1079 return MAKELONG( pt32.x, pt32.y );
1083 /***********************************************************************
1084 * GetDCOrg (GDI.79)
1086 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1088 POINT pt;
1089 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1090 return 0;
1094 /***********************************************************************
1095 * GetDeviceCaps (GDI.80)
1097 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1099 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1100 /* some apps don't expect -1 and think it's a B&W screen */
1101 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1102 return ret;
1106 /***********************************************************************
1107 * GetMapMode (GDI.81)
1109 INT16 WINAPI GetMapMode16( HDC16 hdc )
1111 return GetMapMode( HDC_32(hdc) );
1115 /***********************************************************************
1116 * GetPixel (GDI.83)
1118 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1120 return GetPixel( HDC_32(hdc), x, y );
1124 /***********************************************************************
1125 * GetPolyFillMode (GDI.84)
1127 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1129 return GetPolyFillMode( HDC_32(hdc) );
1133 /***********************************************************************
1134 * GetROP2 (GDI.85)
1136 INT16 WINAPI GetROP216( HDC16 hdc )
1138 return GetROP2( HDC_32(hdc) );
1142 /***********************************************************************
1143 * GetRelAbs (GDI.86)
1145 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1147 return GetRelAbs( HDC_32(hdc), 0 );
1151 /***********************************************************************
1152 * GetStockObject (GDI.87)
1154 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1156 return HGDIOBJ_16( GetStockObject( obj ) );
1160 /***********************************************************************
1161 * GetStretchBltMode (GDI.88)
1163 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1165 return GetStretchBltMode( HDC_32(hdc) );
1169 /***********************************************************************
1170 * GetTextCharacterExtra (GDI.89)
1172 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1174 return GetTextCharacterExtra( HDC_32(hdc) );
1178 /***********************************************************************
1179 * GetTextColor (GDI.90)
1181 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1183 return GetTextColor( HDC_32(hdc) );
1187 /***********************************************************************
1188 * GetTextExtent (GDI.91)
1190 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1192 SIZE size;
1193 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1194 return MAKELONG( size.cx, size.cy );
1198 /***********************************************************************
1199 * GetTextFace (GDI.92)
1201 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1203 return GetTextFaceA( HDC_32(hdc), count, name );
1207 /***********************************************************************
1208 * GetTextMetrics (GDI.93)
1210 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1212 TEXTMETRICW tm32;
1214 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1216 tm->tmHeight = tm32.tmHeight;
1217 tm->tmAscent = tm32.tmAscent;
1218 tm->tmDescent = tm32.tmDescent;
1219 tm->tmInternalLeading = tm32.tmInternalLeading;
1220 tm->tmExternalLeading = tm32.tmExternalLeading;
1221 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1222 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1223 tm->tmWeight = tm32.tmWeight;
1224 tm->tmOverhang = tm32.tmOverhang;
1225 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1226 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1227 tm->tmFirstChar = tm32.tmFirstChar;
1228 tm->tmLastChar = tm32.tmLastChar;
1229 tm->tmDefaultChar = tm32.tmDefaultChar;
1230 tm->tmBreakChar = tm32.tmBreakChar;
1231 tm->tmItalic = tm32.tmItalic;
1232 tm->tmUnderlined = tm32.tmUnderlined;
1233 tm->tmStruckOut = tm32.tmStruckOut;
1234 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1235 tm->tmCharSet = tm32.tmCharSet;
1236 return TRUE;
1240 /***********************************************************************
1241 * GetViewportExt (GDI.94)
1243 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1245 SIZE size;
1246 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1247 return MAKELONG( size.cx, size.cy );
1251 /***********************************************************************
1252 * GetViewportOrg (GDI.95)
1254 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1256 POINT pt;
1257 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1258 return MAKELONG( pt.x, pt.y );
1262 /***********************************************************************
1263 * GetWindowExt (GDI.96)
1265 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1267 SIZE size;
1268 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1269 return MAKELONG( size.cx, size.cy );
1273 /***********************************************************************
1274 * GetWindowOrg (GDI.97)
1276 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1278 POINT pt;
1279 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1280 return MAKELONG( pt.x, pt.y );
1286 /**********************************************************************
1287 * LineDDA (GDI.100)
1289 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1290 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1292 struct callback16_info info;
1293 info.proc = (FARPROC16)proc;
1294 info.param = lParam;
1295 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1299 /***********************************************************************
1300 * OffsetRgn (GDI.101)
1302 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1304 return OffsetRgn( HRGN_32(hrgn), x, y );
1308 /***********************************************************************
1309 * PtVisible (GDI.103)
1311 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1313 return PtVisible( HDC_32(hdc), x, y );
1317 /***********************************************************************
1318 * SetBitmapBits (GDI.106)
1320 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1322 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1326 /***********************************************************************
1327 * AddFontResource (GDI.119)
1329 INT16 WINAPI AddFontResource16( LPCSTR filename )
1331 return AddFontResourceA( filename );
1335 /***********************************************************************
1336 * Death (GDI.121)
1338 * Disables GDI, switches back to text mode.
1339 * We don't have to do anything here,
1340 * just let console support handle everything
1342 void WINAPI Death16(HDC16 hdc)
1344 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1348 /***********************************************************************
1349 * Resurrection (GDI.122)
1351 * Restores GDI functionality
1353 void WINAPI Resurrection16(HDC16 hdc,
1354 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1356 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1357 hdc, w1, w2, w3, w4, w5, w6);
1361 /**********************************************************************
1362 * CreateMetaFile (GDI.125)
1364 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1366 return HDC_16( CreateMetaFileA( filename ) );
1370 /***********************************************************************
1371 * MulDiv (GDI.128)
1373 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1375 INT ret;
1376 if (!nDivisor) return -32768;
1377 /* We want to deal with a positive divisor to simplify the logic. */
1378 if (nDivisor < 0)
1380 nMultiplicand = - nMultiplicand;
1381 nDivisor = -nDivisor;
1383 /* If the result is positive, we "add" to round. else,
1384 * we subtract to round. */
1385 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1386 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1387 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1388 else
1389 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1390 if ((ret > 32767) || (ret < -32767)) return -32768;
1391 return (INT16) ret;
1395 /***********************************************************************
1396 * GetRgnBox (GDI.134)
1398 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1400 RECT r;
1401 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1402 CONV_RECT32TO16( &r, rect );
1403 return ret;
1407 /***********************************************************************
1408 * RemoveFontResource (GDI.136)
1410 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1412 return RemoveFontResourceA(str);
1416 /***********************************************************************
1417 * SetBrushOrg (GDI.148)
1419 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1421 POINT pt;
1423 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1424 return MAKELONG( pt.x, pt.y );
1428 /***********************************************************************
1429 * GetBrushOrg (GDI.149)
1431 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1433 POINT pt;
1434 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1435 return MAKELONG( pt.x, pt.y );
1439 /***********************************************************************
1440 * UnrealizeObject (GDI.150)
1442 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1444 return UnrealizeObject( HGDIOBJ_32(obj) );
1448 /***********************************************************************
1449 * CreateIC (GDI.153)
1451 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1452 const DEVMODEA* initData )
1454 return HDC_16( CreateICA( driver, device, output, initData ) );
1458 /***********************************************************************
1459 * GetNearestColor (GDI.154)
1461 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1463 return GetNearestColor( HDC_32(hdc), color );
1467 /***********************************************************************
1468 * CreateDiscardableBitmap (GDI.156)
1470 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1472 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1476 /***********************************************************************
1477 * PtInRegion (GDI.161)
1479 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1481 return PtInRegion( HRGN_32(hrgn), x, y );
1485 /***********************************************************************
1486 * GetBitmapDimension (GDI.162)
1488 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1490 SIZE16 size;
1491 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1492 return MAKELONG( size.cx, size.cy );
1496 /***********************************************************************
1497 * SetBitmapDimension (GDI.163)
1499 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1501 SIZE16 size;
1502 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1503 return MAKELONG( size.cx, size.cy );
1507 /***********************************************************************
1508 * SetRectRgn (GDI.172)
1510 * NOTE: Win 3.1 sets region to empty if left > right
1512 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1514 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1515 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1519 /******************************************************************
1520 * PlayMetaFileRecord (GDI.176)
1522 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1524 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1525 unsigned int i;
1527 for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1528 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1529 for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1530 HeapFree( GetProcessHeap(), 0, ht32 );
1534 /***********************************************************************
1535 * GetCharABCWidths (GDI.307)
1537 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1539 BOOL ret;
1540 UINT i;
1541 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1543 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1545 for (i = firstChar; i <= lastChar; i++)
1547 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1548 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1549 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1552 HeapFree( GetProcessHeap(), 0, abc32 );
1553 return ret;
1557 /***********************************************************************
1558 * CreateScalableFontResource (GDI.310)
1560 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1561 LPCSTR fontFile, LPCSTR path )
1563 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1567 /*************************************************************************
1568 * GetFontData (GDI.311)
1571 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1573 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1577 /*************************************************************************
1578 * GetRasterizerCaps (GDI.313)
1580 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1582 return GetRasterizerCaps( lprs, cbNumBytes );
1586 /*************************************************************************
1587 * GetKerningPairs (GDI.332)
1590 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1592 KERNINGPAIR *pairs32;
1593 INT i, ret;
1595 if (!count) return 0;
1597 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1598 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1600 for (i = 0; i < ret; i++)
1602 pairs->wFirst = pairs32->wFirst;
1603 pairs->wSecond = pairs32->wSecond;
1604 pairs->iKernAmount = pairs32->iKernAmount;
1607 HeapFree( GetProcessHeap(), 0, pairs32 );
1608 return ret;
1613 /***********************************************************************
1614 * GetTextAlign (GDI.345)
1616 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1618 return GetTextAlign( HDC_32(hdc) );
1622 /***********************************************************************
1623 * SetTextAlign (GDI.346)
1625 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1627 return SetTextAlign( HDC_32(hdc), align );
1631 /***********************************************************************
1632 * Chord (GDI.348)
1634 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1635 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1636 INT16 xend, INT16 yend )
1638 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1642 /***********************************************************************
1643 * SetMapperFlags (GDI.349)
1645 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1647 return SetMapperFlags( HDC_32(hdc), flags );
1651 /***********************************************************************
1652 * GetCharWidth (GDI.350)
1654 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
1656 BOOL retVal = FALSE;
1658 if( firstChar != lastChar )
1660 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
1661 if( buf32 )
1663 LPINT obuf32 = buf32;
1664 int i;
1666 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
1667 if (retVal)
1669 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
1671 HeapFree(GetProcessHeap(), 0, obuf32);
1674 else /* happens quite often to warrant a special treatment */
1676 INT chWidth;
1677 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
1678 *buffer = chWidth;
1680 return retVal;
1684 /***********************************************************************
1685 * ExtTextOut (GDI.351)
1687 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
1688 const RECT16 *lprect, LPCSTR str, UINT16 count,
1689 const INT16 *lpDx )
1691 BOOL ret;
1692 int i;
1693 RECT rect32;
1694 LPINT lpdx32 = NULL;
1696 if (lpDx) {
1697 lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
1698 if(lpdx32 == NULL) return FALSE;
1699 for (i=count;i--;) lpdx32[i]=lpDx[i];
1701 if (lprect) CONV_RECT16TO32(lprect,&rect32);
1702 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
1703 if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
1704 return ret;
1708 /***********************************************************************
1709 * CreatePalette (GDI.360)
1711 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
1713 return HPALETTE_16( CreatePalette( palette ) );
1717 /***********************************************************************
1718 * GDISelectPalette (GDI.361)
1720 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
1722 return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
1726 /***********************************************************************
1727 * GDIRealizePalette (GDI.362)
1729 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
1731 return GDIRealizePalette( HDC_32(hdc) );
1735 /***********************************************************************
1736 * GetPaletteEntries (GDI.363)
1738 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1739 UINT16 count, LPPALETTEENTRY entries )
1741 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1745 /***********************************************************************
1746 * SetPaletteEntries (GDI.364)
1748 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1749 UINT16 count, const PALETTEENTRY *entries )
1751 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1755 /**********************************************************************
1756 * UpdateColors (GDI.366)
1758 INT16 WINAPI UpdateColors16( HDC16 hdc )
1760 UpdateColors( HDC_32(hdc) );
1761 return TRUE;
1765 /***********************************************************************
1766 * AnimatePalette (GDI.367)
1768 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
1769 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
1771 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
1775 /***********************************************************************
1776 * ResizePalette (GDI.368)
1778 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
1780 return ResizePalette( HPALETTE_32(hpalette), cEntries );
1784 /***********************************************************************
1785 * GetNearestPaletteIndex (GDI.370)
1787 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
1789 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
1793 /**********************************************************************
1794 * ExtFloodFill (GDI.372)
1796 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
1797 UINT16 fillType )
1799 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
1803 /***********************************************************************
1804 * SetSystemPaletteUse (GDI.373)
1806 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
1808 return SetSystemPaletteUse( HDC_32(hdc), use );
1812 /***********************************************************************
1813 * GetSystemPaletteUse (GDI.374)
1815 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
1817 return GetSystemPaletteUse( HDC_32(hdc) );
1821 /***********************************************************************
1822 * GetSystemPaletteEntries (GDI.375)
1824 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
1825 LPPALETTEENTRY entries )
1827 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
1831 /***********************************************************************
1832 * ResetDC (GDI.376)
1834 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
1836 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
1840 /******************************************************************
1841 * StartDoc (GDI.377)
1843 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
1845 DOCINFOA docA;
1847 docA.cbSize = lpdoc->cbSize;
1848 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
1849 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
1850 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
1851 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
1852 else
1853 docA.lpszDatatype = NULL;
1854 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
1855 docA.fwType = lpdoc->fwType;
1856 else
1857 docA.fwType = 0;
1858 return StartDocA( HDC_32(hdc), &docA );
1862 /******************************************************************
1863 * EndDoc (GDI.378)
1865 INT16 WINAPI EndDoc16( HDC16 hdc )
1867 return EndDoc( HDC_32(hdc) );
1871 /******************************************************************
1872 * StartPage (GDI.379)
1874 INT16 WINAPI StartPage16( HDC16 hdc )
1876 return StartPage( HDC_32(hdc) );
1880 /******************************************************************
1881 * EndPage (GDI.380)
1883 INT16 WINAPI EndPage16( HDC16 hdc )
1885 return EndPage( HDC_32(hdc) );
1889 /******************************************************************************
1890 * AbortDoc (GDI.382)
1892 INT16 WINAPI AbortDoc16( HDC16 hdc )
1894 return AbortDoc( HDC_32(hdc) );
1898 /***********************************************************************
1899 * FastWindowFrame (GDI.400)
1901 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
1902 INT16 width, INT16 height, DWORD rop )
1904 HDC hdc32 = HDC_32(hdc);
1905 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
1906 PatBlt( hdc32, rect->left, rect->top,
1907 rect->right - rect->left - width, height, rop );
1908 PatBlt( hdc32, rect->left, rect->top + height, width,
1909 rect->bottom - rect->top - height, rop );
1910 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
1911 rect->right - rect->left - width, -height, rop );
1912 PatBlt( hdc32, rect->right - 1, rect->top, -width,
1913 rect->bottom - rect->top - height, rop );
1914 SelectObject( hdc32, hbrush );
1915 return TRUE;
1919 /***********************************************************************
1920 * CreateUserBitmap (GDI.407)
1922 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
1923 UINT16 bpp, LPCVOID bits )
1925 return CreateBitmap16( width, height, planes, bpp, bits );
1929 /***********************************************************************
1930 * CreateUserDiscardableBitmap (GDI.409)
1932 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
1934 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
1935 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
1936 DeleteDC( hdc );
1937 return HBITMAP_16(ret);
1941 /***********************************************************************
1942 * GetCurLogFont (GDI.411)
1944 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
1946 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
1950 /***********************************************************************
1951 * StretchDIBits (GDI.439)
1953 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
1954 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
1955 INT16 heightSrc, const VOID *bits,
1956 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
1958 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
1959 xSrc, ySrc, widthSrc, heightSrc, bits,
1960 info, wUsage, dwRop );
1964 /***********************************************************************
1965 * SetDIBits (GDI.440)
1967 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1968 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
1969 UINT16 coloruse )
1971 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
1975 /***********************************************************************
1976 * GetDIBits (GDI.441)
1978 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
1979 UINT16 lines, LPVOID bits, BITMAPINFO * info,
1980 UINT16 coloruse )
1982 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
1986 /***********************************************************************
1987 * CreateDIBitmap (GDI.442)
1989 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
1990 DWORD init, LPCVOID bits, const BITMAPINFO * data,
1991 UINT16 coloruse )
1993 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
1997 /***********************************************************************
1998 * SetDIBitsToDevice (GDI.443)
2000 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2001 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2002 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2003 UINT16 coloruse )
2005 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2006 startscan, lines, bits, info, coloruse );
2010 /***********************************************************************
2011 * CreateRoundRectRgn (GDI.444)
2013 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2014 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2015 * we just let CreateRoundRectRgn convert them to +ve values.
2018 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2019 INT16 ellipse_width, INT16 ellipse_height )
2021 if( ellipse_width == 0 || ellipse_height == 0 )
2022 return CreateRectRgn16( left, top, right, bottom );
2023 else
2024 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2025 ellipse_width, ellipse_height ));
2029 /***********************************************************************
2030 * CreateDIBPatternBrush (GDI.445)
2032 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2034 BITMAPINFO *bmi;
2035 HBRUSH16 ret;
2037 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2038 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2039 GlobalUnlock16( hbitmap );
2040 return ret;
2044 /**********************************************************************
2045 * PolyPolygon (GDI.450)
2047 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2048 UINT16 polygons )
2050 int i,nrpts;
2051 LPPOINT pt32;
2052 LPINT counts32;
2053 BOOL16 ret;
2055 nrpts=0;
2056 for (i=polygons;i--;)
2057 nrpts+=counts[i];
2058 pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2059 if(pt32 == NULL) return FALSE;
2060 for (i=nrpts;i--;)
2061 CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
2062 counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2063 if(counts32 == NULL) {
2064 HeapFree( GetProcessHeap(), 0, pt32 );
2065 return FALSE;
2067 for (i=polygons;i--;) counts32[i]=counts[i];
2069 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2070 HeapFree( GetProcessHeap(), 0, counts32 );
2071 HeapFree( GetProcessHeap(), 0, pt32 );
2072 return ret;
2076 /***********************************************************************
2077 * CreatePolyPolygonRgn (GDI.451)
2079 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2080 const INT16 *count, INT16 nbpolygons, INT16 mode )
2082 HRGN hrgn;
2083 int i, npts = 0;
2084 INT *count32;
2085 POINT *points32;
2087 for (i = 0; i < nbpolygons; i++) npts += count[i];
2088 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2089 for (i = 0; i < npts; i++) CONV_POINT16TO32( &(points[i]), &(points32[i]) );
2091 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2092 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2093 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2094 HeapFree( GetProcessHeap(), 0, count32 );
2095 HeapFree( GetProcessHeap(), 0, points32 );
2096 return HRGN_16(hrgn);
2100 /***********************************************************************
2101 * SetObjectOwner (GDI.461)
2103 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2105 /* Nothing to do */
2109 /***********************************************************************
2110 * RectVisible (GDI.465)
2111 * RectVisibleOld (GDI.104)
2113 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2115 RECT rect;
2116 CONV_RECT16TO32( rect16, &rect );
2117 return RectVisible( HDC_32(hdc), &rect );
2121 /***********************************************************************
2122 * RectInRegion (GDI.466)
2123 * RectInRegionOld (GDI.181)
2125 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2127 RECT r32;
2129 CONV_RECT16TO32(rect, &r32);
2130 return RectInRegion( HRGN_32(hrgn), &r32 );
2134 /***********************************************************************
2135 * GetBitmapDimensionEx (GDI.468)
2137 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2139 SIZE size32;
2140 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2142 if (ret)
2144 size->cx = size32.cx;
2145 size->cy = size32.cy;
2147 return ret;
2151 /***********************************************************************
2152 * GetBrushOrgEx (GDI.469)
2154 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2156 POINT pt32;
2157 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2158 pt->x = pt32.x;
2159 pt->y = pt32.y;
2160 return TRUE;
2164 /***********************************************************************
2165 * GetCurrentPositionEx (GDI.470)
2167 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2169 POINT pt32;
2170 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2171 pt->x = pt32.x;
2172 pt->y = pt32.y;
2173 return TRUE;
2177 /***********************************************************************
2178 * GetTextExtentPoint (GDI.471)
2180 * FIXME: Should this have a bug for compatibility?
2181 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2182 * bugs (-> MSDN KB q147647.txt).
2184 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2186 SIZE size32;
2187 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2189 if (ret)
2191 size->cx = size32.cx;
2192 size->cy = size32.cy;
2194 return ret;
2198 /***********************************************************************
2199 * GetViewportExtEx (GDI.472)
2201 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2203 SIZE size32;
2204 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2205 size->cx = size32.cx;
2206 size->cy = size32.cy;
2207 return TRUE;
2211 /***********************************************************************
2212 * GetViewportOrgEx (GDI.473)
2214 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2216 POINT pt32;
2217 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2218 pt->x = pt32.x;
2219 pt->y = pt32.y;
2220 return TRUE;
2224 /***********************************************************************
2225 * GetWindowExtEx (GDI.474)
2227 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2229 SIZE size32;
2230 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2231 size->cx = size32.cx;
2232 size->cy = size32.cy;
2233 return TRUE;
2237 /***********************************************************************
2238 * GetWindowOrgEx (GDI.475)
2240 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2242 POINT pt32;
2243 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2244 pt->x = pt32.x;
2245 pt->y = pt32.y;
2246 return TRUE;
2250 /***********************************************************************
2251 * OffsetViewportOrgEx (GDI.476)
2253 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2255 POINT pt32;
2256 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2257 if (pt) CONV_POINT32TO16( &pt32, pt );
2258 return ret;
2262 /***********************************************************************
2263 * OffsetWindowOrgEx (GDI.477)
2265 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2267 POINT pt32;
2268 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2269 if (pt) CONV_POINT32TO16( &pt32, pt );
2270 return ret;
2274 /***********************************************************************
2275 * SetBitmapDimensionEx (GDI.478)
2277 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2279 SIZE size32;
2280 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2282 if (ret && prevSize)
2284 prevSize->cx = size32.cx;
2285 prevSize->cy = size32.cy;
2287 return ret;
2291 /***********************************************************************
2292 * SetViewportExtEx (GDI.479)
2294 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2296 SIZE size32;
2297 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2298 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2299 return ret;
2303 /***********************************************************************
2304 * SetViewportOrgEx (GDI.480)
2306 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2308 POINT pt32;
2309 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2310 if (pt) CONV_POINT32TO16( &pt32, pt );
2311 return ret;
2315 /***********************************************************************
2316 * SetWindowExtEx (GDI.481)
2318 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2320 SIZE size32;
2321 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2322 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2323 return ret;
2327 /***********************************************************************
2328 * SetWindowOrgEx (GDI.482)
2330 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2332 POINT pt32;
2333 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2334 if (pt) CONV_POINT32TO16( &pt32, pt );
2335 return ret;
2339 /***********************************************************************
2340 * MoveToEx (GDI.483)
2342 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2344 POINT pt32;
2346 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2347 if (pt) CONV_POINT32TO16( &pt32, pt );
2348 return TRUE;
2352 /***********************************************************************
2353 * ScaleViewportExtEx (GDI.484)
2355 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2356 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2358 SIZE size32;
2359 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2360 &size32 );
2361 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2362 return ret;
2366 /***********************************************************************
2367 * ScaleWindowExtEx (GDI.485)
2369 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2370 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2372 SIZE size32;
2373 BOOL16 ret = ScaleWindowExtEx( 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 * PolyBezier (GDI.502)
2383 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2385 int i;
2386 BOOL16 ret;
2387 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2388 cPoints*sizeof(POINT) );
2389 if(!pt32) return FALSE;
2390 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2391 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2392 HeapFree( GetProcessHeap(), 0, pt32 );
2393 return ret;
2397 /******************************************************************************
2398 * PolyBezierTo (GDI.503)
2400 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2402 int i;
2403 BOOL16 ret;
2404 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2405 cPoints*sizeof(POINT) );
2406 if(!pt32) return FALSE;
2407 for (i=cPoints;i--;) CONV_POINT16TO32(&(lppt[i]),&(pt32[i]));
2408 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2409 HeapFree( GetProcessHeap(), 0, pt32 );
2410 return ret;
2414 /******************************************************************************
2415 * ExtSelectClipRgn (GDI.508)
2417 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2419 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2423 /***********************************************************************
2424 * AbortPath (GDI.511)
2426 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2428 return AbortPath( HDC_32(hdc) );
2432 /***********************************************************************
2433 * BeginPath (GDI.512)
2435 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2437 return BeginPath( HDC_32(hdc) );
2441 /***********************************************************************
2442 * CloseFigure (GDI.513)
2444 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2446 return CloseFigure( HDC_32(hdc) );
2450 /***********************************************************************
2451 * EndPath (GDI.514)
2453 BOOL16 WINAPI EndPath16(HDC16 hdc)
2455 return EndPath( HDC_32(hdc) );
2459 /***********************************************************************
2460 * FillPath (GDI.515)
2462 BOOL16 WINAPI FillPath16(HDC16 hdc)
2464 return FillPath( HDC_32(hdc) );
2468 /*******************************************************************
2469 * FlattenPath (GDI.516)
2471 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2473 return FlattenPath( HDC_32(hdc) );
2477 /***********************************************************************
2478 * GetPath (GDI.517)
2480 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2482 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2483 return 0;
2487 /***********************************************************************
2488 * PathToRegion (GDI.518)
2490 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2492 return HRGN_16( PathToRegion( HDC_32(hdc) ));
2496 /***********************************************************************
2497 * SelectClipPath (GDI.519)
2499 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2501 return SelectClipPath( HDC_32(hdc), iMode );
2505 /*******************************************************************
2506 * StrokeAndFillPath (GDI.520)
2508 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
2510 return StrokeAndFillPath( HDC_32(hdc) );
2514 /*******************************************************************
2515 * StrokePath (GDI.521)
2517 BOOL16 WINAPI StrokePath16(HDC16 hdc)
2519 return StrokePath( HDC_32(hdc) );
2523 /*******************************************************************
2524 * WidenPath (GDI.522)
2526 BOOL16 WINAPI WidenPath16(HDC16 hdc)
2528 return WidenPath( HDC_32(hdc) );
2532 /***********************************************************************
2533 * GetArcDirection (GDI.524)
2535 INT16 WINAPI GetArcDirection16( HDC16 hdc )
2537 return GetArcDirection( HDC_32(hdc) );
2541 /***********************************************************************
2542 * SetArcDirection (GDI.525)
2544 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
2546 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
2550 /***********************************************************************
2551 * CreateHalftonePalette (GDI.529)
2553 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
2555 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
2559 /***********************************************************************
2560 * SetDIBColorTable (GDI.602)
2562 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2564 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2568 /***********************************************************************
2569 * GetDIBColorTable (GDI.603)
2571 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2573 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2577 /***********************************************************************
2578 * GetRegionData (GDI.607)
2580 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2582 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
2584 return GetRegionData( HRGN_32(hrgn), count, rgndata );
2588 /***********************************************************************
2589 * GetTextCharset (GDI.612)
2591 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
2593 return GetTextCharset( HDC_32(hdc) );
2597 /*************************************************************************
2598 * GetFontLanguageInfo (GDI.616)
2600 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
2602 return GetFontLanguageInfo( HDC_32(hdc) );
2606 /***********************************************************************
2607 * SetLayout (GDI.1000)
2609 * Sets left->right or right->left text layout flags of a dc.
2611 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
2613 return SetLayout( HDC_32(hdc), layout );