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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/wingdi16.h"
28 #include "gdi_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gdi
);
33 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
34 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
36 struct callback16_info
42 /* callback for LineDDA16 */
43 static void CALLBACK
linedda_callback( INT x
, INT y
, LPARAM param
)
45 const struct callback16_info
*info
= (struct callback16_info
*)param
;
50 args
[1] = HIWORD(info
->param
);
51 args
[0] = LOWORD(info
->param
);
52 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, NULL
);
55 /* callback for EnumObjects16 */
56 static INT CALLBACK
enum_pens_callback( void *ptr
, LPARAM param
)
58 const struct callback16_info
*info
= (struct callback16_info
*)param
;
65 pen16
.lopnStyle
= pen
->lopnStyle
;
66 pen16
.lopnWidth
.x
= pen
->lopnWidth
.x
;
67 pen16
.lopnWidth
.y
= pen
->lopnWidth
.y
;
68 pen16
.lopnColor
= pen
->lopnColor
;
69 segptr
= MapLS( &pen16
);
70 args
[3] = SELECTOROF(segptr
);
71 args
[2] = OFFSETOF(segptr
);
72 args
[1] = HIWORD(info
->param
);
73 args
[0] = LOWORD(info
->param
);
74 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
79 /* callback for EnumObjects16 */
80 static INT CALLBACK
enum_brushes_callback( void *ptr
, LPARAM param
)
82 const struct callback16_info
*info
= (struct callback16_info
*)param
;
83 LOGBRUSH
*brush
= ptr
;
89 brush16
.lbStyle
= brush
->lbStyle
;
90 brush16
.lbColor
= brush
->lbColor
;
91 brush16
.lbHatch
= brush
->lbHatch
;
92 segptr
= MapLS( &brush16
);
93 args
[3] = SELECTOROF(segptr
);
94 args
[2] = OFFSETOF(segptr
);
95 args
[1] = HIWORD(info
->param
);
96 args
[0] = LOWORD(info
->param
);
97 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
102 /* convert a LOGFONT16 to a LOGFONTW */
103 static void logfont_16_to_W( const LOGFONT16
*font16
, LPLOGFONTW font32
)
105 font32
->lfHeight
= font16
->lfHeight
;
106 font32
->lfWidth
= font16
->lfWidth
;
107 font32
->lfEscapement
= font16
->lfEscapement
;
108 font32
->lfOrientation
= font16
->lfOrientation
;
109 font32
->lfWeight
= font16
->lfWeight
;
110 font32
->lfItalic
= font16
->lfItalic
;
111 font32
->lfUnderline
= font16
->lfUnderline
;
112 font32
->lfStrikeOut
= font16
->lfStrikeOut
;
113 font32
->lfCharSet
= font16
->lfCharSet
;
114 font32
->lfOutPrecision
= font16
->lfOutPrecision
;
115 font32
->lfClipPrecision
= font16
->lfClipPrecision
;
116 font32
->lfQuality
= font16
->lfQuality
;
117 font32
->lfPitchAndFamily
= font16
->lfPitchAndFamily
;
118 MultiByteToWideChar( CP_ACP
, 0, font16
->lfFaceName
, -1, font32
->lfFaceName
, LF_FACESIZE
);
119 font32
->lfFaceName
[LF_FACESIZE
-1] = 0;
123 /***********************************************************************
126 COLORREF WINAPI
SetBkColor16( HDC16 hdc
, COLORREF color
)
128 return SetBkColor( HDC_32(hdc
), color
);
132 /***********************************************************************
135 INT16 WINAPI
SetBkMode16( HDC16 hdc
, INT16 mode
)
137 return SetBkMode( HDC_32(hdc
), mode
);
141 /***********************************************************************
144 INT16 WINAPI
SetMapMode16( HDC16 hdc
, INT16 mode
)
146 return SetMapMode( HDC_32(hdc
), mode
);
150 /***********************************************************************
153 INT16 WINAPI
SetROP216( HDC16 hdc
, INT16 mode
)
155 return SetROP2( HDC_32(hdc
), mode
);
159 /***********************************************************************
162 INT16 WINAPI
SetRelAbs16( HDC16 hdc
, INT16 mode
)
164 return SetRelAbs( HDC_32(hdc
), mode
);
168 /***********************************************************************
169 * SetPolyFillMode (GDI.6)
171 INT16 WINAPI
SetPolyFillMode16( HDC16 hdc
, INT16 mode
)
173 return SetPolyFillMode( HDC_32(hdc
), mode
);
177 /***********************************************************************
178 * SetStretchBltMode (GDI.7)
180 INT16 WINAPI
SetStretchBltMode16( HDC16 hdc
, INT16 mode
)
182 return SetStretchBltMode( HDC_32(hdc
), mode
);
186 /***********************************************************************
187 * SetTextCharacterExtra (GDI.8)
189 INT16 WINAPI
SetTextCharacterExtra16( HDC16 hdc
, INT16 extra
)
191 return SetTextCharacterExtra( HDC_32(hdc
), extra
);
195 /***********************************************************************
196 * SetTextColor (GDI.9)
198 COLORREF WINAPI
SetTextColor16( HDC16 hdc
, COLORREF color
)
200 return SetTextColor( HDC_32(hdc
), color
);
204 /***********************************************************************
205 * SetTextJustification (GDI.10)
207 INT16 WINAPI
SetTextJustification16( HDC16 hdc
, INT16 extra
, INT16 breaks
)
209 return SetTextJustification( HDC_32(hdc
), extra
, breaks
);
213 /***********************************************************************
214 * SetWindowOrg (GDI.11)
216 DWORD WINAPI
SetWindowOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
219 if (!SetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
220 return MAKELONG( pt
.x
, pt
.y
);
224 /***********************************************************************
225 * SetWindowExt (GDI.12)
227 DWORD WINAPI
SetWindowExt16( HDC16 hdc
, INT16 x
, INT16 y
)
230 if (!SetWindowExtEx( HDC_32(hdc
), x
, y
, &size
)) return 0;
231 return MAKELONG( size
.cx
, size
.cy
);
235 /***********************************************************************
236 * SetViewportOrg (GDI.13)
238 DWORD WINAPI
SetViewportOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
241 if (!SetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
242 return MAKELONG( pt
.x
, pt
.y
);
246 /***********************************************************************
247 * SetViewportExt (GDI.14)
249 DWORD WINAPI
SetViewportExt16( HDC16 hdc
, INT16 x
, INT16 y
)
252 if (!SetViewportExtEx( HDC_32(hdc
), x
, y
, &size
)) return 0;
253 return MAKELONG( size
.cx
, size
.cy
);
257 /***********************************************************************
258 * OffsetWindowOrg (GDI.15)
260 DWORD WINAPI
OffsetWindowOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
263 if (!OffsetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
264 return MAKELONG( pt
.x
, pt
.y
);
268 /***********************************************************************
269 * ScaleWindowExt (GDI.16)
271 DWORD WINAPI
ScaleWindowExt16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
272 INT16 yNum
, INT16 yDenom
)
275 if (!ScaleWindowExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
, &size
))
277 return MAKELONG( size
.cx
, size
.cy
);
281 /***********************************************************************
282 * OffsetViewportOrg (GDI.17)
284 DWORD WINAPI
OffsetViewportOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
287 if (!OffsetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
288 return MAKELONG( pt
.x
, pt
.y
);
292 /***********************************************************************
293 * ScaleViewportExt (GDI.18)
295 DWORD WINAPI
ScaleViewportExt16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
296 INT16 yNum
, INT16 yDenom
)
299 if (!ScaleViewportExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
, &size
))
301 return MAKELONG( size
.cx
, size
.cy
);
305 /***********************************************************************
308 BOOL16 WINAPI
LineTo16( HDC16 hdc
, INT16 x
, INT16 y
)
310 return LineTo( HDC_32(hdc
), x
, y
);
314 /***********************************************************************
317 DWORD WINAPI
MoveTo16( HDC16 hdc
, INT16 x
, INT16 y
)
321 if (!MoveToEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
322 return MAKELONG(pt
.x
,pt
.y
);
326 /***********************************************************************
327 * ExcludeClipRect (GDI.21)
329 INT16 WINAPI
ExcludeClipRect16( HDC16 hdc
, INT16 left
, INT16 top
,
330 INT16 right
, INT16 bottom
)
332 return ExcludeClipRect( HDC_32(hdc
), left
, top
, right
, bottom
);
336 /***********************************************************************
337 * IntersectClipRect (GDI.22)
339 INT16 WINAPI
IntersectClipRect16( HDC16 hdc
, INT16 left
, INT16 top
,
340 INT16 right
, INT16 bottom
)
342 return IntersectClipRect( HDC_32(hdc
), left
, top
, right
, bottom
);
346 /***********************************************************************
349 BOOL16 WINAPI
Arc16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
350 INT16 bottom
, INT16 xstart
, INT16 ystart
,
351 INT16 xend
, INT16 yend
)
353 return Arc( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
357 /***********************************************************************
360 BOOL16 WINAPI
Ellipse16( HDC16 hdc
, INT16 left
, INT16 top
,
361 INT16 right
, INT16 bottom
)
363 return Ellipse( HDC_32(hdc
), left
, top
, right
, bottom
);
367 /**********************************************************************
370 BOOL16 WINAPI
FloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
372 return ExtFloodFill( HDC_32(hdc
), x
, y
, color
, FLOODFILLBORDER
);
376 /***********************************************************************
379 BOOL16 WINAPI
Pie16( HDC16 hdc
, INT16 left
, INT16 top
,
380 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
381 INT16 xend
, INT16 yend
)
383 return Pie( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
387 /***********************************************************************
390 BOOL16 WINAPI
Rectangle16( HDC16 hdc
, INT16 left
, INT16 top
,
391 INT16 right
, INT16 bottom
)
393 return Rectangle( HDC_32(hdc
), left
, top
, right
, bottom
);
397 /***********************************************************************
400 BOOL16 WINAPI
RoundRect16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
401 INT16 bottom
, INT16 ell_width
, INT16 ell_height
)
403 return RoundRect( HDC_32(hdc
), left
, top
, right
, bottom
, ell_width
, ell_height
);
407 /***********************************************************************
410 BOOL16 WINAPI
PatBlt16( HDC16 hdc
, INT16 left
, INT16 top
,
411 INT16 width
, INT16 height
, DWORD rop
)
413 return PatBlt( HDC_32(hdc
), left
, top
, width
, height
, rop
);
417 /***********************************************************************
420 INT16 WINAPI
SaveDC16( HDC16 hdc
)
422 return SaveDC( HDC_32(hdc
) );
426 /***********************************************************************
429 COLORREF WINAPI
SetPixel16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
431 return SetPixel( HDC_32(hdc
), x
, y
, color
);
435 /***********************************************************************
436 * OffsetClipRgn (GDI.32)
438 INT16 WINAPI
OffsetClipRgn16( HDC16 hdc
, INT16 x
, INT16 y
)
440 return OffsetClipRgn( HDC_32(hdc
), x
, y
);
444 /***********************************************************************
447 BOOL16 WINAPI
TextOut16( HDC16 hdc
, INT16 x
, INT16 y
, LPCSTR str
, INT16 count
)
449 return TextOutA( HDC_32(hdc
), x
, y
, str
, count
);
453 /***********************************************************************
456 BOOL16 WINAPI
BitBlt16( HDC16 hdcDst
, INT16 xDst
, INT16 yDst
, INT16 width
,
457 INT16 height
, HDC16 hdcSrc
, INT16 xSrc
, INT16 ySrc
,
460 return BitBlt( HDC_32(hdcDst
), xDst
, yDst
, width
, height
, HDC_32(hdcSrc
), xSrc
, ySrc
, rop
);
464 /***********************************************************************
465 * StretchBlt (GDI.35)
467 BOOL16 WINAPI
StretchBlt16( HDC16 hdcDst
, INT16 xDst
, INT16 yDst
,
468 INT16 widthDst
, INT16 heightDst
,
469 HDC16 hdcSrc
, INT16 xSrc
, INT16 ySrc
,
470 INT16 widthSrc
, INT16 heightSrc
, DWORD rop
)
472 return StretchBlt( HDC_32(hdcDst
), xDst
, yDst
, widthDst
, heightDst
,
473 HDC_32(hdcSrc
), xSrc
, ySrc
, widthSrc
, heightSrc
, rop
);
477 /**********************************************************************
480 BOOL16 WINAPI
Polygon16( HDC16 hdc
, const POINT16
* pt
, INT16 count
)
484 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, count
*sizeof(POINT
) );
486 if (!pt32
) return FALSE
;
492 ret
= Polygon(HDC_32(hdc
),pt32
,count
);
493 HeapFree( GetProcessHeap(), 0, pt32
);
498 /**********************************************************************
501 BOOL16 WINAPI
Polyline16( HDC16 hdc
, const POINT16
* pt
, INT16 count
)
505 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, count
*sizeof(POINT
) );
507 if (!pt32
) return FALSE
;
513 ret
= Polyline(HDC_32(hdc
),pt32
,count
);
514 HeapFree( GetProcessHeap(), 0, pt32
);
519 /***********************************************************************
522 INT16 WINAPI
Escape16( HDC16 hdc
, INT16 escape
, INT16 in_count
, SEGPTR in_data
, LPVOID out_data
)
528 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
529 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
530 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
531 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
532 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
533 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
534 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
535 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
536 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
537 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
538 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
539 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
540 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
545 case EXT_DEVICE_CAPS
:
548 case POSTSCRIPT_IGNORE
:
549 case QUERYESCSUPPORT
:
550 case SET_ARC_DIRECTION
:
552 case SET_SCREEN_ANGLE
:
555 INT16
*ptr
= MapSL(in_data
);
557 return Escape( HDC_32(hdc
), escape
, sizeof(data
), (LPCSTR
)&data
, out_data
);
560 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
563 UINT16
*ptr
= MapSL(in_data
);
565 return Escape( HDC_32(hdc
), escape
, sizeof(data
), (LPCSTR
)&data
, NULL
);
568 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
569 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
570 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
571 case GETPHYSPAGESIZE
:
572 case GETPRINTINGOFFSET
:
573 case GETSCALINGFACTOR
:
575 POINT16
*ptr
= out_data
;
577 ret
= Escape( HDC_32(hdc
), escape
, 0, NULL
, &pt32
);
583 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
584 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
585 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
586 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
587 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
588 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
589 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
590 case ENABLEPAIRKERNING
:
591 case ENABLERELATIVEWIDTHS
:
598 INT16
*new = MapSL(in_data
);
599 INT16
*old
= out_data
;
601 ret
= Escape( HDC_32(hdc
), escape
, sizeof(in
), (LPCSTR
)&in
, &out
);
606 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
608 return SetAbortProc16( hdc
, (ABORTPROC16
)in_data
);
610 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
611 * lpvOutData is actually a pointer to the DocInfo structure and used as
612 * a second input parameter */
616 ret
= StartDoc16( hdc
, out_data
);
617 if (ret
> 0) ret
= StartPage( HDC_32(hdc
) );
620 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), NULL
);
622 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
623 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
627 RECT16
*rc16
= MapSL(in_data
);
629 rc
.left
= rc16
->left
;
631 rc
.right
= rc16
->right
;
632 rc
.bottom
= rc16
->bottom
;
633 return Escape( HDC_32(hdc
), escape
, sizeof(rc
), (LPCSTR
)&rc
, NULL
);
636 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
640 RECT16
*rc16
= out_data
;
641 ret
= Escape( HDC_32(hdc
), escape
, 0, NULL
, &rc
);
642 rc16
->left
= rc
.left
;
644 rc16
->right
= rc
.right
;
645 rc16
->bottom
= rc
.bottom
;
648 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
649 case DRAWPATTERNRECT
:
652 DRAWPATRECT16
*pr16
= (DRAWPATRECT16
*)MapSL(in_data
);
654 pr
.ptPosition
.x
= pr16
->ptPosition
.x
;
655 pr
.ptPosition
.y
= pr16
->ptPosition
.y
;
656 pr
.ptSize
.x
= pr16
->ptSize
.x
;
657 pr
.ptSize
.y
= pr16
->ptSize
.y
;
658 pr
.wStyle
= pr16
->wStyle
;
659 pr
.wPattern
= pr16
->wPattern
;
660 return Escape( HDC_32(hdc
), escape
, sizeof(pr
), (LPCSTR
)&pr
, NULL
);
663 /* Escape(hdc,ABORTDOC,NULL,NULL); */
664 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
665 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
666 /* Escape(hdc,ENDDOC,NULL,NULL); */
667 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
668 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
669 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
670 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
671 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
672 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
673 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
674 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
675 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
676 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
677 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
678 /* Escape(hdc,NEWFRAME,NULL,NULL); */
679 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
680 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
681 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
682 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
683 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
684 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
685 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
694 case GETPAIRKERNTABLE
:
695 case GETSETPAPERBINS
:
696 case GETSETPRINTORIENT
:
697 case GETSETSCREENPARAMS
:
699 case GETTRACKKERNTABLE
:
705 case SETALLJUSTVALUES
:
707 case SET_BACKGROUND_COLOR
:
709 /* pass it unmodified to the 32-bit function */
710 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), out_data
);
712 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
713 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
714 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
715 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
716 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
717 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
718 case ENUMPAPERMETRICS
:
719 case GETEXTENDEDTEXTMETRICS
:
721 case GETSETPAPERMETRICS
:
722 case GETVECTORBRUSHSIZE
:
723 case GETVECTORPENSIZE
:
725 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
726 escape
, in_count
, MapSL(in_data
), out_data
);
727 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), out_data
);
732 /***********************************************************************
735 BOOL16 WINAPI
RestoreDC16( HDC16 hdc
, INT16 level
)
737 return RestoreDC( HDC_32(hdc
), level
);
741 /***********************************************************************
744 BOOL16 WINAPI
FillRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
)
746 return FillRgn( HDC_32(hdc
), HRGN_32(hrgn
), HBRUSH_32(hbrush
) );
750 /***********************************************************************
753 BOOL16 WINAPI
FrameRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
,
754 INT16 nWidth
, INT16 nHeight
)
756 return FrameRgn( HDC_32(hdc
), HRGN_32(hrgn
), HBRUSH_32(hbrush
), nWidth
, nHeight
);
760 /***********************************************************************
763 BOOL16 WINAPI
InvertRgn16( HDC16 hdc
, HRGN16 hrgn
)
765 return InvertRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
769 /***********************************************************************
772 BOOL16 WINAPI
PaintRgn16( HDC16 hdc
, HRGN16 hrgn
)
774 return PaintRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
778 /***********************************************************************
779 * SelectClipRgn (GDI.44)
781 INT16 WINAPI
SelectClipRgn16( HDC16 hdc
, HRGN16 hrgn
)
783 return SelectClipRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
787 /***********************************************************************
788 * SelectObject (GDI.45)
790 HGDIOBJ16 WINAPI
SelectObject16( HDC16 hdc
, HGDIOBJ16 handle
)
792 return HGDIOBJ_16( SelectObject( HDC_32(hdc
), HGDIOBJ_32(handle
) ) );
796 /***********************************************************************
797 * CombineRgn (GDI.47)
799 INT16 WINAPI
CombineRgn16(HRGN16 hDest
, HRGN16 hSrc1
, HRGN16 hSrc2
, INT16 mode
)
801 return CombineRgn( HRGN_32(hDest
), HRGN_32(hSrc1
), HRGN_32(hSrc2
), mode
);
805 /***********************************************************************
806 * CreateBitmap (GDI.48)
808 HBITMAP16 WINAPI
CreateBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
809 UINT16 bpp
, LPCVOID bits
)
811 return HBITMAP_16( CreateBitmap( width
, height
, planes
& 0xff, bpp
& 0xff, bits
) );
815 /***********************************************************************
816 * CreateBitmapIndirect (GDI.49)
818 HBITMAP16 WINAPI
CreateBitmapIndirect16( const BITMAP16
* bmp
)
820 return CreateBitmap16( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
821 bmp
->bmBitsPixel
, MapSL( bmp
->bmBits
) );
825 /***********************************************************************
826 * CreateBrushIndirect (GDI.50)
828 HBRUSH16 WINAPI
CreateBrushIndirect16( const LOGBRUSH16
* brush
)
832 if (brush
->lbStyle
== BS_DIBPATTERN
|| brush
->lbStyle
== BS_DIBPATTERN8X8
)
833 return CreateDIBPatternBrush16( brush
->lbHatch
, brush
->lbColor
);
835 brush32
.lbStyle
= brush
->lbStyle
;
836 brush32
.lbColor
= brush
->lbColor
;
837 brush32
.lbHatch
= brush
->lbHatch
;
838 return HBRUSH_16( CreateBrushIndirect(&brush32
) );
842 /***********************************************************************
843 * CreateCompatibleBitmap (GDI.51)
845 HBITMAP16 WINAPI
CreateCompatibleBitmap16( HDC16 hdc
, INT16 width
, INT16 height
)
847 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc
), width
, height
) );
851 /***********************************************************************
852 * CreateCompatibleDC (GDI.52)
854 HDC16 WINAPI
CreateCompatibleDC16( HDC16 hdc
)
856 return HDC_16( CreateCompatibleDC( HDC_32(hdc
) ) );
860 /***********************************************************************
863 HDC16 WINAPI
CreateDC16( LPCSTR driver
, LPCSTR device
, LPCSTR output
,
864 const DEVMODEA
*initData
)
866 return HDC_16( CreateDCA( driver
, device
, output
, initData
) );
870 /***********************************************************************
871 * CreateEllipticRgn (GDI.54)
873 HRGN16 WINAPI
CreateEllipticRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
875 return HRGN_16( CreateEllipticRgn( left
, top
, right
, bottom
) );
879 /***********************************************************************
880 * CreateEllipticRgnIndirect (GDI.55)
882 HRGN16 WINAPI
CreateEllipticRgnIndirect16( const RECT16
*rect
)
884 return HRGN_16( CreateEllipticRgn( rect
->left
, rect
->top
, rect
->right
, rect
->bottom
) );
888 /***********************************************************************
889 * CreateFont (GDI.56)
891 HFONT16 WINAPI
CreateFont16(INT16 height
, INT16 width
, INT16 esc
, INT16 orient
,
892 INT16 weight
, BYTE italic
, BYTE underline
,
893 BYTE strikeout
, BYTE charset
, BYTE outpres
,
894 BYTE clippres
, BYTE quality
, BYTE pitch
,
897 return HFONT_16( CreateFontA( height
, width
, esc
, orient
, weight
, italic
, underline
,
898 strikeout
, charset
, outpres
, clippres
, quality
, pitch
, name
));
901 /***********************************************************************
902 * CreateFontIndirect (GDI.57)
904 HFONT16 WINAPI
CreateFontIndirect16( const LOGFONT16
*plf16
)
911 logfont_16_to_W( plf16
, &lfW
);
912 ret
= CreateFontIndirectW( &lfW
);
914 else ret
= CreateFontIndirectW( NULL
);
915 return HFONT_16(ret
);
919 /***********************************************************************
920 * CreateHatchBrush (GDI.58)
922 HBRUSH16 WINAPI
CreateHatchBrush16( INT16 style
, COLORREF color
)
924 return HBRUSH_16( CreateHatchBrush( style
, color
) );
928 /***********************************************************************
929 * CreatePatternBrush (GDI.60)
931 HBRUSH16 WINAPI
CreatePatternBrush16( HBITMAP16 hbitmap
)
933 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap
) ));
937 /***********************************************************************
940 HPEN16 WINAPI
CreatePen16( INT16 style
, INT16 width
, COLORREF color
)
944 logpen
.lopnStyle
= style
;
945 logpen
.lopnWidth
.x
= width
;
946 logpen
.lopnWidth
.y
= 0;
947 logpen
.lopnColor
= color
;
948 return HPEN_16( CreatePenIndirect( &logpen
) );
952 /***********************************************************************
953 * CreatePenIndirect (GDI.62)
955 HPEN16 WINAPI
CreatePenIndirect16( const LOGPEN16
* pen
)
959 if (pen
->lopnStyle
> PS_INSIDEFRAME
) return 0;
960 logpen
.lopnStyle
= pen
->lopnStyle
;
961 logpen
.lopnWidth
.x
= pen
->lopnWidth
.x
;
962 logpen
.lopnWidth
.y
= pen
->lopnWidth
.y
;
963 logpen
.lopnColor
= pen
->lopnColor
;
964 return HPEN_16( CreatePenIndirect( &logpen
) );
968 /***********************************************************************
969 * CreatePolygonRgn (GDI.63)
971 HRGN16 WINAPI
CreatePolygonRgn16( const POINT16
* points
, INT16 count
, INT16 mode
)
973 return CreatePolyPolygonRgn16( points
, &count
, 1, mode
);
977 /***********************************************************************
978 * CreateRectRgn (GDI.64)
980 * NOTE: cf. SetRectRgn16
982 HRGN16 WINAPI
CreateRectRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
986 if (left
< right
) hrgn
= CreateRectRgn( left
, top
, right
, bottom
);
987 else hrgn
= CreateRectRgn( 0, 0, 0, 0 );
988 return HRGN_16(hrgn
);
992 /***********************************************************************
993 * CreateRectRgnIndirect (GDI.65)
995 HRGN16 WINAPI
CreateRectRgnIndirect16( const RECT16
* rect
)
997 return CreateRectRgn16( rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
1001 /***********************************************************************
1002 * CreateSolidBrush (GDI.66)
1004 HBRUSH16 WINAPI
CreateSolidBrush16( COLORREF color
)
1006 return HBRUSH_16( CreateSolidBrush( color
) );
1010 /***********************************************************************
1013 BOOL16 WINAPI
DeleteDC16( HDC16 hdc
)
1015 return DeleteDC( HDC_32(hdc
) );
1019 /***********************************************************************
1020 * DeleteObject (GDI.69)
1021 * SysDeleteObject (GDI.605)
1023 BOOL16 WINAPI
DeleteObject16( HGDIOBJ16 obj
)
1025 return DeleteObject( HGDIOBJ_32(obj
) );
1029 /***********************************************************************
1030 * EnumObjects (GDI.71)
1032 INT16 WINAPI
EnumObjects16( HDC16 hdc
, INT16 obj
, GOBJENUMPROC16 proc
, LPARAM lParam
)
1034 struct callback16_info info
;
1036 info
.proc
= (FARPROC16
)proc
;
1037 info
.param
= lParam
;
1041 return EnumObjects( HDC_32(hdc
), OBJ_PEN
, enum_pens_callback
, (LPARAM
)&info
);
1043 return EnumObjects( HDC_32(hdc
), OBJ_BRUSH
, enum_brushes_callback
, (LPARAM
)&info
);
1049 /***********************************************************************
1052 BOOL16 WINAPI
EqualRgn16( HRGN16 rgn1
, HRGN16 rgn2
)
1054 return EqualRgn( HRGN_32(rgn1
), HRGN_32(rgn2
) );
1058 /***********************************************************************
1059 * GetBitmapBits (GDI.74)
1061 LONG WINAPI
GetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPVOID buffer
)
1063 return GetBitmapBits( HBITMAP_32(hbitmap
), count
, buffer
);
1067 /***********************************************************************
1068 * GetBkColor (GDI.75)
1070 COLORREF WINAPI
GetBkColor16( HDC16 hdc
)
1072 return GetBkColor( HDC_32(hdc
) );
1076 /***********************************************************************
1077 * GetBkMode (GDI.76)
1079 INT16 WINAPI
GetBkMode16( HDC16 hdc
)
1081 return GetBkMode( HDC_32(hdc
) );
1085 /***********************************************************************
1086 * GetClipBox (GDI.77)
1088 INT16 WINAPI
GetClipBox16( HDC16 hdc
, LPRECT16 rect
)
1091 INT ret
= GetClipBox( HDC_32(hdc
), &rect32
);
1095 rect
->left
= rect32
.left
;
1096 rect
->top
= rect32
.top
;
1097 rect
->right
= rect32
.right
;
1098 rect
->bottom
= rect32
.bottom
;
1104 /***********************************************************************
1105 * GetCurrentPosition (GDI.78)
1107 DWORD WINAPI
GetCurrentPosition16( HDC16 hdc
)
1110 if (!GetCurrentPositionEx( HDC_32(hdc
), &pt32
)) return 0;
1111 return MAKELONG( pt32
.x
, pt32
.y
);
1115 /***********************************************************************
1118 DWORD WINAPI
GetDCOrg16( HDC16 hdc
)
1121 if (GetDCOrgEx( HDC_32(hdc
), &pt
)) return MAKELONG( pt
.x
, pt
.y
);
1126 /***********************************************************************
1127 * GetDeviceCaps (GDI.80)
1129 INT16 WINAPI
GetDeviceCaps16( HDC16 hdc
, INT16 cap
)
1131 INT16 ret
= GetDeviceCaps( HDC_32(hdc
), cap
);
1132 /* some apps don't expect -1 and think it's a B&W screen */
1133 if ((cap
== NUMCOLORS
) && (ret
== -1)) ret
= 2048;
1138 /***********************************************************************
1139 * GetMapMode (GDI.81)
1141 INT16 WINAPI
GetMapMode16( HDC16 hdc
)
1143 return GetMapMode( HDC_32(hdc
) );
1147 /***********************************************************************
1150 COLORREF WINAPI
GetPixel16( HDC16 hdc
, INT16 x
, INT16 y
)
1152 return GetPixel( HDC_32(hdc
), x
, y
);
1156 /***********************************************************************
1157 * GetPolyFillMode (GDI.84)
1159 INT16 WINAPI
GetPolyFillMode16( HDC16 hdc
)
1161 return GetPolyFillMode( HDC_32(hdc
) );
1165 /***********************************************************************
1168 INT16 WINAPI
GetROP216( HDC16 hdc
)
1170 return GetROP2( HDC_32(hdc
) );
1174 /***********************************************************************
1175 * GetRelAbs (GDI.86)
1177 INT16 WINAPI
GetRelAbs16( HDC16 hdc
)
1179 return GetRelAbs( HDC_32(hdc
), 0 );
1183 /***********************************************************************
1184 * GetStockObject (GDI.87)
1186 HGDIOBJ16 WINAPI
GetStockObject16( INT16 obj
)
1188 return HGDIOBJ_16( GetStockObject( obj
) );
1192 /***********************************************************************
1193 * GetStretchBltMode (GDI.88)
1195 INT16 WINAPI
GetStretchBltMode16( HDC16 hdc
)
1197 return GetStretchBltMode( HDC_32(hdc
) );
1201 /***********************************************************************
1202 * GetTextCharacterExtra (GDI.89)
1204 INT16 WINAPI
GetTextCharacterExtra16( HDC16 hdc
)
1206 return GetTextCharacterExtra( HDC_32(hdc
) );
1210 /***********************************************************************
1211 * GetTextColor (GDI.90)
1213 COLORREF WINAPI
GetTextColor16( HDC16 hdc
)
1215 return GetTextColor( HDC_32(hdc
) );
1219 /***********************************************************************
1220 * GetTextExtent (GDI.91)
1222 DWORD WINAPI
GetTextExtent16( HDC16 hdc
, LPCSTR str
, INT16 count
)
1225 if (!GetTextExtentPoint32A( HDC_32(hdc
), str
, count
, &size
)) return 0;
1226 return MAKELONG( size
.cx
, size
.cy
);
1230 /***********************************************************************
1231 * GetTextFace (GDI.92)
1233 INT16 WINAPI
GetTextFace16( HDC16 hdc
, INT16 count
, LPSTR name
)
1235 return GetTextFaceA( HDC_32(hdc
), count
, name
);
1239 /***********************************************************************
1240 * GetTextMetrics (GDI.93)
1242 BOOL16 WINAPI
GetTextMetrics16( HDC16 hdc
, TEXTMETRIC16
*tm
)
1246 if (!GetTextMetricsW( HDC_32(hdc
), &tm32
)) return FALSE
;
1248 tm
->tmHeight
= tm32
.tmHeight
;
1249 tm
->tmAscent
= tm32
.tmAscent
;
1250 tm
->tmDescent
= tm32
.tmDescent
;
1251 tm
->tmInternalLeading
= tm32
.tmInternalLeading
;
1252 tm
->tmExternalLeading
= tm32
.tmExternalLeading
;
1253 tm
->tmAveCharWidth
= tm32
.tmAveCharWidth
;
1254 tm
->tmMaxCharWidth
= tm32
.tmMaxCharWidth
;
1255 tm
->tmWeight
= tm32
.tmWeight
;
1256 tm
->tmOverhang
= tm32
.tmOverhang
;
1257 tm
->tmDigitizedAspectX
= tm32
.tmDigitizedAspectX
;
1258 tm
->tmDigitizedAspectY
= tm32
.tmDigitizedAspectY
;
1259 tm
->tmFirstChar
= tm32
.tmFirstChar
;
1260 tm
->tmLastChar
= tm32
.tmLastChar
;
1261 tm
->tmDefaultChar
= tm32
.tmDefaultChar
;
1262 tm
->tmBreakChar
= tm32
.tmBreakChar
;
1263 tm
->tmItalic
= tm32
.tmItalic
;
1264 tm
->tmUnderlined
= tm32
.tmUnderlined
;
1265 tm
->tmStruckOut
= tm32
.tmStruckOut
;
1266 tm
->tmPitchAndFamily
= tm32
.tmPitchAndFamily
;
1267 tm
->tmCharSet
= tm32
.tmCharSet
;
1272 /***********************************************************************
1273 * GetViewportExt (GDI.94)
1275 DWORD WINAPI
GetViewportExt16( HDC16 hdc
)
1278 if (!GetViewportExtEx( HDC_32(hdc
), &size
)) return 0;
1279 return MAKELONG( size
.cx
, size
.cy
);
1283 /***********************************************************************
1284 * GetViewportOrg (GDI.95)
1286 DWORD WINAPI
GetViewportOrg16( HDC16 hdc
)
1289 if (!GetViewportOrgEx( HDC_32(hdc
), &pt
)) return 0;
1290 return MAKELONG( pt
.x
, pt
.y
);
1294 /***********************************************************************
1295 * GetWindowExt (GDI.96)
1297 DWORD WINAPI
GetWindowExt16( HDC16 hdc
)
1300 if (!GetWindowExtEx( HDC_32(hdc
), &size
)) return 0;
1301 return MAKELONG( size
.cx
, size
.cy
);
1305 /***********************************************************************
1306 * GetWindowOrg (GDI.97)
1308 DWORD WINAPI
GetWindowOrg16( HDC16 hdc
)
1311 if (!GetWindowOrgEx( HDC_32(hdc
), &pt
)) return 0;
1312 return MAKELONG( pt
.x
, pt
.y
);
1318 /**********************************************************************
1321 void WINAPI
LineDDA16( INT16 nXStart
, INT16 nYStart
, INT16 nXEnd
,
1322 INT16 nYEnd
, LINEDDAPROC16 proc
, LPARAM lParam
)
1324 struct callback16_info info
;
1325 info
.proc
= (FARPROC16
)proc
;
1326 info
.param
= lParam
;
1327 LineDDA( nXStart
, nYStart
, nXEnd
, nYEnd
, linedda_callback
, (LPARAM
)&info
);
1331 /***********************************************************************
1332 * OffsetRgn (GDI.101)
1334 INT16 WINAPI
OffsetRgn16( HRGN16 hrgn
, INT16 x
, INT16 y
)
1336 return OffsetRgn( HRGN_32(hrgn
), x
, y
);
1340 /***********************************************************************
1341 * PtVisible (GDI.103)
1343 BOOL16 WINAPI
PtVisible16( HDC16 hdc
, INT16 x
, INT16 y
)
1345 return PtVisible( HDC_32(hdc
), x
, y
);
1349 /***********************************************************************
1350 * SelectVisRgn (GDI.105)
1352 INT16 WINAPI
SelectVisRgn16( HDC16 hdc
, HRGN16 hrgn
)
1354 return SelectVisRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
1358 /***********************************************************************
1359 * SetBitmapBits (GDI.106)
1361 LONG WINAPI
SetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPCVOID buffer
)
1363 return SetBitmapBits( HBITMAP_32(hbitmap
), count
, buffer
);
1367 /***********************************************************************
1368 * AddFontResource (GDI.119)
1370 INT16 WINAPI
AddFontResource16( LPCSTR filename
)
1372 return AddFontResourceA( filename
);
1376 /***********************************************************************
1379 * Disables GDI, switches back to text mode.
1380 * We don't have to do anything here,
1381 * just let console support handle everything
1383 void WINAPI
Death16(HDC16 hdc
)
1385 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc
);
1389 /***********************************************************************
1390 * Resurrection (GDI.122)
1392 * Restores GDI functionality
1394 void WINAPI
Resurrection16(HDC16 hdc
,
1395 WORD w1
, WORD w2
, WORD w3
, WORD w4
, WORD w5
, WORD w6
)
1397 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1398 hdc
, w1
, w2
, w3
, w4
, w5
, w6
);
1402 /**********************************************************************
1403 * CreateMetaFile (GDI.125)
1405 HDC16 WINAPI
CreateMetaFile16( LPCSTR filename
)
1407 return HDC_16( CreateMetaFileA( filename
) );
1411 /***********************************************************************
1414 INT16 WINAPI
MulDiv16( INT16 nMultiplicand
, INT16 nMultiplier
, INT16 nDivisor
)
1417 if (!nDivisor
) return -32768;
1418 /* We want to deal with a positive divisor to simplify the logic. */
1421 nMultiplicand
= - nMultiplicand
;
1422 nDivisor
= -nDivisor
;
1424 /* If the result is positive, we "add" to round. else,
1425 * we subtract to round. */
1426 if ( ( (nMultiplicand
< 0) && (nMultiplier
< 0) ) ||
1427 ( (nMultiplicand
>= 0) && (nMultiplier
>= 0) ) )
1428 ret
= (((int)nMultiplicand
* nMultiplier
) + (nDivisor
/2)) / nDivisor
;
1430 ret
= (((int)nMultiplicand
* nMultiplier
) - (nDivisor
/2)) / nDivisor
;
1431 if ((ret
> 32767) || (ret
< -32767)) return -32768;
1436 /***********************************************************************
1437 * GetRgnBox (GDI.134)
1439 INT16 WINAPI
GetRgnBox16( HRGN16 hrgn
, LPRECT16 rect
)
1442 INT16 ret
= GetRgnBox( HRGN_32(hrgn
), &r
);
1443 rect
->left
= r
.left
;
1445 rect
->right
= r
.right
;
1446 rect
->bottom
= r
.bottom
;
1451 /***********************************************************************
1452 * RemoveFontResource (GDI.136)
1454 BOOL16 WINAPI
RemoveFontResource16( LPCSTR str
)
1456 return RemoveFontResourceA(str
);
1460 /***********************************************************************
1461 * SetBrushOrg (GDI.148)
1463 DWORD WINAPI
SetBrushOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
1467 if (!SetBrushOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
1468 return MAKELONG( pt
.x
, pt
.y
);
1472 /***********************************************************************
1473 * GetBrushOrg (GDI.149)
1475 DWORD WINAPI
GetBrushOrg16( HDC16 hdc
)
1478 if (!GetBrushOrgEx( HDC_32(hdc
), &pt
)) return 0;
1479 return MAKELONG( pt
.x
, pt
.y
);
1483 /***********************************************************************
1484 * UnrealizeObject (GDI.150)
1486 BOOL16 WINAPI
UnrealizeObject16( HGDIOBJ16 obj
)
1488 return UnrealizeObject( HGDIOBJ_32(obj
) );
1492 /***********************************************************************
1493 * CreateIC (GDI.153)
1495 HDC16 WINAPI
CreateIC16( LPCSTR driver
, LPCSTR device
, LPCSTR output
,
1496 const DEVMODEA
* initData
)
1498 return HDC_16( CreateICA( driver
, device
, output
, initData
) );
1502 /***********************************************************************
1503 * GetNearestColor (GDI.154)
1505 COLORREF WINAPI
GetNearestColor16( HDC16 hdc
, COLORREF color
)
1507 return GetNearestColor( HDC_32(hdc
), color
);
1511 /***********************************************************************
1512 * CreateDiscardableBitmap (GDI.156)
1514 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
, INT16 height
)
1516 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc
), width
, height
) );
1520 /***********************************************************************
1521 * PtInRegion (GDI.161)
1523 BOOL16 WINAPI
PtInRegion16( HRGN16 hrgn
, INT16 x
, INT16 y
)
1525 return PtInRegion( HRGN_32(hrgn
), x
, y
);
1529 /***********************************************************************
1530 * GetBitmapDimension (GDI.162)
1532 DWORD WINAPI
GetBitmapDimension16( HBITMAP16 hbitmap
)
1535 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
1536 return MAKELONG( size
.cx
, size
.cy
);
1540 /***********************************************************************
1541 * SetBitmapDimension (GDI.163)
1543 DWORD WINAPI
SetBitmapDimension16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
1546 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
1547 return MAKELONG( size
.cx
, size
.cy
);
1551 /***********************************************************************
1552 * SetRectRgn (GDI.172)
1554 * NOTE: Win 3.1 sets region to empty if left > right
1556 void WINAPI
SetRectRgn16( HRGN16 hrgn
, INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
1558 if (left
< right
) SetRectRgn( HRGN_32(hrgn
), left
, top
, right
, bottom
);
1559 else SetRectRgn( HRGN_32(hrgn
), 0, 0, 0, 0 );
1563 /******************************************************************
1564 * PlayMetaFileRecord (GDI.176)
1566 void WINAPI
PlayMetaFileRecord16( HDC16 hdc
, HANDLETABLE16
*ht
, METARECORD
*mr
, UINT16 handles
)
1568 HANDLETABLE
*ht32
= HeapAlloc( GetProcessHeap(), 0, handles
* sizeof(*ht32
) );
1571 for (i
= 0; i
< handles
; i
++) ht32
->objectHandle
[i
] = (HGDIOBJ
)(ULONG_PTR
)ht
->objectHandle
[i
];
1572 PlayMetaFileRecord( HDC_32(hdc
), ht32
, mr
, handles
);
1573 for (i
= 0; i
< handles
; i
++) ht
->objectHandle
[i
] = LOWORD(ht32
->objectHandle
[i
]);
1574 HeapFree( GetProcessHeap(), 0, ht32
);
1578 /***********************************************************************
1579 * SetHookFlags (GDI.192)
1581 WORD WINAPI
SetHookFlags16( HDC16 hdc
, WORD flags
)
1583 return SetHookFlags( HDC_32(hdc
), flags
);
1587 /***********************************************************************
1588 * SetBoundsRect (GDI.193)
1590 UINT16 WINAPI
SetBoundsRect16( HDC16 hdc
, const RECT16
* rect
, UINT16 flags
)
1595 rect32
.left
= rect
->left
;
1596 rect32
.top
= rect
->top
;
1597 rect32
.right
= rect
->right
;
1598 rect32
.bottom
= rect
->bottom
;
1599 return SetBoundsRect( HDC_32( hdc
), &rect32
, flags
);
1601 else return SetBoundsRect( HDC_32( hdc
), NULL
, flags
);
1605 /***********************************************************************
1606 * GetBoundsRect (GDI.194)
1608 UINT16 WINAPI
GetBoundsRect16( HDC16 hdc
, LPRECT16 rect
, UINT16 flags
)
1611 UINT ret
= GetBoundsRect( HDC_32( hdc
), &rect32
, flags
);
1614 rect
->left
= rect32
.left
;
1615 rect
->top
= rect32
.top
;
1616 rect
->right
= rect32
.right
;
1617 rect
->bottom
= rect32
.bottom
;
1623 /***********************************************************************
1624 * EngineEnumerateFont (GDI.300)
1626 WORD WINAPI
EngineEnumerateFont16(LPSTR fontname
, FARPROC16 proc
, DWORD data
)
1628 FIXME("(%s,%p,%x),stub\n",fontname
,proc
,data
);
1633 /***********************************************************************
1634 * EngineDeleteFont (GDI.301)
1636 WORD WINAPI
EngineDeleteFont16(LPFONTINFO16 lpFontInfo
)
1640 /* untested, don't know if it works.
1641 We seem to access some structure that is located after the
1642 FONTINFO. The FONTINFO documentation says that there may
1643 follow some char-width table or font bitmap or vector info.
1644 I think it is some kind of font bitmap that begins at offset 0x52,
1645 as FONTINFO goes up to 0x51.
1646 If this is correct, everything should be implemented correctly.
1648 if ( ((lpFontInfo
->dfType
& (RASTER_FONTTYPE
|DEVICE_FONTTYPE
)) == (RASTER_FONTTYPE
|DEVICE_FONTTYPE
))
1649 && (LOWORD(lpFontInfo
->dfFace
) == LOWORD(lpFontInfo
)+0x6e)
1650 && (handle
= *(WORD
*)(lpFontInfo
+0x54)) )
1652 *(WORD
*)(lpFontInfo
+0x54) = 0;
1653 GlobalFree16(handle
);
1659 /***********************************************************************
1660 * EngineRealizeFont (GDI.302)
1662 WORD WINAPI
EngineRealizeFont16(LPLOGFONT16 lplogFont
, LPTEXTXFORM16 lptextxform
, LPFONTINFO16 lpfontInfo
)
1664 FIXME("(%p,%p,%p),stub\n",lplogFont
,lptextxform
,lpfontInfo
);
1670 /***********************************************************************
1671 * EngineRealizeFontExt (GDI.315)
1673 WORD WINAPI
EngineRealizeFontExt16(LONG l1
, LONG l2
, LONG l3
, LONG l4
)
1675 FIXME("(%08x,%08x,%08x,%08x),stub\n",l1
,l2
,l3
,l4
);
1681 /***********************************************************************
1682 * EngineGetCharWidth (GDI.303)
1684 WORD WINAPI
EngineGetCharWidth16(LPFONTINFO16 lpFontInfo
, BYTE firstChar
, BYTE lastChar
, LPINT16 buffer
)
1688 for (i
= firstChar
; i
<= lastChar
; i
++)
1689 FIXME(" returns font's average width for range %d to %d\n", firstChar
, lastChar
);
1690 *buffer
++ = lpFontInfo
->dfAvgWidth
; /* insert some charwidth functionality here; use average width for now */
1695 /***********************************************************************
1696 * EngineSetFontContext (GDI.304)
1698 WORD WINAPI
EngineSetFontContext(LPFONTINFO16 lpFontInfo
, WORD data
)
1704 /***********************************************************************
1705 * EngineGetGlyphBMP (GDI.305)
1707 WORD WINAPI
EngineGetGlyphBMP(WORD word
, LPFONTINFO16 lpFontInfo
, WORD w1
, WORD w2
,
1708 LPSTR string
, DWORD dword
, /*LPBITMAPMETRICS16*/ LPVOID metrics
)
1715 /***********************************************************************
1716 * EngineMakeFontDir (GDI.306)
1718 DWORD WINAPI
EngineMakeFontDir(HDC16 hdc
, LPFONTDIR16 fontdir
, LPCSTR string
)
1720 FIXME(" stub! (always fails)\n");
1721 return ~0UL; /* error */
1725 /***********************************************************************
1726 * GetCharABCWidths (GDI.307)
1728 BOOL16 WINAPI
GetCharABCWidths16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
, LPABC16 abc
)
1732 LPABC abc32
= HeapAlloc( GetProcessHeap(), 0, sizeof(ABC
) * (lastChar
- firstChar
+ 1) );
1734 if ((ret
= GetCharABCWidthsA( HDC_32(hdc
), firstChar
, lastChar
, abc32
)))
1736 for (i
= firstChar
; i
<= lastChar
; i
++)
1738 abc
[i
-firstChar
].abcA
= abc32
[i
-firstChar
].abcA
;
1739 abc
[i
-firstChar
].abcB
= abc32
[i
-firstChar
].abcB
;
1740 abc
[i
-firstChar
].abcC
= abc32
[i
-firstChar
].abcC
;
1743 HeapFree( GetProcessHeap(), 0, abc32
);
1748 /***********************************************************************
1749 * GetOutlineTextMetrics (GDI.308)
1751 * Gets metrics for TrueType fonts.
1754 * hdc [In] Handle of device context
1755 * cbData [In] Size of metric data array
1756 * lpOTM [Out] Address of metric data array
1759 * Success: Non-zero or size of required buffer
1763 * lpOTM should be LPOUTLINETEXTMETRIC
1765 UINT16 WINAPI
GetOutlineTextMetrics16( HDC16 hdc
, UINT16 cbData
,
1766 LPOUTLINETEXTMETRIC16 lpOTM
)
1768 FIXME("(%04x,%04x,%p): stub\n", hdc
,cbData
,lpOTM
);
1773 /***********************************************************************
1774 * GetGlyphOutline (GDI.309)
1776 DWORD WINAPI
GetGlyphOutline16( HDC16 hdc
, UINT16 uChar
, UINT16 fuFormat
,
1777 LPGLYPHMETRICS16 lpgm
, DWORD cbBuffer
,
1778 LPVOID lpBuffer
, const MAT2
*lpmat2
)
1783 ret
= GetGlyphOutlineA( HDC_32(hdc
), uChar
, fuFormat
, &gm32
, cbBuffer
, lpBuffer
, lpmat2
);
1784 lpgm
->gmBlackBoxX
= gm32
.gmBlackBoxX
;
1785 lpgm
->gmBlackBoxY
= gm32
.gmBlackBoxY
;
1786 lpgm
->gmptGlyphOrigin
.x
= gm32
.gmptGlyphOrigin
.x
;
1787 lpgm
->gmptGlyphOrigin
.y
= gm32
.gmptGlyphOrigin
.y
;
1788 lpgm
->gmCellIncX
= gm32
.gmCellIncX
;
1789 lpgm
->gmCellIncY
= gm32
.gmCellIncY
;
1794 /***********************************************************************
1795 * CreateScalableFontResource (GDI.310)
1797 BOOL16 WINAPI
CreateScalableFontResource16( UINT16 fHidden
, LPCSTR lpszResourceFile
,
1798 LPCSTR fontFile
, LPCSTR path
)
1800 return CreateScalableFontResourceA( fHidden
, lpszResourceFile
, fontFile
, path
);
1804 /*************************************************************************
1805 * GetFontData (GDI.311)
1808 DWORD WINAPI
GetFontData16( HDC16 hdc
, DWORD table
, DWORD offset
, LPVOID buffer
, DWORD count
)
1810 return GetFontData( HDC_32(hdc
), table
, offset
, buffer
, count
);
1814 /*************************************************************************
1815 * GetRasterizerCaps (GDI.313)
1817 BOOL16 WINAPI
GetRasterizerCaps16( LPRASTERIZER_STATUS lprs
, UINT16 cbNumBytes
)
1819 return GetRasterizerCaps( lprs
, cbNumBytes
);
1823 /*************************************************************************
1824 * GetKerningPairs (GDI.332)
1827 INT16 WINAPI
GetKerningPairs16( HDC16 hdc
, INT16 count
, LPKERNINGPAIR16 pairs
)
1829 KERNINGPAIR
*pairs32
;
1832 if (!count
) return 0;
1834 if (!(pairs32
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(*pairs32
) ))) return 0;
1835 if ((ret
= GetKerningPairsA( HDC_32(hdc
), count
, pairs32
)))
1837 for (i
= 0; i
< ret
; i
++)
1839 pairs
->wFirst
= pairs32
->wFirst
;
1840 pairs
->wSecond
= pairs32
->wSecond
;
1841 pairs
->iKernAmount
= pairs32
->iKernAmount
;
1844 HeapFree( GetProcessHeap(), 0, pairs32
);
1850 /***********************************************************************
1851 * GetTextAlign (GDI.345)
1853 UINT16 WINAPI
GetTextAlign16( HDC16 hdc
)
1855 return GetTextAlign( HDC_32(hdc
) );
1859 /***********************************************************************
1860 * SetTextAlign (GDI.346)
1862 UINT16 WINAPI
SetTextAlign16( HDC16 hdc
, UINT16 align
)
1864 return SetTextAlign( HDC_32(hdc
), align
);
1868 /***********************************************************************
1871 BOOL16 WINAPI
Chord16( HDC16 hdc
, INT16 left
, INT16 top
,
1872 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
1873 INT16 xend
, INT16 yend
)
1875 return Chord( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
1879 /***********************************************************************
1880 * SetMapperFlags (GDI.349)
1882 DWORD WINAPI
SetMapperFlags16( HDC16 hdc
, DWORD flags
)
1884 return SetMapperFlags( HDC_32(hdc
), flags
);
1888 /***********************************************************************
1889 * GetCharWidth (GDI.350)
1891 BOOL16 WINAPI
GetCharWidth16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
, LPINT16 buffer
)
1893 BOOL retVal
= FALSE
;
1895 if( firstChar
!= lastChar
)
1897 LPINT buf32
= HeapAlloc(GetProcessHeap(), 0, sizeof(INT
)*(1 + (lastChar
- firstChar
)));
1900 LPINT obuf32
= buf32
;
1903 retVal
= GetCharWidth32A( HDC_32(hdc
), firstChar
, lastChar
, buf32
);
1906 for (i
= firstChar
; i
<= lastChar
; i
++) *buffer
++ = *buf32
++;
1908 HeapFree(GetProcessHeap(), 0, obuf32
);
1911 else /* happens quite often to warrant a special treatment */
1914 retVal
= GetCharWidth32A( HDC_32(hdc
), firstChar
, lastChar
, &chWidth
);
1921 /***********************************************************************
1922 * ExtTextOut (GDI.351)
1924 BOOL16 WINAPI
ExtTextOut16( HDC16 hdc
, INT16 x
, INT16 y
, UINT16 flags
,
1925 const RECT16
*lprect
, LPCSTR str
, UINT16 count
,
1931 LPINT lpdx32
= NULL
;
1934 lpdx32
= HeapAlloc( GetProcessHeap(),0, sizeof(INT
)*count
);
1935 if(lpdx32
== NULL
) return FALSE
;
1936 for (i
=count
;i
--;) lpdx32
[i
]=lpDx
[i
];
1940 rect32
.left
= lprect
->left
;
1941 rect32
.top
= lprect
->top
;
1942 rect32
.right
= lprect
->right
;
1943 rect32
.bottom
= lprect
->bottom
;
1945 ret
= ExtTextOutA(HDC_32(hdc
),x
,y
,flags
,lprect
?&rect32
:NULL
,str
,count
,lpdx32
);
1946 HeapFree( GetProcessHeap(), 0, lpdx32
);
1951 /***********************************************************************
1952 * CreatePalette (GDI.360)
1954 HPALETTE16 WINAPI
CreatePalette16( const LOGPALETTE
* palette
)
1956 return HPALETTE_16( CreatePalette( palette
) );
1960 /***********************************************************************
1961 * GDISelectPalette (GDI.361)
1963 HPALETTE16 WINAPI
GDISelectPalette16( HDC16 hdc
, HPALETTE16 hpalette
, WORD wBkg
)
1965 return HPALETTE_16( GDISelectPalette( HDC_32(hdc
), HPALETTE_32(hpalette
), wBkg
));
1969 /***********************************************************************
1970 * GDIRealizePalette (GDI.362)
1972 UINT16 WINAPI
GDIRealizePalette16( HDC16 hdc
)
1974 return GDIRealizePalette( HDC_32(hdc
) );
1978 /***********************************************************************
1979 * GetPaletteEntries (GDI.363)
1981 UINT16 WINAPI
GetPaletteEntries16( HPALETTE16 hpalette
, UINT16 start
,
1982 UINT16 count
, LPPALETTEENTRY entries
)
1984 return GetPaletteEntries( HPALETTE_32(hpalette
), start
, count
, entries
);
1988 /***********************************************************************
1989 * SetPaletteEntries (GDI.364)
1991 UINT16 WINAPI
SetPaletteEntries16( HPALETTE16 hpalette
, UINT16 start
,
1992 UINT16 count
, const PALETTEENTRY
*entries
)
1994 return SetPaletteEntries( HPALETTE_32(hpalette
), start
, count
, entries
);
1998 /**********************************************************************
1999 * UpdateColors (GDI.366)
2001 INT16 WINAPI
UpdateColors16( HDC16 hdc
)
2003 UpdateColors( HDC_32(hdc
) );
2008 /***********************************************************************
2009 * AnimatePalette (GDI.367)
2011 void WINAPI
AnimatePalette16( HPALETTE16 hpalette
, UINT16 StartIndex
,
2012 UINT16 NumEntries
, const PALETTEENTRY
* PaletteColors
)
2014 AnimatePalette( HPALETTE_32(hpalette
), StartIndex
, NumEntries
, PaletteColors
);
2018 /***********************************************************************
2019 * ResizePalette (GDI.368)
2021 BOOL16 WINAPI
ResizePalette16( HPALETTE16 hpalette
, UINT16 cEntries
)
2023 return ResizePalette( HPALETTE_32(hpalette
), cEntries
);
2027 /***********************************************************************
2028 * GetNearestPaletteIndex (GDI.370)
2030 UINT16 WINAPI
GetNearestPaletteIndex16( HPALETTE16 hpalette
, COLORREF color
)
2032 return GetNearestPaletteIndex( HPALETTE_32(hpalette
), color
);
2036 /**********************************************************************
2037 * ExtFloodFill (GDI.372)
2039 BOOL16 WINAPI
ExtFloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
,
2042 return ExtFloodFill( HDC_32(hdc
), x
, y
, color
, fillType
);
2046 /***********************************************************************
2047 * SetSystemPaletteUse (GDI.373)
2049 UINT16 WINAPI
SetSystemPaletteUse16( HDC16 hdc
, UINT16 use
)
2051 return SetSystemPaletteUse( HDC_32(hdc
), use
);
2055 /***********************************************************************
2056 * GetSystemPaletteUse (GDI.374)
2058 UINT16 WINAPI
GetSystemPaletteUse16( HDC16 hdc
)
2060 return GetSystemPaletteUse( HDC_32(hdc
) );
2064 /***********************************************************************
2065 * GetSystemPaletteEntries (GDI.375)
2067 UINT16 WINAPI
GetSystemPaletteEntries16( HDC16 hdc
, UINT16 start
, UINT16 count
,
2068 LPPALETTEENTRY entries
)
2070 return GetSystemPaletteEntries( HDC_32(hdc
), start
, count
, entries
);
2074 /***********************************************************************
2077 HDC16 WINAPI
ResetDC16( HDC16 hdc
, const DEVMODEA
*devmode
)
2079 return HDC_16( ResetDCA(HDC_32(hdc
), devmode
) );
2083 /******************************************************************
2084 * StartDoc (GDI.377)
2086 INT16 WINAPI
StartDoc16( HDC16 hdc
, const DOCINFO16
*lpdoc
)
2090 docA
.cbSize
= lpdoc
->cbSize
;
2091 docA
.lpszDocName
= MapSL(lpdoc
->lpszDocName
);
2092 docA
.lpszOutput
= MapSL(lpdoc
->lpszOutput
);
2093 if(lpdoc
->cbSize
> offsetof(DOCINFO16
,lpszDatatype
))
2094 docA
.lpszDatatype
= MapSL(lpdoc
->lpszDatatype
);
2096 docA
.lpszDatatype
= NULL
;
2097 if(lpdoc
->cbSize
> offsetof(DOCINFO16
,fwType
))
2098 docA
.fwType
= lpdoc
->fwType
;
2101 return StartDocA( HDC_32(hdc
), &docA
);
2105 /******************************************************************
2108 INT16 WINAPI
EndDoc16( HDC16 hdc
)
2110 return EndDoc( HDC_32(hdc
) );
2114 /******************************************************************
2115 * StartPage (GDI.379)
2117 INT16 WINAPI
StartPage16( HDC16 hdc
)
2119 return StartPage( HDC_32(hdc
) );
2123 /******************************************************************
2126 INT16 WINAPI
EndPage16( HDC16 hdc
)
2128 return EndPage( HDC_32(hdc
) );
2132 /******************************************************************************
2133 * AbortDoc (GDI.382)
2135 INT16 WINAPI
AbortDoc16( HDC16 hdc
)
2137 return AbortDoc( HDC_32(hdc
) );
2141 /***********************************************************************
2142 * FastWindowFrame (GDI.400)
2144 BOOL16 WINAPI
FastWindowFrame16( HDC16 hdc
, const RECT16
*rect
,
2145 INT16 width
, INT16 height
, DWORD rop
)
2147 HDC hdc32
= HDC_32(hdc
);
2148 HBRUSH hbrush
= SelectObject( hdc32
, GetStockObject( GRAY_BRUSH
) );
2149 PatBlt( hdc32
, rect
->left
, rect
->top
,
2150 rect
->right
- rect
->left
- width
, height
, rop
);
2151 PatBlt( hdc32
, rect
->left
, rect
->top
+ height
, width
,
2152 rect
->bottom
- rect
->top
- height
, rop
);
2153 PatBlt( hdc32
, rect
->left
+ width
, rect
->bottom
- 1,
2154 rect
->right
- rect
->left
- width
, -height
, rop
);
2155 PatBlt( hdc32
, rect
->right
- 1, rect
->top
, -width
,
2156 rect
->bottom
- rect
->top
- height
, rop
);
2157 SelectObject( hdc32
, hbrush
);
2162 /***********************************************************************
2163 * CreateUserBitmap (GDI.407)
2165 HBITMAP16 WINAPI
CreateUserBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
2166 UINT16 bpp
, LPCVOID bits
)
2168 return CreateBitmap16( width
, height
, planes
, bpp
, bits
);
2172 /***********************************************************************
2173 * CreateUserDiscardableBitmap (GDI.409)
2175 HBITMAP16 WINAPI
CreateUserDiscardableBitmap16( WORD dummy
, INT16 width
, INT16 height
)
2177 HDC hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
2178 HBITMAP ret
= CreateCompatibleBitmap( hdc
, width
, height
);
2180 return HBITMAP_16(ret
);
2184 /***********************************************************************
2185 * GetCurLogFont (GDI.411)
2187 HFONT16 WINAPI
GetCurLogFont16( HDC16 hdc
)
2189 return HFONT_16( GetCurrentObject( HDC_32(hdc
), OBJ_FONT
) );
2193 /***********************************************************************
2194 * StretchDIBits (GDI.439)
2196 INT16 WINAPI
StretchDIBits16( HDC16 hdc
, INT16 xDst
, INT16 yDst
, INT16 widthDst
,
2197 INT16 heightDst
, INT16 xSrc
, INT16 ySrc
, INT16 widthSrc
,
2198 INT16 heightSrc
, const VOID
*bits
,
2199 const BITMAPINFO
*info
, UINT16 wUsage
, DWORD dwRop
)
2201 return StretchDIBits( HDC_32(hdc
), xDst
, yDst
, widthDst
, heightDst
,
2202 xSrc
, ySrc
, widthSrc
, heightSrc
, bits
,
2203 info
, wUsage
, dwRop
);
2207 /***********************************************************************
2208 * SetDIBits (GDI.440)
2210 INT16 WINAPI
SetDIBits16( HDC16 hdc
, HBITMAP16 hbitmap
, UINT16 startscan
,
2211 UINT16 lines
, LPCVOID bits
, const BITMAPINFO
*info
,
2214 return SetDIBits( HDC_32(hdc
), HBITMAP_32(hbitmap
), startscan
, lines
, bits
, info
, coloruse
);
2218 /***********************************************************************
2219 * GetDIBits (GDI.441)
2221 INT16 WINAPI
GetDIBits16( HDC16 hdc
, HBITMAP16 hbitmap
, UINT16 startscan
,
2222 UINT16 lines
, LPVOID bits
, BITMAPINFO
* info
,
2225 return GetDIBits( HDC_32(hdc
), HBITMAP_32(hbitmap
), startscan
, lines
, bits
, info
, coloruse
);
2229 /***********************************************************************
2230 * CreateDIBitmap (GDI.442)
2232 HBITMAP16 WINAPI
CreateDIBitmap16( HDC16 hdc
, const BITMAPINFOHEADER
* header
,
2233 DWORD init
, LPCVOID bits
, const BITMAPINFO
* data
,
2236 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc
), header
, init
, bits
, data
, coloruse
) );
2240 /***********************************************************************
2241 * SetDIBitsToDevice (GDI.443)
2243 INT16 WINAPI
SetDIBitsToDevice16( HDC16 hdc
, INT16 xDest
, INT16 yDest
, INT16 cx
,
2244 INT16 cy
, INT16 xSrc
, INT16 ySrc
, UINT16 startscan
,
2245 UINT16 lines
, LPCVOID bits
, const BITMAPINFO
*info
,
2248 return SetDIBitsToDevice( HDC_32(hdc
), xDest
, yDest
, cx
, cy
, xSrc
, ySrc
,
2249 startscan
, lines
, bits
, info
, coloruse
);
2253 /***********************************************************************
2254 * CreateRoundRectRgn (GDI.444)
2256 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2257 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2258 * we just let CreateRoundRectRgn convert them to +ve values.
2261 HRGN16 WINAPI
CreateRoundRectRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
,
2262 INT16 ellipse_width
, INT16 ellipse_height
)
2264 if( ellipse_width
== 0 || ellipse_height
== 0 )
2265 return CreateRectRgn16( left
, top
, right
, bottom
);
2267 return HRGN_16( CreateRoundRectRgn( left
, top
, right
, bottom
,
2268 ellipse_width
, ellipse_height
));
2272 /***********************************************************************
2273 * CreateDIBPatternBrush (GDI.445)
2275 HBRUSH16 WINAPI
CreateDIBPatternBrush16( HGLOBAL16 hbitmap
, UINT16 coloruse
)
2280 if (!(bmi
= GlobalLock16( hbitmap
))) return 0;
2281 ret
= HBRUSH_16( CreateDIBPatternBrushPt( bmi
, coloruse
));
2282 GlobalUnlock16( hbitmap
);
2287 /**********************************************************************
2288 * PolyPolygon (GDI.450)
2290 BOOL16 WINAPI
PolyPolygon16( HDC16 hdc
, const POINT16
* pt
, const INT16
* counts
,
2299 for (i
=polygons
;i
--;)
2301 pt32
= HeapAlloc( GetProcessHeap(), 0, sizeof(POINT
)*nrpts
);
2302 if(pt32
== NULL
) return FALSE
;
2305 pt32
[i
].x
= pt
[i
].x
;
2306 pt32
[i
].y
= pt
[i
].y
;
2308 counts32
= HeapAlloc( GetProcessHeap(), 0, polygons
*sizeof(INT
) );
2309 if(counts32
== NULL
) {
2310 HeapFree( GetProcessHeap(), 0, pt32
);
2313 for (i
=polygons
;i
--;) counts32
[i
]=counts
[i
];
2315 ret
= PolyPolygon(HDC_32(hdc
),pt32
,counts32
,polygons
);
2316 HeapFree( GetProcessHeap(), 0, counts32
);
2317 HeapFree( GetProcessHeap(), 0, pt32
);
2322 /***********************************************************************
2323 * CreatePolyPolygonRgn (GDI.451)
2325 HRGN16 WINAPI
CreatePolyPolygonRgn16( const POINT16
*points
,
2326 const INT16
*count
, INT16 nbpolygons
, INT16 mode
)
2333 for (i
= 0; i
< nbpolygons
; i
++) npts
+= count
[i
];
2334 points32
= HeapAlloc( GetProcessHeap(), 0, npts
* sizeof(POINT
) );
2335 for (i
= 0; i
< npts
; i
++)
2337 points32
[i
].x
= points
[i
].x
;
2338 points32
[i
].y
= points
[i
].y
;
2341 count32
= HeapAlloc( GetProcessHeap(), 0, nbpolygons
* sizeof(INT
) );
2342 for (i
= 0; i
< nbpolygons
; i
++) count32
[i
] = count
[i
];
2343 hrgn
= CreatePolyPolygonRgn( points32
, count32
, nbpolygons
, mode
);
2344 HeapFree( GetProcessHeap(), 0, count32
);
2345 HeapFree( GetProcessHeap(), 0, points32
);
2346 return HRGN_16(hrgn
);
2350 /***********************************************************************
2351 * SetObjectOwner (GDI.461)
2353 void WINAPI
SetObjectOwner16( HGDIOBJ16 handle
, HANDLE16 owner
)
2359 /***********************************************************************
2360 * RectVisible (GDI.465)
2361 * RectVisibleOld (GDI.104)
2363 BOOL16 WINAPI
RectVisible16( HDC16 hdc
, const RECT16
* rect16
)
2367 rect
.left
= rect16
->left
;
2368 rect
.top
= rect16
->top
;
2369 rect
.right
= rect16
->right
;
2370 rect
.bottom
= rect16
->bottom
;
2371 return RectVisible( HDC_32(hdc
), &rect
);
2375 /***********************************************************************
2376 * RectInRegion (GDI.466)
2377 * RectInRegionOld (GDI.181)
2379 BOOL16 WINAPI
RectInRegion16( HRGN16 hrgn
, const RECT16
*rect
)
2383 r32
.left
= rect
->left
;
2384 r32
.top
= rect
->top
;
2385 r32
.right
= rect
->right
;
2386 r32
.bottom
= rect
->bottom
;
2387 return RectInRegion( HRGN_32(hrgn
), &r32
);
2391 /***********************************************************************
2392 * GetBitmapDimensionEx (GDI.468)
2394 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
2397 BOOL ret
= GetBitmapDimensionEx( HBITMAP_32(hbitmap
), &size32
);
2401 size
->cx
= size32
.cx
;
2402 size
->cy
= size32
.cy
;
2408 /***********************************************************************
2409 * GetBrushOrgEx (GDI.469)
2411 BOOL16 WINAPI
GetBrushOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
2414 if (!GetBrushOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2421 /***********************************************************************
2422 * GetCurrentPositionEx (GDI.470)
2424 BOOL16 WINAPI
GetCurrentPositionEx16( HDC16 hdc
, LPPOINT16 pt
)
2427 if (!GetCurrentPositionEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2434 /***********************************************************************
2435 * GetTextExtentPoint (GDI.471)
2437 * FIXME: Should this have a bug for compatibility?
2438 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2439 * bugs (-> MSDN KB q147647.txt).
2441 BOOL16 WINAPI
GetTextExtentPoint16( HDC16 hdc
, LPCSTR str
, INT16 count
, LPSIZE16 size
)
2444 BOOL ret
= GetTextExtentPoint32A( HDC_32(hdc
), str
, count
, &size32
);
2448 size
->cx
= size32
.cx
;
2449 size
->cy
= size32
.cy
;
2455 /***********************************************************************
2456 * GetViewportExtEx (GDI.472)
2458 BOOL16 WINAPI
GetViewportExtEx16( HDC16 hdc
, LPSIZE16 size
)
2461 if (!GetViewportExtEx( HDC_32(hdc
), &size32
)) return FALSE
;
2462 size
->cx
= size32
.cx
;
2463 size
->cy
= size32
.cy
;
2468 /***********************************************************************
2469 * GetViewportOrgEx (GDI.473)
2471 BOOL16 WINAPI
GetViewportOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
2474 if (!GetViewportOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2481 /***********************************************************************
2482 * GetWindowExtEx (GDI.474)
2484 BOOL16 WINAPI
GetWindowExtEx16( HDC16 hdc
, LPSIZE16 size
)
2487 if (!GetWindowExtEx( HDC_32(hdc
), &size32
)) return FALSE
;
2488 size
->cx
= size32
.cx
;
2489 size
->cy
= size32
.cy
;
2494 /***********************************************************************
2495 * GetWindowOrgEx (GDI.475)
2497 BOOL16 WINAPI
GetWindowOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
2500 if (!GetWindowOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2507 /***********************************************************************
2508 * OffsetViewportOrgEx (GDI.476)
2510 BOOL16 WINAPI
OffsetViewportOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2513 BOOL16 ret
= OffsetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2523 /***********************************************************************
2524 * OffsetWindowOrgEx (GDI.477)
2526 BOOL16 WINAPI
OffsetWindowOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2529 BOOL16 ret
= OffsetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2539 /***********************************************************************
2540 * SetBitmapDimensionEx (GDI.478)
2542 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
, LPSIZE16 prevSize
)
2545 BOOL ret
= SetBitmapDimensionEx( HBITMAP_32(hbitmap
), x
, y
, &size32
);
2547 if (ret
&& prevSize
)
2549 prevSize
->cx
= size32
.cx
;
2550 prevSize
->cy
= size32
.cy
;
2556 /***********************************************************************
2557 * SetViewportExtEx (GDI.479)
2559 BOOL16 WINAPI
SetViewportExtEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPSIZE16 size
)
2562 BOOL16 ret
= SetViewportExtEx( HDC_32(hdc
), x
, y
, &size32
);
2563 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
2568 /***********************************************************************
2569 * SetViewportOrgEx (GDI.480)
2571 BOOL16 WINAPI
SetViewportOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2574 BOOL16 ret
= SetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2584 /***********************************************************************
2585 * SetWindowExtEx (GDI.481)
2587 BOOL16 WINAPI
SetWindowExtEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPSIZE16 size
)
2590 BOOL16 ret
= SetWindowExtEx( HDC_32(hdc
), x
, y
, &size32
);
2591 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
2596 /***********************************************************************
2597 * SetWindowOrgEx (GDI.482)
2599 BOOL16 WINAPI
SetWindowOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2602 BOOL16 ret
= SetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2612 /***********************************************************************
2613 * MoveToEx (GDI.483)
2615 BOOL16 WINAPI
MoveToEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2619 if (!MoveToEx( HDC_32(hdc
), x
, y
, &pt32
)) return FALSE
;
2629 /***********************************************************************
2630 * ScaleViewportExtEx (GDI.484)
2632 BOOL16 WINAPI
ScaleViewportExtEx16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
2633 INT16 yNum
, INT16 yDenom
, LPSIZE16 size
)
2636 BOOL16 ret
= ScaleViewportExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
,
2638 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
2643 /***********************************************************************
2644 * ScaleWindowExtEx (GDI.485)
2646 BOOL16 WINAPI
ScaleWindowExtEx16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
2647 INT16 yNum
, INT16 yDenom
, LPSIZE16 size
)
2650 BOOL16 ret
= ScaleWindowExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
,
2652 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
2657 /***********************************************************************
2658 * GetAspectRatioFilterEx (GDI.486)
2660 BOOL16 WINAPI
GetAspectRatioFilterEx16( HDC16 hdc
, LPSIZE16 pAspectRatio
)
2662 FIXME("(%04x, %p): -- Empty Stub !\n", hdc
, pAspectRatio
);
2667 /******************************************************************************
2668 * PolyBezier (GDI.502)
2670 BOOL16 WINAPI
PolyBezier16( HDC16 hdc
, const POINT16
* lppt
, INT16 cPoints
)
2674 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, cPoints
*sizeof(POINT
) );
2675 if(!pt32
) return FALSE
;
2676 for (i
=cPoints
;i
--;)
2678 pt32
[i
].x
= lppt
[i
].x
;
2679 pt32
[i
].y
= lppt
[i
].y
;
2681 ret
= PolyBezier(HDC_32(hdc
), pt32
, cPoints
);
2682 HeapFree( GetProcessHeap(), 0, pt32
);
2687 /******************************************************************************
2688 * PolyBezierTo (GDI.503)
2690 BOOL16 WINAPI
PolyBezierTo16( HDC16 hdc
, const POINT16
* lppt
, INT16 cPoints
)
2694 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0,
2695 cPoints
*sizeof(POINT
) );
2696 if(!pt32
) return FALSE
;
2697 for (i
=cPoints
;i
--;)
2699 pt32
[i
].x
= lppt
[i
].x
;
2700 pt32
[i
].y
= lppt
[i
].y
;
2702 ret
= PolyBezierTo(HDC_32(hdc
), pt32
, cPoints
);
2703 HeapFree( GetProcessHeap(), 0, pt32
);
2708 /******************************************************************************
2709 * ExtSelectClipRgn (GDI.508)
2711 INT16 WINAPI
ExtSelectClipRgn16( HDC16 hdc
, HRGN16 hrgn
, INT16 fnMode
)
2713 return ExtSelectClipRgn( HDC_32(hdc
), HRGN_32(hrgn
), fnMode
);
2717 /***********************************************************************
2718 * AbortPath (GDI.511)
2720 BOOL16 WINAPI
AbortPath16(HDC16 hdc
)
2722 return AbortPath( HDC_32(hdc
) );
2726 /***********************************************************************
2727 * BeginPath (GDI.512)
2729 BOOL16 WINAPI
BeginPath16(HDC16 hdc
)
2731 return BeginPath( HDC_32(hdc
) );
2735 /***********************************************************************
2736 * CloseFigure (GDI.513)
2738 BOOL16 WINAPI
CloseFigure16(HDC16 hdc
)
2740 return CloseFigure( HDC_32(hdc
) );
2744 /***********************************************************************
2747 BOOL16 WINAPI
EndPath16(HDC16 hdc
)
2749 return EndPath( HDC_32(hdc
) );
2753 /***********************************************************************
2754 * FillPath (GDI.515)
2756 BOOL16 WINAPI
FillPath16(HDC16 hdc
)
2758 return FillPath( HDC_32(hdc
) );
2762 /*******************************************************************
2763 * FlattenPath (GDI.516)
2765 BOOL16 WINAPI
FlattenPath16(HDC16 hdc
)
2767 return FlattenPath( HDC_32(hdc
) );
2771 /***********************************************************************
2774 INT16 WINAPI
GetPath16(HDC16 hdc
, LPPOINT16 pPoints
, LPBYTE pTypes
, INT16 nSize
)
2776 FIXME("(%d,%p,%p): stub\n",hdc
,pPoints
,pTypes
);
2781 /***********************************************************************
2782 * PathToRegion (GDI.518)
2784 HRGN16 WINAPI
PathToRegion16(HDC16 hdc
)
2786 return HRGN_16( PathToRegion( HDC_32(hdc
) ));
2790 /***********************************************************************
2791 * SelectClipPath (GDI.519)
2793 BOOL16 WINAPI
SelectClipPath16(HDC16 hdc
, INT16 iMode
)
2795 return SelectClipPath( HDC_32(hdc
), iMode
);
2799 /*******************************************************************
2800 * StrokeAndFillPath (GDI.520)
2802 BOOL16 WINAPI
StrokeAndFillPath16(HDC16 hdc
)
2804 return StrokeAndFillPath( HDC_32(hdc
) );
2808 /*******************************************************************
2809 * StrokePath (GDI.521)
2811 BOOL16 WINAPI
StrokePath16(HDC16 hdc
)
2813 return StrokePath( HDC_32(hdc
) );
2817 /*******************************************************************
2818 * WidenPath (GDI.522)
2820 BOOL16 WINAPI
WidenPath16(HDC16 hdc
)
2822 return WidenPath( HDC_32(hdc
) );
2826 /***********************************************************************
2827 * GetArcDirection (GDI.524)
2829 INT16 WINAPI
GetArcDirection16( HDC16 hdc
)
2831 return GetArcDirection( HDC_32(hdc
) );
2835 /***********************************************************************
2836 * SetArcDirection (GDI.525)
2838 INT16 WINAPI
SetArcDirection16( HDC16 hdc
, INT16 nDirection
)
2840 return SetArcDirection( HDC_32(hdc
), (INT
)nDirection
);
2844 /***********************************************************************
2845 * CreateHalftonePalette (GDI.529)
2847 HPALETTE16 WINAPI
CreateHalftonePalette16( HDC16 hdc
)
2849 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc
) ));
2853 /***********************************************************************
2854 * SetDIBColorTable (GDI.602)
2856 UINT16 WINAPI
SetDIBColorTable16( HDC16 hdc
, UINT16 startpos
, UINT16 entries
, RGBQUAD
*colors
)
2858 return SetDIBColorTable( HDC_32(hdc
), startpos
, entries
, colors
);
2862 /***********************************************************************
2863 * GetDIBColorTable (GDI.603)
2865 UINT16 WINAPI
GetDIBColorTable16( HDC16 hdc
, UINT16 startpos
, UINT16 entries
, RGBQUAD
*colors
)
2867 return GetDIBColorTable( HDC_32(hdc
), startpos
, entries
, colors
);
2871 /***********************************************************************
2872 * GetRegionData (GDI.607)
2874 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
2876 DWORD WINAPI
GetRegionData16( HRGN16 hrgn
, DWORD count
, LPRGNDATA rgndata
)
2878 return GetRegionData( HRGN_32(hrgn
), count
, rgndata
);
2882 /***********************************************************************
2883 * GetTextCharset (GDI.612)
2885 UINT16 WINAPI
GetTextCharset16( HDC16 hdc
)
2887 return GetTextCharset( HDC_32(hdc
) );
2891 /*************************************************************************
2892 * GetFontLanguageInfo (GDI.616)
2894 DWORD WINAPI
GetFontLanguageInfo16( HDC16 hdc
)
2896 return GetFontLanguageInfo( HDC_32(hdc
) );
2900 /***********************************************************************
2901 * SetLayout (GDI.1000)
2903 * Sets left->right or right->left text layout flags of a dc.
2905 BOOL16 WINAPI
SetLayout16( HDC16 hdc
, DWORD layout
)
2907 return SetLayout( HDC_32(hdc
), layout
);