Make wineoss's mixer know about DST_HEADPHONES, DST_LINE and
[wine/multimedia.git] / dlls / gdi / gdi16.c
blob1a478df0305d62b6c2f76a59a870b30d9834f2d1
1 /*
2 * GDI 16-bit functions
4 * Copyright 2002 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "wingdi.h"
26 #include "wownt32.h"
27 #include "wine/wingdi16.h"
28 #include "gdi.h"
29 #include "gdi_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
34 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
35 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
37 struct callback16_info
39 FARPROC16 proc;
40 LPARAM param;
43 /* callback for LineDDA16 */
44 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
46 const struct callback16_info *info = (struct callback16_info *)param;
47 WORD args[4];
49 args[3] = x;
50 args[2] = y;
51 args[1] = HIWORD(info->param);
52 args[0] = LOWORD(info->param);
53 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, NULL );
56 /* callback for EnumObjects16 */
57 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
59 const struct callback16_info *info = (struct callback16_info *)param;
60 LOGPEN *pen = ptr;
61 LOGPEN16 pen16;
62 SEGPTR segptr;
63 DWORD ret;
64 WORD args[4];
66 pen16.lopnStyle = pen->lopnStyle;
67 pen16.lopnWidth.x = pen->lopnWidth.x;
68 pen16.lopnWidth.y = pen->lopnWidth.y;
69 pen16.lopnColor = pen->lopnColor;
70 segptr = MapLS( &pen16 );
71 args[3] = SELECTOROF(segptr);
72 args[2] = OFFSETOF(segptr);
73 args[1] = HIWORD(info->param);
74 args[0] = LOWORD(info->param);
75 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
76 UnMapLS( segptr );
77 return LOWORD(ret);
80 /* callback for EnumObjects16 */
81 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
83 const struct callback16_info *info = (struct callback16_info *)param;
84 LOGBRUSH *brush = ptr;
85 LOGBRUSH16 brush16;
86 SEGPTR segptr;
87 DWORD ret;
88 WORD args[4];
90 brush16.lbStyle = brush->lbStyle;
91 brush16.lbColor = brush->lbColor;
92 brush16.lbHatch = brush->lbHatch;
93 segptr = MapLS( &brush16 );
94 args[3] = SELECTOROF(segptr);
95 args[2] = OFFSETOF(segptr);
96 args[1] = HIWORD(info->param);
97 args[0] = LOWORD(info->param);
98 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
99 UnMapLS( segptr );
100 return ret;
103 /* convert a LOGFONT16 to a LOGFONTW */
104 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
106 font32->lfHeight = font16->lfHeight;
107 font32->lfWidth = font16->lfWidth;
108 font32->lfEscapement = font16->lfEscapement;
109 font32->lfOrientation = font16->lfOrientation;
110 font32->lfWeight = font16->lfWeight;
111 font32->lfItalic = font16->lfItalic;
112 font32->lfUnderline = font16->lfUnderline;
113 font32->lfStrikeOut = font16->lfStrikeOut;
114 font32->lfCharSet = font16->lfCharSet;
115 font32->lfOutPrecision = font16->lfOutPrecision;
116 font32->lfClipPrecision = font16->lfClipPrecision;
117 font32->lfQuality = font16->lfQuality;
118 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
119 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
120 font32->lfFaceName[LF_FACESIZE-1] = 0;
124 /***********************************************************************
125 * SetBkColor (GDI.1)
127 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
129 return SetBkColor( HDC_32(hdc), color );
133 /***********************************************************************
134 * SetBkMode (GDI.2)
136 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
138 return SetBkMode( HDC_32(hdc), mode );
142 /***********************************************************************
143 * SetMapMode (GDI.3)
145 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
147 return SetMapMode( HDC_32(hdc), mode );
151 /***********************************************************************
152 * SetROP2 (GDI.4)
154 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
156 return SetROP2( HDC_32(hdc), mode );
160 /***********************************************************************
161 * SetRelAbs (GDI.5)
163 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
165 return SetRelAbs( HDC_32(hdc), mode );
169 /***********************************************************************
170 * SetPolyFillMode (GDI.6)
172 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
174 return SetPolyFillMode( HDC_32(hdc), mode );
178 /***********************************************************************
179 * SetStretchBltMode (GDI.7)
181 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
183 return SetStretchBltMode( HDC_32(hdc), mode );
187 /***********************************************************************
188 * SetTextCharacterExtra (GDI.8)
190 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
192 return SetTextCharacterExtra( HDC_32(hdc), extra );
196 /***********************************************************************
197 * SetTextColor (GDI.9)
199 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
201 return SetTextColor( HDC_32(hdc), color );
205 /***********************************************************************
206 * SetTextJustification (GDI.10)
208 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
210 return SetTextJustification( HDC_32(hdc), extra, breaks );
214 /***********************************************************************
215 * SetWindowOrg (GDI.11)
217 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
219 POINT pt;
220 if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
221 return MAKELONG( pt.x, pt.y );
225 /***********************************************************************
226 * SetWindowExt (GDI.12)
228 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
230 SIZE size;
231 if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
232 return MAKELONG( size.cx, size.cy );
236 /***********************************************************************
237 * SetViewportOrg (GDI.13)
239 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
241 POINT pt;
242 if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
243 return MAKELONG( pt.x, pt.y );
247 /***********************************************************************
248 * SetViewportExt (GDI.14)
250 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
252 SIZE size;
253 if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
254 return MAKELONG( size.cx, size.cy );
258 /***********************************************************************
259 * OffsetWindowOrg (GDI.15)
261 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
263 POINT pt;
264 if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
265 return MAKELONG( pt.x, pt.y );
269 /***********************************************************************
270 * ScaleWindowExt (GDI.16)
272 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
273 INT16 yNum, INT16 yDenom )
275 SIZE size;
276 if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
277 return FALSE;
278 return MAKELONG( size.cx, size.cy );
282 /***********************************************************************
283 * OffsetViewportOrg (GDI.17)
285 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
287 POINT pt;
288 if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
289 return MAKELONG( pt.x, pt.y );
293 /***********************************************************************
294 * ScaleViewportExt (GDI.18)
296 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
297 INT16 yNum, INT16 yDenom )
299 SIZE size;
300 if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
301 return FALSE;
302 return MAKELONG( size.cx, size.cy );
306 /***********************************************************************
307 * LineTo (GDI.19)
309 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
311 return LineTo( HDC_32(hdc), x, y );
315 /***********************************************************************
316 * MoveTo (GDI.20)
318 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
320 POINT pt;
322 if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
323 return MAKELONG(pt.x,pt.y);
327 /***********************************************************************
328 * ExcludeClipRect (GDI.21)
330 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
331 INT16 right, INT16 bottom )
333 return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
337 /***********************************************************************
338 * IntersectClipRect (GDI.22)
340 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
341 INT16 right, INT16 bottom )
343 return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
347 /***********************************************************************
348 * Arc (GDI.23)
350 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
351 INT16 bottom, INT16 xstart, INT16 ystart,
352 INT16 xend, INT16 yend )
354 return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
358 /***********************************************************************
359 * Ellipse (GDI.24)
361 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
362 INT16 right, INT16 bottom )
364 return Ellipse( HDC_32(hdc), left, top, right, bottom );
368 /**********************************************************************
369 * FloodFill (GDI.25)
371 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
373 return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
377 /***********************************************************************
378 * Pie (GDI.26)
380 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
381 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
382 INT16 xend, INT16 yend )
384 return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
388 /***********************************************************************
389 * Rectangle (GDI.27)
391 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
392 INT16 right, INT16 bottom )
394 return Rectangle( HDC_32(hdc), left, top, right, bottom );
398 /***********************************************************************
399 * RoundRect (GDI.28)
401 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
402 INT16 bottom, INT16 ell_width, INT16 ell_height )
404 return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
408 /***********************************************************************
409 * PatBlt (GDI.29)
411 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
412 INT16 width, INT16 height, DWORD rop)
414 return PatBlt( HDC_32(hdc), left, top, width, height, rop );
418 /***********************************************************************
419 * SaveDC (GDI.30)
421 INT16 WINAPI SaveDC16( HDC16 hdc )
423 return SaveDC( HDC_32(hdc) );
427 /***********************************************************************
428 * SetPixel (GDI.31)
430 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
432 return SetPixel( HDC_32(hdc), x, y, color );
436 /***********************************************************************
437 * OffsetClipRgn (GDI.32)
439 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
441 return OffsetClipRgn( HDC_32(hdc), x, y );
445 /***********************************************************************
446 * TextOut (GDI.33)
448 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
450 return TextOutA( HDC_32(hdc), x, y, str, count );
454 /***********************************************************************
455 * BitBlt (GDI.34)
457 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
458 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
459 DWORD rop )
461 return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
465 /***********************************************************************
466 * StretchBlt (GDI.35)
468 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
469 INT16 widthDst, INT16 heightDst,
470 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
471 INT16 widthSrc, INT16 heightSrc, DWORD rop )
473 return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
474 HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
478 /**********************************************************************
479 * Polygon (GDI.36)
481 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
483 register int i;
484 BOOL ret;
485 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
486 count*sizeof(POINT) );
488 if (!pt32) return FALSE;
489 for (i=count;i--;)
491 pt32[i].x = pt[i].x;
492 pt32[i].y = pt[i].y;
494 ret = Polygon(HDC_32(hdc),pt32,count);
495 HeapFree( GetProcessHeap(), 0, pt32 );
496 return ret;
500 /**********************************************************************
501 * Polyline (GDI.37)
503 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
505 register int i;
506 BOOL16 ret;
507 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
508 count*sizeof(POINT) );
510 if (!pt32) return FALSE;
511 for (i=count;i--;)
513 pt32[i].x = pt[i].x;
514 pt32[i].y = pt[i].y;
516 ret = Polyline(HDC_32(hdc),pt32,count);
517 HeapFree( GetProcessHeap(), 0, pt32 );
518 return ret;
522 /***********************************************************************
523 * Escape (GDI.38)
525 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
527 INT ret;
529 switch(escape)
531 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
532 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
533 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
534 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
535 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
536 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
537 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
538 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
539 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
540 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
541 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
542 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
543 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
544 case CLIP_TO_PATH:
545 case DRAFTMODE:
546 case ENUMPAPERBINS:
547 case EPSPRINTING:
548 case EXT_DEVICE_CAPS:
549 case GETCOLORTABLE:
550 case MOUSETRAILS:
551 case POSTSCRIPT_IGNORE:
552 case QUERYESCSUPPORT:
553 case SET_ARC_DIRECTION:
554 case SET_POLY_MODE:
555 case SET_SCREEN_ANGLE:
556 case SET_SPREAD:
558 INT16 *ptr = MapSL(in_data);
559 INT data = *ptr;
560 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
563 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
564 case ENABLEDUPLEX:
566 UINT16 *ptr = MapSL(in_data);
567 UINT data = *ptr;
568 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
571 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
572 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
573 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
574 case GETPHYSPAGESIZE:
575 case GETPRINTINGOFFSET:
576 case GETSCALINGFACTOR:
578 POINT16 *ptr = out_data;
579 POINT pt32;
580 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
581 ptr->x = pt32.x;
582 ptr->y = pt32.y;
583 return ret;
586 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
587 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
588 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
589 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
590 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
591 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
592 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
593 case ENABLEPAIRKERNING:
594 case ENABLERELATIVEWIDTHS:
595 case SETCOPYCOUNT:
596 case SETKERNTRACK:
597 case SETLINECAP:
598 case SETLINEJOIN:
599 case SETMITERLIMIT:
601 INT16 *new = MapSL(in_data);
602 INT16 *old = out_data;
603 INT out, in = *new;
604 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
605 *old = out;
606 return ret;
609 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
610 case SETABORTPROC:
611 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
613 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
614 * lpvOutData is actually a pointer to the DocInfo structure and used as
615 * a second input parameter */
616 case STARTDOC:
617 if (out_data)
619 ret = StartDoc16( hdc, out_data );
620 if (ret > 0) ret = StartPage( HDC_32(hdc) );
621 return ret;
623 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
625 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
626 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
627 case SET_BOUNDS:
628 case SET_CLIP_BOX:
630 RECT16 *rc16 = MapSL(in_data);
631 RECT rc;
632 rc.left = rc16->left;
633 rc.top = rc16->top;
634 rc.right = rc16->right;
635 rc.bottom = rc16->bottom;
636 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
639 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
640 case NEXTBAND:
642 RECT rc;
643 RECT16 *rc16 = out_data;
644 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
645 rc16->left = rc.left;
646 rc16->top = rc.top;
647 rc16->right = rc.right;
648 rc16->bottom = rc.bottom;
649 return ret;
652 /* Escape(hdc,ABORTDOC,NULL,NULL); */
653 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
654 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
655 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
656 /* Escape(hdc,ENDDOC,NULL,NULL); */
657 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
658 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
659 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
660 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
661 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
662 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
663 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
664 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
665 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
666 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
667 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
668 /* Escape(hdc,NEWFRAME,NULL,NULL); */
669 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
670 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
671 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
672 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
673 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
674 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
675 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
676 case ABORTDOC:
677 case BANDINFO:
678 case BEGIN_PATH:
679 case DRAWPATTERNRECT:
680 case ENDDOC:
681 case END_PATH:
682 case EXTTEXTOUT:
683 case FLUSHOUTPUT:
684 case GETFACENAME:
685 case GETPAIRKERNTABLE:
686 case GETSETPAPERBINS:
687 case GETSETPRINTORIENT:
688 case GETSETSCREENPARAMS:
689 case GETTECHNOLOGY:
690 case GETTRACKKERNTABLE:
691 case MFCOMMENT:
692 case NEWFRAME:
693 case PASSTHROUGH:
694 case RESTORE_CTM:
695 case SAVE_CTM:
696 case SETALLJUSTVALUES:
697 case SETCOLORTABLE:
698 case SET_BACKGROUND_COLOR:
699 case TRANSFORM_CTM:
700 /* pass it unmodified to the 32-bit function */
701 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
703 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
704 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
705 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
706 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
707 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
708 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
709 case ENUMPAPERMETRICS:
710 case GETEXTENDEDTEXTMETRICS:
711 case GETEXTENTTABLE:
712 case GETSETPAPERMETRICS:
713 case GETVECTORBRUSHSIZE:
714 case GETVECTORPENSIZE:
715 default:
716 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
717 escape, in_count, MapSL(in_data), out_data );
718 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
723 /***********************************************************************
724 * RestoreDC (GDI.39)
726 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
728 return RestoreDC( HDC_32(hdc), level );
732 /***********************************************************************
733 * FillRgn (GDI.40)
735 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
737 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
741 /***********************************************************************
742 * FrameRgn (GDI.41)
744 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
745 INT16 nWidth, INT16 nHeight )
747 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
751 /***********************************************************************
752 * InvertRgn (GDI.42)
754 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
756 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
760 /***********************************************************************
761 * PaintRgn (GDI.43)
763 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
765 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
769 /***********************************************************************
770 * SelectClipRgn (GDI.44)
772 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
774 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
778 /***********************************************************************
779 * SelectObject (GDI.45)
781 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
783 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
787 /***********************************************************************
788 * CombineRgn (GDI.47)
790 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
792 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
796 /***********************************************************************
797 * CreateBitmap (GDI.48)
799 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
800 UINT16 bpp, LPCVOID bits )
802 return HBITMAP_16( CreateBitmap( width, height, planes, bpp, bits ) );
806 /***********************************************************************
807 * CreateBitmapIndirect (GDI.49)
809 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
811 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
812 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
816 /***********************************************************************
817 * CreateBrushIndirect (GDI.50)
819 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
821 LOGBRUSH brush32;
823 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
824 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
826 brush32.lbStyle = brush->lbStyle;
827 brush32.lbColor = brush->lbColor;
828 brush32.lbHatch = brush->lbHatch;
829 return HBRUSH_16( CreateBrushIndirect(&brush32) );
833 /***********************************************************************
834 * CreateCompatibleBitmap (GDI.51)
836 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
838 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
842 /***********************************************************************
843 * CreateCompatibleDC (GDI.52)
845 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
847 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
851 /***********************************************************************
852 * CreateDC (GDI.53)
854 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
855 const DEVMODEA *initData )
857 return HDC_16( CreateDCA( driver, device, output, initData ) );
861 /***********************************************************************
862 * CreateEllipticRgn (GDI.54)
864 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
866 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
870 /***********************************************************************
871 * CreateEllipticRgnIndirect (GDI.55)
873 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
875 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
879 /***********************************************************************
880 * CreateFont (GDI.56)
882 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
883 INT16 weight, BYTE italic, BYTE underline,
884 BYTE strikeout, BYTE charset, BYTE outpres,
885 BYTE clippres, BYTE quality, BYTE pitch,
886 LPCSTR name )
888 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
889 strikeout, charset, outpres, clippres, quality, pitch, name ));
892 /***********************************************************************
893 * CreateFontIndirect (GDI.57)
895 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
897 HFONT ret;
899 if (plf16)
901 LOGFONTW lfW;
902 logfont_16_to_W( plf16, &lfW );
903 ret = CreateFontIndirectW( &lfW );
905 else ret = CreateFontIndirectW( NULL );
906 return HFONT_16(ret);
910 /***********************************************************************
911 * CreateHatchBrush (GDI.58)
913 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
915 return HBRUSH_16( CreateHatchBrush( style, color ) );
919 /***********************************************************************
920 * CreatePatternBrush (GDI.60)
922 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
924 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
928 /***********************************************************************
929 * CreatePen (GDI.61)
931 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
933 LOGPEN logpen;
935 logpen.lopnStyle = style;
936 logpen.lopnWidth.x = width;
937 logpen.lopnWidth.y = 0;
938 logpen.lopnColor = color;
939 return HPEN_16( CreatePenIndirect( &logpen ) );
943 /***********************************************************************
944 * CreatePenIndirect (GDI.62)
946 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
948 LOGPEN logpen;
950 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
951 logpen.lopnStyle = pen->lopnStyle;
952 logpen.lopnWidth.x = pen->lopnWidth.x;
953 logpen.lopnWidth.y = pen->lopnWidth.y;
954 logpen.lopnColor = pen->lopnColor;
955 return HPEN_16( CreatePenIndirect( &logpen ) );
959 /***********************************************************************
960 * CreatePolygonRgn (GDI.63)
962 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
964 return CreatePolyPolygonRgn16( points, &count, 1, mode );
968 /***********************************************************************
969 * CreateRectRgn (GDI.64)
971 * NOTE: cf. SetRectRgn16
973 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
975 HRGN hrgn;
977 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
978 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
979 return HRGN_16(hrgn);
983 /***********************************************************************
984 * CreateRectRgnIndirect (GDI.65)
986 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
988 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
992 /***********************************************************************
993 * CreateSolidBrush (GDI.66)
995 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
997 return HBRUSH_16( CreateSolidBrush( color ) );
1001 /***********************************************************************
1002 * DeleteDC (GDI.68)
1004 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
1006 return DeleteDC( HDC_32(hdc) );
1010 /***********************************************************************
1011 * DeleteObject (GDI.69)
1012 * SysDeleteObject (GDI.605)
1014 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
1016 return DeleteObject( HGDIOBJ_32(obj) );
1020 /***********************************************************************
1021 * EnumObjects (GDI.71)
1023 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1025 struct callback16_info info;
1027 info.proc = (FARPROC16)proc;
1028 info.param = lParam;
1029 switch(obj)
1031 case OBJ_PEN:
1032 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1033 case OBJ_BRUSH:
1034 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1036 return 0;
1040 /***********************************************************************
1041 * EqualRgn (GDI.72)
1043 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1045 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1049 /***********************************************************************
1050 * GetBitmapBits (GDI.74)
1052 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1054 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1058 /***********************************************************************
1059 * GetBkColor (GDI.75)
1061 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1063 return GetBkColor( HDC_32(hdc) );
1067 /***********************************************************************
1068 * GetBkMode (GDI.76)
1070 INT16 WINAPI GetBkMode16( HDC16 hdc )
1072 return GetBkMode( HDC_32(hdc) );
1076 /***********************************************************************
1077 * GetClipBox (GDI.77)
1079 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1081 RECT rect32;
1082 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1084 if (ret != ERROR)
1086 rect->left = rect32.left;
1087 rect->top = rect32.top;
1088 rect->right = rect32.right;
1089 rect->bottom = rect32.bottom;
1091 return ret;
1095 /***********************************************************************
1096 * GetCurrentPosition (GDI.78)
1098 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1100 POINT pt32;
1101 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1102 return MAKELONG( pt32.x, pt32.y );
1106 /***********************************************************************
1107 * GetDCOrg (GDI.79)
1109 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1111 POINT pt;
1112 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1113 return 0;
1117 /***********************************************************************
1118 * GetDeviceCaps (GDI.80)
1120 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1122 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1123 /* some apps don't expect -1 and think it's a B&W screen */
1124 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1125 return ret;
1129 /***********************************************************************
1130 * GetMapMode (GDI.81)
1132 INT16 WINAPI GetMapMode16( HDC16 hdc )
1134 return GetMapMode( HDC_32(hdc) );
1138 /***********************************************************************
1139 * GetPixel (GDI.83)
1141 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1143 return GetPixel( HDC_32(hdc), x, y );
1147 /***********************************************************************
1148 * GetPolyFillMode (GDI.84)
1150 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1152 return GetPolyFillMode( HDC_32(hdc) );
1156 /***********************************************************************
1157 * GetROP2 (GDI.85)
1159 INT16 WINAPI GetROP216( HDC16 hdc )
1161 return GetROP2( HDC_32(hdc) );
1165 /***********************************************************************
1166 * GetRelAbs (GDI.86)
1168 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1170 return GetRelAbs( HDC_32(hdc), 0 );
1174 /***********************************************************************
1175 * GetStockObject (GDI.87)
1177 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1179 return HGDIOBJ_16( GetStockObject( obj ) );
1183 /***********************************************************************
1184 * GetStretchBltMode (GDI.88)
1186 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1188 return GetStretchBltMode( HDC_32(hdc) );
1192 /***********************************************************************
1193 * GetTextCharacterExtra (GDI.89)
1195 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1197 return GetTextCharacterExtra( HDC_32(hdc) );
1201 /***********************************************************************
1202 * GetTextColor (GDI.90)
1204 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1206 return GetTextColor( HDC_32(hdc) );
1210 /***********************************************************************
1211 * GetTextExtent (GDI.91)
1213 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1215 SIZE size;
1216 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1217 return MAKELONG( size.cx, size.cy );
1221 /***********************************************************************
1222 * GetTextFace (GDI.92)
1224 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1226 return GetTextFaceA( HDC_32(hdc), count, name );
1230 /***********************************************************************
1231 * GetTextMetrics (GDI.93)
1233 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1235 TEXTMETRICW tm32;
1237 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1239 tm->tmHeight = tm32.tmHeight;
1240 tm->tmAscent = tm32.tmAscent;
1241 tm->tmDescent = tm32.tmDescent;
1242 tm->tmInternalLeading = tm32.tmInternalLeading;
1243 tm->tmExternalLeading = tm32.tmExternalLeading;
1244 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1245 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1246 tm->tmWeight = tm32.tmWeight;
1247 tm->tmOverhang = tm32.tmOverhang;
1248 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1249 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1250 tm->tmFirstChar = tm32.tmFirstChar;
1251 tm->tmLastChar = tm32.tmLastChar;
1252 tm->tmDefaultChar = tm32.tmDefaultChar;
1253 tm->tmBreakChar = tm32.tmBreakChar;
1254 tm->tmItalic = tm32.tmItalic;
1255 tm->tmUnderlined = tm32.tmUnderlined;
1256 tm->tmStruckOut = tm32.tmStruckOut;
1257 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1258 tm->tmCharSet = tm32.tmCharSet;
1259 return TRUE;
1263 /***********************************************************************
1264 * GetViewportExt (GDI.94)
1266 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1268 SIZE size;
1269 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1270 return MAKELONG( size.cx, size.cy );
1274 /***********************************************************************
1275 * GetViewportOrg (GDI.95)
1277 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1279 POINT pt;
1280 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1281 return MAKELONG( pt.x, pt.y );
1285 /***********************************************************************
1286 * GetWindowExt (GDI.96)
1288 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1290 SIZE size;
1291 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1292 return MAKELONG( size.cx, size.cy );
1296 /***********************************************************************
1297 * GetWindowOrg (GDI.97)
1299 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1301 POINT pt;
1302 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1303 return MAKELONG( pt.x, pt.y );
1309 /**********************************************************************
1310 * LineDDA (GDI.100)
1312 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1313 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1315 struct callback16_info info;
1316 info.proc = (FARPROC16)proc;
1317 info.param = lParam;
1318 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1322 /***********************************************************************
1323 * OffsetRgn (GDI.101)
1325 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1327 return OffsetRgn( HRGN_32(hrgn), x, y );
1331 /***********************************************************************
1332 * PtVisible (GDI.103)
1334 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1336 return PtVisible( HDC_32(hdc), x, y );
1340 /***********************************************************************
1341 * SetBitmapBits (GDI.106)
1343 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1345 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1349 /***********************************************************************
1350 * AddFontResource (GDI.119)
1352 INT16 WINAPI AddFontResource16( LPCSTR filename )
1354 return AddFontResourceA( filename );
1358 /***********************************************************************
1359 * Death (GDI.121)
1361 * Disables GDI, switches back to text mode.
1362 * We don't have to do anything here,
1363 * just let console support handle everything
1365 void WINAPI Death16(HDC16 hdc)
1367 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1371 /***********************************************************************
1372 * Resurrection (GDI.122)
1374 * Restores GDI functionality
1376 void WINAPI Resurrection16(HDC16 hdc,
1377 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1379 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1380 hdc, w1, w2, w3, w4, w5, w6);
1384 /**********************************************************************
1385 * CreateMetaFile (GDI.125)
1387 HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
1389 return HDC_16( CreateMetaFileA( filename ) );
1393 /***********************************************************************
1394 * MulDiv (GDI.128)
1396 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1398 INT ret;
1399 if (!nDivisor) return -32768;
1400 /* We want to deal with a positive divisor to simplify the logic. */
1401 if (nDivisor < 0)
1403 nMultiplicand = - nMultiplicand;
1404 nDivisor = -nDivisor;
1406 /* If the result is positive, we "add" to round. else,
1407 * we subtract to round. */
1408 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1409 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1410 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1411 else
1412 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1413 if ((ret > 32767) || (ret < -32767)) return -32768;
1414 return (INT16) ret;
1418 /***********************************************************************
1419 * GetRgnBox (GDI.134)
1421 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1423 RECT r;
1424 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1425 rect->left = r.left;
1426 rect->top = r.top;
1427 rect->right = r.right;
1428 rect->bottom = r.bottom;
1429 return ret;
1433 /***********************************************************************
1434 * RemoveFontResource (GDI.136)
1436 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1438 return RemoveFontResourceA(str);
1442 /***********************************************************************
1443 * SetBrushOrg (GDI.148)
1445 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1447 POINT pt;
1449 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1450 return MAKELONG( pt.x, pt.y );
1454 /***********************************************************************
1455 * GetBrushOrg (GDI.149)
1457 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1459 POINT pt;
1460 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1461 return MAKELONG( pt.x, pt.y );
1465 /***********************************************************************
1466 * UnrealizeObject (GDI.150)
1468 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1470 return UnrealizeObject( HGDIOBJ_32(obj) );
1474 /***********************************************************************
1475 * CreateIC (GDI.153)
1477 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1478 const DEVMODEA* initData )
1480 return HDC_16( CreateICA( driver, device, output, initData ) );
1484 /***********************************************************************
1485 * GetNearestColor (GDI.154)
1487 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1489 return GetNearestColor( HDC_32(hdc), color );
1493 /***********************************************************************
1494 * CreateDiscardableBitmap (GDI.156)
1496 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1498 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1502 /***********************************************************************
1503 * PtInRegion (GDI.161)
1505 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1507 return PtInRegion( HRGN_32(hrgn), x, y );
1511 /***********************************************************************
1512 * GetBitmapDimension (GDI.162)
1514 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1516 SIZE16 size;
1517 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1518 return MAKELONG( size.cx, size.cy );
1522 /***********************************************************************
1523 * SetBitmapDimension (GDI.163)
1525 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1527 SIZE16 size;
1528 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1529 return MAKELONG( size.cx, size.cy );
1533 /***********************************************************************
1534 * SetRectRgn (GDI.172)
1536 * NOTE: Win 3.1 sets region to empty if left > right
1538 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1540 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1541 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1545 /******************************************************************
1546 * PlayMetaFileRecord (GDI.176)
1548 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1550 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, handles * sizeof(*ht32) );
1551 unsigned int i;
1553 for (i = 0; i < handles; i++) ht32->objectHandle[i] = (HGDIOBJ)(ULONG_PTR)ht->objectHandle[i];
1554 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1555 for (i = 0; i < handles; i++) ht->objectHandle[i] = LOWORD(ht32->objectHandle[i]);
1556 HeapFree( GetProcessHeap(), 0, ht32 );
1560 /***********************************************************************
1561 * SetBoundsRect (GDI.193)
1563 UINT16 WINAPI SetBoundsRect16( HDC16 hdc, const RECT16* rect, UINT16 flags )
1565 if (rect)
1567 RECT rect32;
1568 rect32.left = rect->left;
1569 rect32.top = rect->top;
1570 rect32.right = rect->right;
1571 rect32.bottom = rect->bottom;
1572 return SetBoundsRect( HDC_32( hdc ), &rect32, flags );
1574 else return SetBoundsRect( HDC_32( hdc ), NULL, flags );
1578 /***********************************************************************
1579 * GetBoundsRect (GDI.194)
1581 UINT16 WINAPI GetBoundsRect16( HDC16 hdc, LPRECT16 rect, UINT16 flags)
1583 RECT rect32;
1584 UINT ret = GetBoundsRect( HDC_32( hdc ), &rect32, flags );
1585 if (rect)
1587 rect->left = rect32.left;
1588 rect->top = rect32.top;
1589 rect->right = rect32.right;
1590 rect->bottom = rect32.bottom;
1592 return ret;
1596 /***********************************************************************
1597 * EngineEnumerateFont (GDI.300)
1599 WORD WINAPI EngineEnumerateFont16(LPSTR fontname, FARPROC16 proc, DWORD data )
1601 FIXME("(%s,%p,%lx),stub\n",fontname,proc,data);
1602 return 0;
1606 /***********************************************************************
1607 * EngineDeleteFont (GDI.301)
1609 WORD WINAPI EngineDeleteFont16(LPFONTINFO16 lpFontInfo)
1611 WORD handle;
1613 /* untested, don't know if it works.
1614 We seem to access some structure that is located after the
1615 FONTINFO. The FONTINFO documentation says that there may
1616 follow some char-width table or font bitmap or vector info.
1617 I think it is some kind of font bitmap that begins at offset 0x52,
1618 as FONTINFO goes up to 0x51.
1619 If this is correct, everything should be implemented correctly.
1621 if ( ((lpFontInfo->dfType & (RASTER_FONTTYPE|DEVICE_FONTTYPE)) == (RASTER_FONTTYPE|DEVICE_FONTTYPE))
1622 && (LOWORD(lpFontInfo->dfFace) == LOWORD(lpFontInfo)+0x6e)
1623 && (handle = *(WORD *)(lpFontInfo+0x54)) )
1625 *(WORD *)(lpFontInfo+0x54) = 0;
1626 GlobalFree16(handle);
1628 return 1;
1632 /***********************************************************************
1633 * EngineRealizeFont (GDI.302)
1635 WORD WINAPI EngineRealizeFont16(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
1637 FIXME("(%p,%p,%p),stub\n",lplogFont,lptextxform,lpfontInfo);
1639 return 0;
1643 /***********************************************************************
1644 * EngineRealizeFontExt (GDI.315)
1646 WORD WINAPI EngineRealizeFontExt16(LONG l1, LONG l2, LONG l3, LONG l4)
1648 FIXME("(%08lx,%08lx,%08lx,%08lx),stub\n",l1,l2,l3,l4);
1650 return 0;
1654 /***********************************************************************
1655 * EngineGetCharWidth (GDI.303)
1657 WORD WINAPI EngineGetCharWidth16(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE lastChar, LPINT16 buffer)
1659 int i;
1661 for (i = firstChar; i <= lastChar; i++)
1662 FIXME(" returns font's average width for range %d to %d\n", firstChar, lastChar);
1663 *buffer++ = lpFontInfo->dfAvgWidth; /* insert some charwidth functionality here; use average width for now */
1664 return 1;
1668 /***********************************************************************
1669 * EngineSetFontContext (GDI.304)
1671 WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data)
1673 FIXME("stub?\n");
1674 return 0;
1677 /***********************************************************************
1678 * EngineGetGlyphBMP (GDI.305)
1680 WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2,
1681 LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics)
1683 FIXME("stub?\n");
1684 return 0;
1688 /***********************************************************************
1689 * EngineMakeFontDir (GDI.306)
1691 DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string)
1693 FIXME(" stub! (always fails)\n");
1694 return ~0UL; /* error */
1698 /***********************************************************************
1699 * GetCharABCWidths (GDI.307)
1701 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
1703 BOOL ret;
1704 UINT i;
1705 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
1707 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
1709 for (i = firstChar; i <= lastChar; i++)
1711 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
1712 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
1713 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
1716 HeapFree( GetProcessHeap(), 0, abc32 );
1717 return ret;
1721 /***********************************************************************
1722 * GetGlyphOutline (GDI.309)
1724 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
1725 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
1726 LPVOID lpBuffer, const MAT2 *lpmat2 )
1728 DWORD ret;
1729 GLYPHMETRICS gm32;
1731 ret = GetGlyphOutlineA( HDC_32(hdc), uChar, fuFormat, &gm32, cbBuffer, lpBuffer, lpmat2);
1732 lpgm->gmBlackBoxX = gm32.gmBlackBoxX;
1733 lpgm->gmBlackBoxY = gm32.gmBlackBoxY;
1734 lpgm->gmptGlyphOrigin.x = gm32.gmptGlyphOrigin.x;
1735 lpgm->gmptGlyphOrigin.y = gm32.gmptGlyphOrigin.y;
1736 lpgm->gmCellIncX = gm32.gmCellIncX;
1737 lpgm->gmCellIncY = gm32.gmCellIncY;
1738 return ret;
1742 /***********************************************************************
1743 * CreateScalableFontResource (GDI.310)
1745 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
1746 LPCSTR fontFile, LPCSTR path )
1748 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
1752 /*************************************************************************
1753 * GetFontData (GDI.311)
1756 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
1758 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
1762 /*************************************************************************
1763 * GetRasterizerCaps (GDI.313)
1765 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
1767 return GetRasterizerCaps( lprs, cbNumBytes );
1771 /*************************************************************************
1772 * GetKerningPairs (GDI.332)
1775 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
1777 KERNINGPAIR *pairs32;
1778 INT i, ret;
1780 if (!count) return 0;
1782 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
1783 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
1785 for (i = 0; i < ret; i++)
1787 pairs->wFirst = pairs32->wFirst;
1788 pairs->wSecond = pairs32->wSecond;
1789 pairs->iKernAmount = pairs32->iKernAmount;
1792 HeapFree( GetProcessHeap(), 0, pairs32 );
1793 return ret;
1798 /***********************************************************************
1799 * GetTextAlign (GDI.345)
1801 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
1803 return GetTextAlign( HDC_32(hdc) );
1807 /***********************************************************************
1808 * SetTextAlign (GDI.346)
1810 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
1812 return SetTextAlign( HDC_32(hdc), align );
1816 /***********************************************************************
1817 * Chord (GDI.348)
1819 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
1820 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
1821 INT16 xend, INT16 yend )
1823 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
1827 /***********************************************************************
1828 * SetMapperFlags (GDI.349)
1830 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
1832 return SetMapperFlags( HDC_32(hdc), flags );
1836 /***********************************************************************
1837 * GetCharWidth (GDI.350)
1839 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
1841 BOOL retVal = FALSE;
1843 if( firstChar != lastChar )
1845 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
1846 if( buf32 )
1848 LPINT obuf32 = buf32;
1849 int i;
1851 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
1852 if (retVal)
1854 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
1856 HeapFree(GetProcessHeap(), 0, obuf32);
1859 else /* happens quite often to warrant a special treatment */
1861 INT chWidth;
1862 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
1863 *buffer = chWidth;
1865 return retVal;
1869 /***********************************************************************
1870 * ExtTextOut (GDI.351)
1872 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
1873 const RECT16 *lprect, LPCSTR str, UINT16 count,
1874 const INT16 *lpDx )
1876 BOOL ret;
1877 int i;
1878 RECT rect32;
1879 LPINT lpdx32 = NULL;
1881 if (lpDx) {
1882 lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
1883 if(lpdx32 == NULL) return FALSE;
1884 for (i=count;i--;) lpdx32[i]=lpDx[i];
1886 if (lprect)
1888 rect32.left = lprect->left;
1889 rect32.top = lprect->top;
1890 rect32.right = lprect->right;
1891 rect32.bottom = lprect->bottom;
1893 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
1894 HeapFree( GetProcessHeap(), 0, lpdx32 );
1895 return ret;
1899 /***********************************************************************
1900 * CreatePalette (GDI.360)
1902 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
1904 return HPALETTE_16( CreatePalette( palette ) );
1908 /***********************************************************************
1909 * GDISelectPalette (GDI.361)
1911 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
1913 return HPALETTE_16( GDISelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
1917 /***********************************************************************
1918 * GDIRealizePalette (GDI.362)
1920 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
1922 return GDIRealizePalette( HDC_32(hdc) );
1926 /***********************************************************************
1927 * GetPaletteEntries (GDI.363)
1929 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1930 UINT16 count, LPPALETTEENTRY entries )
1932 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1936 /***********************************************************************
1937 * SetPaletteEntries (GDI.364)
1939 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
1940 UINT16 count, const PALETTEENTRY *entries )
1942 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
1946 /**********************************************************************
1947 * UpdateColors (GDI.366)
1949 INT16 WINAPI UpdateColors16( HDC16 hdc )
1951 UpdateColors( HDC_32(hdc) );
1952 return TRUE;
1956 /***********************************************************************
1957 * AnimatePalette (GDI.367)
1959 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
1960 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
1962 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
1966 /***********************************************************************
1967 * ResizePalette (GDI.368)
1969 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
1971 return ResizePalette( HPALETTE_32(hpalette), cEntries );
1975 /***********************************************************************
1976 * GetNearestPaletteIndex (GDI.370)
1978 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
1980 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
1984 /**********************************************************************
1985 * ExtFloodFill (GDI.372)
1987 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
1988 UINT16 fillType )
1990 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
1994 /***********************************************************************
1995 * SetSystemPaletteUse (GDI.373)
1997 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
1999 return SetSystemPaletteUse( HDC_32(hdc), use );
2003 /***********************************************************************
2004 * GetSystemPaletteUse (GDI.374)
2006 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
2008 return GetSystemPaletteUse( HDC_32(hdc) );
2012 /***********************************************************************
2013 * GetSystemPaletteEntries (GDI.375)
2015 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
2016 LPPALETTEENTRY entries )
2018 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
2022 /***********************************************************************
2023 * ResetDC (GDI.376)
2025 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
2027 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
2031 /******************************************************************
2032 * StartDoc (GDI.377)
2034 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
2036 DOCINFOA docA;
2038 docA.cbSize = lpdoc->cbSize;
2039 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
2040 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
2041 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
2042 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
2043 else
2044 docA.lpszDatatype = NULL;
2045 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
2046 docA.fwType = lpdoc->fwType;
2047 else
2048 docA.fwType = 0;
2049 return StartDocA( HDC_32(hdc), &docA );
2053 /******************************************************************
2054 * EndDoc (GDI.378)
2056 INT16 WINAPI EndDoc16( HDC16 hdc )
2058 return EndDoc( HDC_32(hdc) );
2062 /******************************************************************
2063 * StartPage (GDI.379)
2065 INT16 WINAPI StartPage16( HDC16 hdc )
2067 return StartPage( HDC_32(hdc) );
2071 /******************************************************************
2072 * EndPage (GDI.380)
2074 INT16 WINAPI EndPage16( HDC16 hdc )
2076 return EndPage( HDC_32(hdc) );
2080 /******************************************************************************
2081 * AbortDoc (GDI.382)
2083 INT16 WINAPI AbortDoc16( HDC16 hdc )
2085 return AbortDoc( HDC_32(hdc) );
2089 /***********************************************************************
2090 * FastWindowFrame (GDI.400)
2092 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
2093 INT16 width, INT16 height, DWORD rop )
2095 HDC hdc32 = HDC_32(hdc);
2096 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
2097 PatBlt( hdc32, rect->left, rect->top,
2098 rect->right - rect->left - width, height, rop );
2099 PatBlt( hdc32, rect->left, rect->top + height, width,
2100 rect->bottom - rect->top - height, rop );
2101 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
2102 rect->right - rect->left - width, -height, rop );
2103 PatBlt( hdc32, rect->right - 1, rect->top, -width,
2104 rect->bottom - rect->top - height, rop );
2105 SelectObject( hdc32, hbrush );
2106 return TRUE;
2110 /***********************************************************************
2111 * CreateUserBitmap (GDI.407)
2113 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
2114 UINT16 bpp, LPCVOID bits )
2116 return CreateBitmap16( width, height, planes, bpp, bits );
2120 /***********************************************************************
2121 * CreateUserDiscardableBitmap (GDI.409)
2123 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
2125 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
2126 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
2127 DeleteDC( hdc );
2128 return HBITMAP_16(ret);
2132 /***********************************************************************
2133 * GetCurLogFont (GDI.411)
2135 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
2137 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
2141 /***********************************************************************
2142 * StretchDIBits (GDI.439)
2144 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
2145 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
2146 INT16 heightSrc, const VOID *bits,
2147 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
2149 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
2150 xSrc, ySrc, widthSrc, heightSrc, bits,
2151 info, wUsage, dwRop );
2155 /***********************************************************************
2156 * SetDIBits (GDI.440)
2158 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2159 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2160 UINT16 coloruse )
2162 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2166 /***********************************************************************
2167 * GetDIBits (GDI.441)
2169 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2170 UINT16 lines, LPVOID bits, BITMAPINFO * info,
2171 UINT16 coloruse )
2173 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2177 /***********************************************************************
2178 * CreateDIBitmap (GDI.442)
2180 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
2181 DWORD init, LPCVOID bits, const BITMAPINFO * data,
2182 UINT16 coloruse )
2184 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
2188 /***********************************************************************
2189 * SetDIBitsToDevice (GDI.443)
2191 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2192 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2193 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2194 UINT16 coloruse )
2196 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2197 startscan, lines, bits, info, coloruse );
2201 /***********************************************************************
2202 * CreateRoundRectRgn (GDI.444)
2204 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2205 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2206 * we just let CreateRoundRectRgn convert them to +ve values.
2209 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2210 INT16 ellipse_width, INT16 ellipse_height )
2212 if( ellipse_width == 0 || ellipse_height == 0 )
2213 return CreateRectRgn16( left, top, right, bottom );
2214 else
2215 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2216 ellipse_width, ellipse_height ));
2220 /***********************************************************************
2221 * CreateDIBPatternBrush (GDI.445)
2223 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2225 BITMAPINFO *bmi;
2226 HBRUSH16 ret;
2228 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2229 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2230 GlobalUnlock16( hbitmap );
2231 return ret;
2235 /**********************************************************************
2236 * PolyPolygon (GDI.450)
2238 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2239 UINT16 polygons )
2241 int i,nrpts;
2242 LPPOINT pt32;
2243 LPINT counts32;
2244 BOOL16 ret;
2246 nrpts=0;
2247 for (i=polygons;i--;)
2248 nrpts+=counts[i];
2249 pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2250 if(pt32 == NULL) return FALSE;
2251 for (i=nrpts;i--;)
2253 pt32[i].x = pt[i].x;
2254 pt32[i].y = pt[i].y;
2256 counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2257 if(counts32 == NULL) {
2258 HeapFree( GetProcessHeap(), 0, pt32 );
2259 return FALSE;
2261 for (i=polygons;i--;) counts32[i]=counts[i];
2263 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2264 HeapFree( GetProcessHeap(), 0, counts32 );
2265 HeapFree( GetProcessHeap(), 0, pt32 );
2266 return ret;
2270 /***********************************************************************
2271 * CreatePolyPolygonRgn (GDI.451)
2273 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2274 const INT16 *count, INT16 nbpolygons, INT16 mode )
2276 HRGN hrgn;
2277 int i, npts = 0;
2278 INT *count32;
2279 POINT *points32;
2281 for (i = 0; i < nbpolygons; i++) npts += count[i];
2282 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2283 for (i = 0; i < npts; i++)
2285 points32[i].x = points[i].x;
2286 points32[i].y = points[i].y;
2289 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2290 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2291 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2292 HeapFree( GetProcessHeap(), 0, count32 );
2293 HeapFree( GetProcessHeap(), 0, points32 );
2294 return HRGN_16(hrgn);
2298 /***********************************************************************
2299 * SetObjectOwner (GDI.461)
2301 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2303 /* Nothing to do */
2307 /***********************************************************************
2308 * RectVisible (GDI.465)
2309 * RectVisibleOld (GDI.104)
2311 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2313 RECT rect;
2315 rect.left = rect16->left;
2316 rect.top = rect16->top;
2317 rect.right = rect16->right;
2318 rect.bottom = rect16->bottom;
2319 return RectVisible( HDC_32(hdc), &rect );
2323 /***********************************************************************
2324 * RectInRegion (GDI.466)
2325 * RectInRegionOld (GDI.181)
2327 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2329 RECT r32;
2331 r32.left = rect->left;
2332 r32.top = rect->top;
2333 r32.right = rect->right;
2334 r32.bottom = rect->bottom;
2335 return RectInRegion( HRGN_32(hrgn), &r32 );
2339 /***********************************************************************
2340 * GetBitmapDimensionEx (GDI.468)
2342 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2344 SIZE size32;
2345 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2347 if (ret)
2349 size->cx = size32.cx;
2350 size->cy = size32.cy;
2352 return ret;
2356 /***********************************************************************
2357 * GetBrushOrgEx (GDI.469)
2359 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2361 POINT pt32;
2362 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2363 pt->x = pt32.x;
2364 pt->y = pt32.y;
2365 return TRUE;
2369 /***********************************************************************
2370 * GetCurrentPositionEx (GDI.470)
2372 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2374 POINT pt32;
2375 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2376 pt->x = pt32.x;
2377 pt->y = pt32.y;
2378 return TRUE;
2382 /***********************************************************************
2383 * GetTextExtentPoint (GDI.471)
2385 * FIXME: Should this have a bug for compatibility?
2386 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2387 * bugs (-> MSDN KB q147647.txt).
2389 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
2391 SIZE size32;
2392 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
2394 if (ret)
2396 size->cx = size32.cx;
2397 size->cy = size32.cy;
2399 return ret;
2403 /***********************************************************************
2404 * GetViewportExtEx (GDI.472)
2406 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
2408 SIZE size32;
2409 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
2410 size->cx = size32.cx;
2411 size->cy = size32.cy;
2412 return TRUE;
2416 /***********************************************************************
2417 * GetViewportOrgEx (GDI.473)
2419 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
2421 POINT pt32;
2422 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2423 pt->x = pt32.x;
2424 pt->y = pt32.y;
2425 return TRUE;
2429 /***********************************************************************
2430 * GetWindowExtEx (GDI.474)
2432 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
2434 SIZE size32;
2435 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
2436 size->cx = size32.cx;
2437 size->cy = size32.cy;
2438 return TRUE;
2442 /***********************************************************************
2443 * GetWindowOrgEx (GDI.475)
2445 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
2447 POINT pt32;
2448 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2449 pt->x = pt32.x;
2450 pt->y = pt32.y;
2451 return TRUE;
2455 /***********************************************************************
2456 * OffsetViewportOrgEx (GDI.476)
2458 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
2460 POINT pt32;
2461 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2462 if (pt)
2464 pt->x = pt32.x;
2465 pt->y = pt32.y;
2467 return ret;
2471 /***********************************************************************
2472 * OffsetWindowOrgEx (GDI.477)
2474 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2476 POINT pt32;
2477 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2478 if (pt)
2480 pt->x = pt32.x;
2481 pt->y = pt32.y;
2483 return ret;
2487 /***********************************************************************
2488 * SetBitmapDimensionEx (GDI.478)
2490 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
2492 SIZE size32;
2493 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
2495 if (ret && prevSize)
2497 prevSize->cx = size32.cx;
2498 prevSize->cy = size32.cy;
2500 return ret;
2504 /***********************************************************************
2505 * SetViewportExtEx (GDI.479)
2507 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2509 SIZE size32;
2510 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
2511 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2512 return ret;
2516 /***********************************************************************
2517 * SetViewportOrgEx (GDI.480)
2519 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2521 POINT pt32;
2522 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
2523 if (pt)
2525 pt->x = pt32.x;
2526 pt->y = pt32.y;
2528 return ret;
2532 /***********************************************************************
2533 * SetWindowExtEx (GDI.481)
2535 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
2537 SIZE size32;
2538 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
2539 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2540 return ret;
2544 /***********************************************************************
2545 * SetWindowOrgEx (GDI.482)
2547 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2549 POINT pt32;
2550 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
2551 if (pt)
2553 pt->x = pt32.x;
2554 pt->y = pt32.y;
2556 return ret;
2560 /***********************************************************************
2561 * MoveToEx (GDI.483)
2563 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
2565 POINT pt32;
2567 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
2568 if (pt)
2570 pt->x = pt32.x;
2571 pt->y = pt32.y;
2573 return TRUE;
2577 /***********************************************************************
2578 * ScaleViewportExtEx (GDI.484)
2580 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2581 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2583 SIZE size32;
2584 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2585 &size32 );
2586 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2587 return ret;
2591 /***********************************************************************
2592 * ScaleWindowExtEx (GDI.485)
2594 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
2595 INT16 yNum, INT16 yDenom, LPSIZE16 size )
2597 SIZE size32;
2598 BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
2599 &size32 );
2600 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
2601 return ret;
2605 /******************************************************************************
2606 * PolyBezier (GDI.502)
2608 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2610 int i;
2611 BOOL16 ret;
2612 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2613 cPoints*sizeof(POINT) );
2614 if(!pt32) return FALSE;
2615 for (i=cPoints;i--;)
2617 pt32[i].x = lppt[i].x;
2618 pt32[i].y = lppt[i].y;
2620 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
2621 HeapFree( GetProcessHeap(), 0, pt32 );
2622 return ret;
2626 /******************************************************************************
2627 * PolyBezierTo (GDI.503)
2629 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
2631 int i;
2632 BOOL16 ret;
2633 LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0,
2634 cPoints*sizeof(POINT) );
2635 if(!pt32) return FALSE;
2636 for (i=cPoints;i--;)
2638 pt32[i].x = lppt[i].x;
2639 pt32[i].y = lppt[i].y;
2641 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
2642 HeapFree( GetProcessHeap(), 0, pt32 );
2643 return ret;
2647 /******************************************************************************
2648 * ExtSelectClipRgn (GDI.508)
2650 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
2652 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
2656 /***********************************************************************
2657 * AbortPath (GDI.511)
2659 BOOL16 WINAPI AbortPath16(HDC16 hdc)
2661 return AbortPath( HDC_32(hdc) );
2665 /***********************************************************************
2666 * BeginPath (GDI.512)
2668 BOOL16 WINAPI BeginPath16(HDC16 hdc)
2670 return BeginPath( HDC_32(hdc) );
2674 /***********************************************************************
2675 * CloseFigure (GDI.513)
2677 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
2679 return CloseFigure( HDC_32(hdc) );
2683 /***********************************************************************
2684 * EndPath (GDI.514)
2686 BOOL16 WINAPI EndPath16(HDC16 hdc)
2688 return EndPath( HDC_32(hdc) );
2692 /***********************************************************************
2693 * FillPath (GDI.515)
2695 BOOL16 WINAPI FillPath16(HDC16 hdc)
2697 return FillPath( HDC_32(hdc) );
2701 /*******************************************************************
2702 * FlattenPath (GDI.516)
2704 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
2706 return FlattenPath( HDC_32(hdc) );
2710 /***********************************************************************
2711 * GetPath (GDI.517)
2713 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
2715 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
2716 return 0;
2720 /***********************************************************************
2721 * PathToRegion (GDI.518)
2723 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
2725 return HRGN_16( PathToRegion( HDC_32(hdc) ));
2729 /***********************************************************************
2730 * SelectClipPath (GDI.519)
2732 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
2734 return SelectClipPath( HDC_32(hdc), iMode );
2738 /*******************************************************************
2739 * StrokeAndFillPath (GDI.520)
2741 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
2743 return StrokeAndFillPath( HDC_32(hdc) );
2747 /*******************************************************************
2748 * StrokePath (GDI.521)
2750 BOOL16 WINAPI StrokePath16(HDC16 hdc)
2752 return StrokePath( HDC_32(hdc) );
2756 /*******************************************************************
2757 * WidenPath (GDI.522)
2759 BOOL16 WINAPI WidenPath16(HDC16 hdc)
2761 return WidenPath( HDC_32(hdc) );
2765 /***********************************************************************
2766 * GetArcDirection (GDI.524)
2768 INT16 WINAPI GetArcDirection16( HDC16 hdc )
2770 return GetArcDirection( HDC_32(hdc) );
2774 /***********************************************************************
2775 * SetArcDirection (GDI.525)
2777 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
2779 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
2783 /***********************************************************************
2784 * CreateHalftonePalette (GDI.529)
2786 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
2788 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
2792 /***********************************************************************
2793 * SetDIBColorTable (GDI.602)
2795 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2797 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2801 /***********************************************************************
2802 * GetDIBColorTable (GDI.603)
2804 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
2806 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
2810 /***********************************************************************
2811 * GetRegionData (GDI.607)
2813 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2815 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
2817 return GetRegionData( HRGN_32(hrgn), count, rgndata );
2821 /***********************************************************************
2822 * GetTextCharset (GDI.612)
2824 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
2826 return GetTextCharset( HDC_32(hdc) );
2830 /*************************************************************************
2831 * GetFontLanguageInfo (GDI.616)
2833 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
2835 return GetFontLanguageInfo( HDC_32(hdc) );
2839 /***********************************************************************
2840 * SetLayout (GDI.1000)
2842 * Sets left->right or right->left text layout flags of a dc.
2844 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
2846 return SetLayout( HDC_32(hdc), layout );