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/list.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
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
;
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
;
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
);
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
;
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
);
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;
123 /* convert a LOGFONTW to a LOGFONT16 */
124 static void logfont_W_to_16( const LOGFONTW
* font32
, LPLOGFONT16 font16
)
126 font16
->lfHeight
= font32
->lfHeight
;
127 font16
->lfWidth
= font32
->lfWidth
;
128 font16
->lfEscapement
= font32
->lfEscapement
;
129 font16
->lfOrientation
= font32
->lfOrientation
;
130 font16
->lfWeight
= font32
->lfWeight
;
131 font16
->lfItalic
= font32
->lfItalic
;
132 font16
->lfUnderline
= font32
->lfUnderline
;
133 font16
->lfStrikeOut
= font32
->lfStrikeOut
;
134 font16
->lfCharSet
= font32
->lfCharSet
;
135 font16
->lfOutPrecision
= font32
->lfOutPrecision
;
136 font16
->lfClipPrecision
= font32
->lfClipPrecision
;
137 font16
->lfQuality
= font32
->lfQuality
;
138 font16
->lfPitchAndFamily
= font32
->lfPitchAndFamily
;
139 WideCharToMultiByte( CP_ACP
, 0, font32
->lfFaceName
, -1, font16
->lfFaceName
, LF_FACESIZE
, NULL
, NULL
);
140 font16
->lfFaceName
[LF_FACESIZE
-1] = 0;
143 /* convert a ENUMLOGFONTEXW to a ENUMLOGFONTEX16 */
144 static void enumlogfontex_W_to_16( const ENUMLOGFONTEXW
*fontW
,
145 LPENUMLOGFONTEX16 font16
)
147 logfont_W_to_16( (const LOGFONTW
*)fontW
, (LPLOGFONT16
)font16
);
149 WideCharToMultiByte( CP_ACP
, 0, fontW
->elfFullName
, -1,
150 (LPSTR
) font16
->elfFullName
, LF_FULLFACESIZE
, NULL
, NULL
);
151 font16
->elfFullName
[LF_FULLFACESIZE
-1] = '\0';
152 WideCharToMultiByte( CP_ACP
, 0, fontW
->elfStyle
, -1,
153 (LPSTR
) font16
->elfStyle
, LF_FACESIZE
, NULL
, NULL
);
154 font16
->elfStyle
[LF_FACESIZE
-1] = '\0';
155 WideCharToMultiByte( CP_ACP
, 0, fontW
->elfScript
, -1,
156 (LPSTR
) font16
->elfScript
, LF_FACESIZE
, NULL
, NULL
);
157 font16
->elfScript
[LF_FACESIZE
-1] = '\0';
160 /* convert a NEWTEXTMETRICEXW to a NEWTEXTMETRICEX16 */
161 static void newtextmetricex_W_to_16( const NEWTEXTMETRICEXW
*ptmW
,
162 LPNEWTEXTMETRICEX16 ptm16
)
164 ptm16
->ntmTm
.tmHeight
= ptmW
->ntmTm
.tmHeight
;
165 ptm16
->ntmTm
.tmAscent
= ptmW
->ntmTm
.tmAscent
;
166 ptm16
->ntmTm
.tmDescent
= ptmW
->ntmTm
.tmDescent
;
167 ptm16
->ntmTm
.tmInternalLeading
= ptmW
->ntmTm
.tmInternalLeading
;
168 ptm16
->ntmTm
.tmExternalLeading
= ptmW
->ntmTm
.tmExternalLeading
;
169 ptm16
->ntmTm
.tmAveCharWidth
= ptmW
->ntmTm
.tmAveCharWidth
;
170 ptm16
->ntmTm
.tmMaxCharWidth
= ptmW
->ntmTm
.tmMaxCharWidth
;
171 ptm16
->ntmTm
.tmWeight
= ptmW
->ntmTm
.tmWeight
;
172 ptm16
->ntmTm
.tmOverhang
= ptmW
->ntmTm
.tmOverhang
;
173 ptm16
->ntmTm
.tmDigitizedAspectX
= ptmW
->ntmTm
.tmDigitizedAspectX
;
174 ptm16
->ntmTm
.tmDigitizedAspectY
= ptmW
->ntmTm
.tmDigitizedAspectY
;
175 ptm16
->ntmTm
.tmFirstChar
= ptmW
->ntmTm
.tmFirstChar
> 255 ? 255 : ptmW
->ntmTm
.tmFirstChar
;
176 ptm16
->ntmTm
.tmLastChar
= ptmW
->ntmTm
.tmLastChar
> 255 ? 255 : ptmW
->ntmTm
.tmLastChar
;
177 ptm16
->ntmTm
.tmDefaultChar
= ptmW
->ntmTm
.tmDefaultChar
> 255 ? 255 : ptmW
->ntmTm
.tmDefaultChar
;
178 ptm16
->ntmTm
.tmBreakChar
= ptmW
->ntmTm
.tmBreakChar
> 255 ? 255 : ptmW
->ntmTm
.tmBreakChar
;
179 ptm16
->ntmTm
.tmItalic
= ptmW
->ntmTm
.tmItalic
;
180 ptm16
->ntmTm
.tmUnderlined
= ptmW
->ntmTm
.tmUnderlined
;
181 ptm16
->ntmTm
.tmStruckOut
= ptmW
->ntmTm
.tmStruckOut
;
182 ptm16
->ntmTm
.tmPitchAndFamily
= ptmW
->ntmTm
.tmPitchAndFamily
;
183 ptm16
->ntmTm
.tmCharSet
= ptmW
->ntmTm
.tmCharSet
;
184 ptm16
->ntmTm
.ntmFlags
= ptmW
->ntmTm
.ntmFlags
;
185 ptm16
->ntmTm
.ntmSizeEM
= ptmW
->ntmTm
.ntmSizeEM
;
186 ptm16
->ntmTm
.ntmCellHeight
= ptmW
->ntmTm
.ntmCellHeight
;
187 ptm16
->ntmTm
.ntmAvgWidth
= ptmW
->ntmTm
.ntmAvgWidth
;
188 ptm16
->ntmFontSig
= ptmW
->ntmFontSig
;
192 * callback for EnumFontFamiliesEx16
193 * Note: plf is really an ENUMLOGFONTEXW, and ptm is a NEWTEXTMETRICEXW.
194 * We have to use other types because of the FONTENUMPROCW definition.
196 static INT CALLBACK
enum_font_callback( const LOGFONTW
*plf
,
197 const TEXTMETRICW
*ptm
, DWORD fType
,
200 const struct callback16_info
*info
= (struct callback16_info
*)param
;
201 ENUMLOGFONTEX16 elfe16
;
202 NEWTEXTMETRICEX16 ntm16
;
208 enumlogfontex_W_to_16((const ENUMLOGFONTEXW
*)plf
, &elfe16
);
209 newtextmetricex_W_to_16((const NEWTEXTMETRICEXW
*)ptm
, &ntm16
);
210 segelfe16
= MapLS( &elfe16
);
211 segntm16
= MapLS( &ntm16
);
212 args
[6] = SELECTOROF(segelfe16
);
213 args
[5] = OFFSETOF(segelfe16
);
214 args
[4] = SELECTOROF(segntm16
);
215 args
[3] = OFFSETOF(segntm16
);
217 args
[1] = HIWORD(info
->param
);
218 args
[0] = LOWORD(info
->param
);
220 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
221 UnMapLS( segelfe16
);
226 struct dib_segptr_bits
234 static struct list dib_segptr_list
= LIST_INIT( dib_segptr_list
);
236 static SEGPTR
alloc_segptr_bits( HBITMAP bmp
, void *bits32
)
239 unsigned int i
, size
;
240 struct dib_segptr_bits
*bits
;
242 if (!(bits
= HeapAlloc( GetProcessHeap(), 0, sizeof(*bits
) ))) return 0;
244 GetObjectW( bmp
, sizeof(dib
), &dib
);
245 size
= dib
.dsBm
.bmHeight
* dib
.dsBm
.bmWidthBytes
;
247 /* calculate number of sel's needed for size with 64K steps */
248 bits
->bmp
= HBITMAP_16( bmp
);
249 bits
->count
= (size
+ 0xffff) / 0x10000;
250 bits
->sel
= AllocSelectorArray16( bits
->count
);
252 for (i
= 0; i
< bits
->count
; i
++)
254 SetSelectorBase(bits
->sel
+ (i
<< __AHSHIFT
), (DWORD
)bits32
+ i
* 0x10000);
255 SetSelectorLimit16(bits
->sel
+ (i
<< __AHSHIFT
), size
- 1); /* yep, limit is correct */
258 list_add_head( &dib_segptr_list
, &bits
->entry
);
259 return MAKESEGPTR( bits
->sel
, 0 );
262 static void free_segptr_bits( HBITMAP16 bmp
)
265 struct dib_segptr_bits
*bits
;
267 LIST_FOR_EACH_ENTRY( bits
, &dib_segptr_list
, struct dib_segptr_bits
, entry
)
269 if (bits
->bmp
!= bmp
) continue;
270 for (i
= 0; i
< bits
->count
; i
++) FreeSelector16( bits
->sel
+ (i
<< __AHSHIFT
) );
272 list_remove( &bits
->entry
);
273 HeapFree( GetProcessHeap(), 0, bits
);
278 /***********************************************************************
281 COLORREF WINAPI
SetBkColor16( HDC16 hdc
, COLORREF color
)
283 return SetBkColor( HDC_32(hdc
), color
);
287 /***********************************************************************
290 INT16 WINAPI
SetBkMode16( HDC16 hdc
, INT16 mode
)
292 return SetBkMode( HDC_32(hdc
), mode
);
296 /***********************************************************************
299 INT16 WINAPI
SetMapMode16( HDC16 hdc
, INT16 mode
)
301 return SetMapMode( HDC_32(hdc
), mode
);
305 /***********************************************************************
308 INT16 WINAPI
SetROP216( HDC16 hdc
, INT16 mode
)
310 return SetROP2( HDC_32(hdc
), mode
);
314 /***********************************************************************
317 INT16 WINAPI
SetRelAbs16( HDC16 hdc
, INT16 mode
)
319 return SetRelAbs( HDC_32(hdc
), mode
);
323 /***********************************************************************
324 * SetPolyFillMode (GDI.6)
326 INT16 WINAPI
SetPolyFillMode16( HDC16 hdc
, INT16 mode
)
328 return SetPolyFillMode( HDC_32(hdc
), mode
);
332 /***********************************************************************
333 * SetStretchBltMode (GDI.7)
335 INT16 WINAPI
SetStretchBltMode16( HDC16 hdc
, INT16 mode
)
337 return SetStretchBltMode( HDC_32(hdc
), mode
);
341 /***********************************************************************
342 * SetTextCharacterExtra (GDI.8)
344 INT16 WINAPI
SetTextCharacterExtra16( HDC16 hdc
, INT16 extra
)
346 return SetTextCharacterExtra( HDC_32(hdc
), extra
);
350 /***********************************************************************
351 * SetTextColor (GDI.9)
353 COLORREF WINAPI
SetTextColor16( HDC16 hdc
, COLORREF color
)
355 return SetTextColor( HDC_32(hdc
), color
);
359 /***********************************************************************
360 * SetTextJustification (GDI.10)
362 INT16 WINAPI
SetTextJustification16( HDC16 hdc
, INT16 extra
, INT16 breaks
)
364 return SetTextJustification( HDC_32(hdc
), extra
, breaks
);
368 /***********************************************************************
369 * SetWindowOrg (GDI.11)
371 DWORD WINAPI
SetWindowOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
374 if (!SetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
375 return MAKELONG( pt
.x
, pt
.y
);
379 /***********************************************************************
380 * SetWindowExt (GDI.12)
382 DWORD WINAPI
SetWindowExt16( HDC16 hdc
, INT16 x
, INT16 y
)
385 if (!SetWindowExtEx( HDC_32(hdc
), x
, y
, &size
)) return 0;
386 return MAKELONG( size
.cx
, size
.cy
);
390 /***********************************************************************
391 * SetViewportOrg (GDI.13)
393 DWORD WINAPI
SetViewportOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
396 if (!SetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
397 return MAKELONG( pt
.x
, pt
.y
);
401 /***********************************************************************
402 * SetViewportExt (GDI.14)
404 DWORD WINAPI
SetViewportExt16( HDC16 hdc
, INT16 x
, INT16 y
)
407 if (!SetViewportExtEx( HDC_32(hdc
), x
, y
, &size
)) return 0;
408 return MAKELONG( size
.cx
, size
.cy
);
412 /***********************************************************************
413 * OffsetWindowOrg (GDI.15)
415 DWORD WINAPI
OffsetWindowOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
418 if (!OffsetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
419 return MAKELONG( pt
.x
, pt
.y
);
423 /***********************************************************************
424 * ScaleWindowExt (GDI.16)
426 DWORD WINAPI
ScaleWindowExt16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
427 INT16 yNum
, INT16 yDenom
)
430 if (!ScaleWindowExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
, &size
))
432 return MAKELONG( size
.cx
, size
.cy
);
436 /***********************************************************************
437 * OffsetViewportOrg (GDI.17)
439 DWORD WINAPI
OffsetViewportOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
442 if (!OffsetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
443 return MAKELONG( pt
.x
, pt
.y
);
447 /***********************************************************************
448 * ScaleViewportExt (GDI.18)
450 DWORD WINAPI
ScaleViewportExt16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
451 INT16 yNum
, INT16 yDenom
)
454 if (!ScaleViewportExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
, &size
))
456 return MAKELONG( size
.cx
, size
.cy
);
460 /***********************************************************************
463 BOOL16 WINAPI
LineTo16( HDC16 hdc
, INT16 x
, INT16 y
)
465 return LineTo( HDC_32(hdc
), x
, y
);
469 /***********************************************************************
472 DWORD WINAPI
MoveTo16( HDC16 hdc
, INT16 x
, INT16 y
)
476 if (!MoveToEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
477 return MAKELONG(pt
.x
,pt
.y
);
481 /***********************************************************************
482 * ExcludeClipRect (GDI.21)
484 INT16 WINAPI
ExcludeClipRect16( HDC16 hdc
, INT16 left
, INT16 top
,
485 INT16 right
, INT16 bottom
)
487 return ExcludeClipRect( HDC_32(hdc
), left
, top
, right
, bottom
);
491 /***********************************************************************
492 * IntersectClipRect (GDI.22)
494 INT16 WINAPI
IntersectClipRect16( HDC16 hdc
, INT16 left
, INT16 top
,
495 INT16 right
, INT16 bottom
)
497 return IntersectClipRect( HDC_32(hdc
), left
, top
, right
, bottom
);
501 /***********************************************************************
504 BOOL16 WINAPI
Arc16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
505 INT16 bottom
, INT16 xstart
, INT16 ystart
,
506 INT16 xend
, INT16 yend
)
508 return Arc( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
512 /***********************************************************************
515 BOOL16 WINAPI
Ellipse16( HDC16 hdc
, INT16 left
, INT16 top
,
516 INT16 right
, INT16 bottom
)
518 return Ellipse( HDC_32(hdc
), left
, top
, right
, bottom
);
522 /**********************************************************************
525 BOOL16 WINAPI
FloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
527 return ExtFloodFill( HDC_32(hdc
), x
, y
, color
, FLOODFILLBORDER
);
531 /***********************************************************************
534 BOOL16 WINAPI
Pie16( HDC16 hdc
, INT16 left
, INT16 top
,
535 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
536 INT16 xend
, INT16 yend
)
538 return Pie( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
542 /***********************************************************************
545 BOOL16 WINAPI
Rectangle16( HDC16 hdc
, INT16 left
, INT16 top
,
546 INT16 right
, INT16 bottom
)
548 return Rectangle( HDC_32(hdc
), left
, top
, right
, bottom
);
552 /***********************************************************************
555 BOOL16 WINAPI
RoundRect16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
556 INT16 bottom
, INT16 ell_width
, INT16 ell_height
)
558 return RoundRect( HDC_32(hdc
), left
, top
, right
, bottom
, ell_width
, ell_height
);
562 /***********************************************************************
565 BOOL16 WINAPI
PatBlt16( HDC16 hdc
, INT16 left
, INT16 top
,
566 INT16 width
, INT16 height
, DWORD rop
)
568 return PatBlt( HDC_32(hdc
), left
, top
, width
, height
, rop
);
572 /***********************************************************************
575 INT16 WINAPI
SaveDC16( HDC16 hdc
)
577 return SaveDC( HDC_32(hdc
) );
581 /***********************************************************************
584 COLORREF WINAPI
SetPixel16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
586 return SetPixel( HDC_32(hdc
), x
, y
, color
);
590 /***********************************************************************
591 * OffsetClipRgn (GDI.32)
593 INT16 WINAPI
OffsetClipRgn16( HDC16 hdc
, INT16 x
, INT16 y
)
595 return OffsetClipRgn( HDC_32(hdc
), x
, y
);
599 /***********************************************************************
602 BOOL16 WINAPI
TextOut16( HDC16 hdc
, INT16 x
, INT16 y
, LPCSTR str
, INT16 count
)
604 return TextOutA( HDC_32(hdc
), x
, y
, str
, count
);
608 /***********************************************************************
611 BOOL16 WINAPI
BitBlt16( HDC16 hdcDst
, INT16 xDst
, INT16 yDst
, INT16 width
,
612 INT16 height
, HDC16 hdcSrc
, INT16 xSrc
, INT16 ySrc
,
615 return BitBlt( HDC_32(hdcDst
), xDst
, yDst
, width
, height
, HDC_32(hdcSrc
), xSrc
, ySrc
, rop
);
619 /***********************************************************************
620 * StretchBlt (GDI.35)
622 BOOL16 WINAPI
StretchBlt16( HDC16 hdcDst
, INT16 xDst
, INT16 yDst
,
623 INT16 widthDst
, INT16 heightDst
,
624 HDC16 hdcSrc
, INT16 xSrc
, INT16 ySrc
,
625 INT16 widthSrc
, INT16 heightSrc
, DWORD rop
)
627 return StretchBlt( HDC_32(hdcDst
), xDst
, yDst
, widthDst
, heightDst
,
628 HDC_32(hdcSrc
), xSrc
, ySrc
, widthSrc
, heightSrc
, rop
);
632 /**********************************************************************
635 BOOL16 WINAPI
Polygon16( HDC16 hdc
, const POINT16
* pt
, INT16 count
)
639 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, count
*sizeof(POINT
) );
641 if (!pt32
) return FALSE
;
647 ret
= Polygon(HDC_32(hdc
),pt32
,count
);
648 HeapFree( GetProcessHeap(), 0, pt32
);
653 /**********************************************************************
656 BOOL16 WINAPI
Polyline16( HDC16 hdc
, const POINT16
* pt
, INT16 count
)
660 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, count
*sizeof(POINT
) );
662 if (!pt32
) return FALSE
;
668 ret
= Polyline(HDC_32(hdc
),pt32
,count
);
669 HeapFree( GetProcessHeap(), 0, pt32
);
674 /***********************************************************************
677 INT16 WINAPI
Escape16( HDC16 hdc
, INT16 escape
, INT16 in_count
, SEGPTR in_data
, LPVOID out_data
)
683 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
684 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
685 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
686 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
687 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
688 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
689 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
690 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
691 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
692 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
693 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
694 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
695 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
700 case EXT_DEVICE_CAPS
:
703 case POSTSCRIPT_IGNORE
:
704 case QUERYESCSUPPORT
:
705 case SET_ARC_DIRECTION
:
707 case SET_SCREEN_ANGLE
:
710 INT16
*ptr
= MapSL(in_data
);
712 return Escape( HDC_32(hdc
), escape
, sizeof(data
), (LPCSTR
)&data
, out_data
);
715 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
718 UINT16
*ptr
= MapSL(in_data
);
720 return Escape( HDC_32(hdc
), escape
, sizeof(data
), (LPCSTR
)&data
, NULL
);
723 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
724 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
725 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
726 case GETPHYSPAGESIZE
:
727 case GETPRINTINGOFFSET
:
728 case GETSCALINGFACTOR
:
730 POINT16
*ptr
= out_data
;
732 ret
= Escape( HDC_32(hdc
), escape
, 0, NULL
, &pt32
);
738 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
739 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
740 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
741 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
742 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
743 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
744 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
745 case ENABLEPAIRKERNING
:
746 case ENABLERELATIVEWIDTHS
:
753 INT16
*new = MapSL(in_data
);
754 INT16
*old
= out_data
;
756 ret
= Escape( HDC_32(hdc
), escape
, sizeof(in
), (LPCSTR
)&in
, &out
);
761 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
763 return SetAbortProc16( hdc
, (ABORTPROC16
)in_data
);
765 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
766 * lpvOutData is actually a pointer to the DocInfo structure and used as
767 * a second input parameter */
771 ret
= StartDoc16( hdc
, out_data
);
772 if (ret
> 0) ret
= StartPage( HDC_32(hdc
) );
775 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), NULL
);
777 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
778 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
782 RECT16
*rc16
= MapSL(in_data
);
784 rc
.left
= rc16
->left
;
786 rc
.right
= rc16
->right
;
787 rc
.bottom
= rc16
->bottom
;
788 return Escape( HDC_32(hdc
), escape
, sizeof(rc
), (LPCSTR
)&rc
, NULL
);
791 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
795 RECT16
*rc16
= out_data
;
796 ret
= Escape( HDC_32(hdc
), escape
, 0, NULL
, &rc
);
797 rc16
->left
= rc
.left
;
799 rc16
->right
= rc
.right
;
800 rc16
->bottom
= rc
.bottom
;
803 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
804 case DRAWPATTERNRECT
:
807 DRAWPATRECT16
*pr16
= MapSL(in_data
);
809 pr
.ptPosition
.x
= pr16
->ptPosition
.x
;
810 pr
.ptPosition
.y
= pr16
->ptPosition
.y
;
811 pr
.ptSize
.x
= pr16
->ptSize
.x
;
812 pr
.ptSize
.y
= pr16
->ptSize
.y
;
813 pr
.wStyle
= pr16
->wStyle
;
814 pr
.wPattern
= pr16
->wPattern
;
815 return Escape( HDC_32(hdc
), escape
, sizeof(pr
), (LPCSTR
)&pr
, NULL
);
818 /* Escape(hdc,ABORTDOC,NULL,NULL); */
819 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
820 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
821 /* Escape(hdc,ENDDOC,NULL,NULL); */
822 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
823 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
824 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
825 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
826 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
827 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
828 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
829 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
830 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
831 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
832 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
833 /* Escape(hdc,NEWFRAME,NULL,NULL); */
834 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
835 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
836 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
837 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
838 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
839 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
840 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
849 case GETPAIRKERNTABLE
:
850 case GETSETPAPERBINS
:
851 case GETSETPRINTORIENT
:
852 case GETSETSCREENPARAMS
:
854 case GETTRACKKERNTABLE
:
860 case SETALLJUSTVALUES
:
862 case SET_BACKGROUND_COLOR
:
864 /* pass it unmodified to the 32-bit function */
865 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), out_data
);
867 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
868 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
869 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
870 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
871 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
872 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
873 case ENUMPAPERMETRICS
:
874 case GETEXTENDEDTEXTMETRICS
:
876 case GETSETPAPERMETRICS
:
877 case GETVECTORBRUSHSIZE
:
878 case GETVECTORPENSIZE
:
880 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
881 escape
, in_count
, MapSL(in_data
), out_data
);
882 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), out_data
);
887 /***********************************************************************
890 BOOL16 WINAPI
RestoreDC16( HDC16 hdc
, INT16 level
)
892 return RestoreDC( HDC_32(hdc
), level
);
896 /***********************************************************************
899 BOOL16 WINAPI
FillRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
)
901 return FillRgn( HDC_32(hdc
), HRGN_32(hrgn
), HBRUSH_32(hbrush
) );
905 /***********************************************************************
908 BOOL16 WINAPI
FrameRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
,
909 INT16 nWidth
, INT16 nHeight
)
911 return FrameRgn( HDC_32(hdc
), HRGN_32(hrgn
), HBRUSH_32(hbrush
), nWidth
, nHeight
);
915 /***********************************************************************
918 BOOL16 WINAPI
InvertRgn16( HDC16 hdc
, HRGN16 hrgn
)
920 return InvertRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
924 /***********************************************************************
927 BOOL16 WINAPI
PaintRgn16( HDC16 hdc
, HRGN16 hrgn
)
929 return PaintRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
933 /***********************************************************************
934 * SelectClipRgn (GDI.44)
936 INT16 WINAPI
SelectClipRgn16( HDC16 hdc
, HRGN16 hrgn
)
938 return SelectClipRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
942 /***********************************************************************
943 * SelectObject (GDI.45)
945 HGDIOBJ16 WINAPI
SelectObject16( HDC16 hdc
, HGDIOBJ16 handle
)
947 return HGDIOBJ_16( SelectObject( HDC_32(hdc
), HGDIOBJ_32(handle
) ) );
951 /***********************************************************************
952 * CombineRgn (GDI.47)
954 INT16 WINAPI
CombineRgn16(HRGN16 hDest
, HRGN16 hSrc1
, HRGN16 hSrc2
, INT16 mode
)
956 return CombineRgn( HRGN_32(hDest
), HRGN_32(hSrc1
), HRGN_32(hSrc2
), mode
);
960 /***********************************************************************
961 * CreateBitmap (GDI.48)
963 HBITMAP16 WINAPI
CreateBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
964 UINT16 bpp
, LPCVOID bits
)
966 return HBITMAP_16( CreateBitmap( width
, height
, planes
& 0xff, bpp
& 0xff, bits
) );
970 /***********************************************************************
971 * CreateBitmapIndirect (GDI.49)
973 HBITMAP16 WINAPI
CreateBitmapIndirect16( const BITMAP16
* bmp
)
975 return CreateBitmap16( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
976 bmp
->bmBitsPixel
, MapSL( bmp
->bmBits
) );
980 /***********************************************************************
981 * CreateBrushIndirect (GDI.50)
983 HBRUSH16 WINAPI
CreateBrushIndirect16( const LOGBRUSH16
* brush
)
987 if (brush
->lbStyle
== BS_DIBPATTERN
|| brush
->lbStyle
== BS_DIBPATTERN8X8
)
988 return CreateDIBPatternBrush16( brush
->lbHatch
, brush
->lbColor
);
990 brush32
.lbStyle
= brush
->lbStyle
;
991 brush32
.lbColor
= brush
->lbColor
;
992 brush32
.lbHatch
= brush
->lbHatch
;
993 return HBRUSH_16( CreateBrushIndirect(&brush32
) );
997 /***********************************************************************
998 * CreateCompatibleBitmap (GDI.51)
1000 HBITMAP16 WINAPI
CreateCompatibleBitmap16( HDC16 hdc
, INT16 width
, INT16 height
)
1002 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc
), width
, height
) );
1006 /***********************************************************************
1007 * CreateCompatibleDC (GDI.52)
1009 HDC16 WINAPI
CreateCompatibleDC16( HDC16 hdc
)
1011 return HDC_16( CreateCompatibleDC( HDC_32(hdc
) ) );
1015 /***********************************************************************
1018 HDC16 WINAPI
CreateDC16( LPCSTR driver
, LPCSTR device
, LPCSTR output
,
1019 const DEVMODEA
*initData
)
1021 return HDC_16( CreateDCA( driver
, device
, output
, initData
) );
1025 /***********************************************************************
1026 * CreateEllipticRgn (GDI.54)
1028 HRGN16 WINAPI
CreateEllipticRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
1030 return HRGN_16( CreateEllipticRgn( left
, top
, right
, bottom
) );
1034 /***********************************************************************
1035 * CreateEllipticRgnIndirect (GDI.55)
1037 HRGN16 WINAPI
CreateEllipticRgnIndirect16( const RECT16
*rect
)
1039 return HRGN_16( CreateEllipticRgn( rect
->left
, rect
->top
, rect
->right
, rect
->bottom
) );
1043 /***********************************************************************
1044 * CreateFont (GDI.56)
1046 HFONT16 WINAPI
CreateFont16(INT16 height
, INT16 width
, INT16 esc
, INT16 orient
,
1047 INT16 weight
, BYTE italic
, BYTE underline
,
1048 BYTE strikeout
, BYTE charset
, BYTE outpres
,
1049 BYTE clippres
, BYTE quality
, BYTE pitch
,
1052 return HFONT_16( CreateFontA( height
, width
, esc
, orient
, weight
, italic
, underline
,
1053 strikeout
, charset
, outpres
, clippres
, quality
, pitch
, name
));
1056 /***********************************************************************
1057 * CreateFontIndirect (GDI.57)
1059 HFONT16 WINAPI
CreateFontIndirect16( const LOGFONT16
*plf16
)
1066 logfont_16_to_W( plf16
, &lfW
);
1067 ret
= CreateFontIndirectW( &lfW
);
1069 else ret
= CreateFontIndirectW( NULL
);
1070 return HFONT_16(ret
);
1074 /***********************************************************************
1075 * CreateHatchBrush (GDI.58)
1077 HBRUSH16 WINAPI
CreateHatchBrush16( INT16 style
, COLORREF color
)
1079 return HBRUSH_16( CreateHatchBrush( style
, color
) );
1083 /***********************************************************************
1084 * CreatePatternBrush (GDI.60)
1086 HBRUSH16 WINAPI
CreatePatternBrush16( HBITMAP16 hbitmap
)
1088 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap
) ));
1092 /***********************************************************************
1093 * CreatePen (GDI.61)
1095 HPEN16 WINAPI
CreatePen16( INT16 style
, INT16 width
, COLORREF color
)
1099 logpen
.lopnStyle
= style
;
1100 logpen
.lopnWidth
.x
= width
;
1101 logpen
.lopnWidth
.y
= 0;
1102 logpen
.lopnColor
= color
;
1103 return HPEN_16( CreatePenIndirect( &logpen
) );
1107 /***********************************************************************
1108 * CreatePenIndirect (GDI.62)
1110 HPEN16 WINAPI
CreatePenIndirect16( const LOGPEN16
* pen
)
1114 if (pen
->lopnStyle
> PS_INSIDEFRAME
) return 0;
1115 logpen
.lopnStyle
= pen
->lopnStyle
;
1116 logpen
.lopnWidth
.x
= pen
->lopnWidth
.x
;
1117 logpen
.lopnWidth
.y
= pen
->lopnWidth
.y
;
1118 logpen
.lopnColor
= pen
->lopnColor
;
1119 return HPEN_16( CreatePenIndirect( &logpen
) );
1123 /***********************************************************************
1124 * CreatePolygonRgn (GDI.63)
1126 HRGN16 WINAPI
CreatePolygonRgn16( const POINT16
* points
, INT16 count
, INT16 mode
)
1128 return CreatePolyPolygonRgn16( points
, &count
, 1, mode
);
1132 /***********************************************************************
1133 * CreateRectRgn (GDI.64)
1135 * NOTE: cf. SetRectRgn16
1137 HRGN16 WINAPI
CreateRectRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
1141 if (left
< right
) hrgn
= CreateRectRgn( left
, top
, right
, bottom
);
1142 else hrgn
= CreateRectRgn( 0, 0, 0, 0 );
1143 return HRGN_16(hrgn
);
1147 /***********************************************************************
1148 * CreateRectRgnIndirect (GDI.65)
1150 HRGN16 WINAPI
CreateRectRgnIndirect16( const RECT16
* rect
)
1152 return CreateRectRgn16( rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
1156 /***********************************************************************
1157 * CreateSolidBrush (GDI.66)
1159 HBRUSH16 WINAPI
CreateSolidBrush16( COLORREF color
)
1161 return HBRUSH_16( CreateSolidBrush( color
) );
1165 /***********************************************************************
1168 BOOL16 WINAPI
DeleteDC16( HDC16 hdc
)
1170 return DeleteDC( HDC_32(hdc
) );
1174 /***********************************************************************
1175 * DeleteObject (GDI.69)
1176 * SysDeleteObject (GDI.605)
1178 BOOL16 WINAPI
DeleteObject16( HGDIOBJ16 obj
)
1180 if (GetObjectType( HGDIOBJ_32(obj
) ) == OBJ_BITMAP
) free_segptr_bits( obj
);
1181 return DeleteObject( HGDIOBJ_32(obj
) );
1185 /***********************************************************************
1186 * EnumFonts (GDI.70)
1188 INT16 WINAPI
EnumFonts16( HDC16 hDC
, LPCSTR lpName
, FONTENUMPROC16 efproc
,
1191 return EnumFontFamilies16( hDC
, lpName
, efproc
, lpData
);
1195 /***********************************************************************
1196 * EnumObjects (GDI.71)
1198 INT16 WINAPI
EnumObjects16( HDC16 hdc
, INT16 obj
, GOBJENUMPROC16 proc
, LPARAM lParam
)
1200 struct callback16_info info
;
1202 info
.proc
= (FARPROC16
)proc
;
1203 info
.param
= lParam
;
1207 return EnumObjects( HDC_32(hdc
), OBJ_PEN
, enum_pens_callback
, (LPARAM
)&info
);
1209 return EnumObjects( HDC_32(hdc
), OBJ_BRUSH
, enum_brushes_callback
, (LPARAM
)&info
);
1215 /***********************************************************************
1218 BOOL16 WINAPI
EqualRgn16( HRGN16 rgn1
, HRGN16 rgn2
)
1220 return EqualRgn( HRGN_32(rgn1
), HRGN_32(rgn2
) );
1224 /***********************************************************************
1225 * GetBitmapBits (GDI.74)
1227 LONG WINAPI
GetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPVOID buffer
)
1229 return GetBitmapBits( HBITMAP_32(hbitmap
), count
, buffer
);
1233 /***********************************************************************
1234 * GetBkColor (GDI.75)
1236 COLORREF WINAPI
GetBkColor16( HDC16 hdc
)
1238 return GetBkColor( HDC_32(hdc
) );
1242 /***********************************************************************
1243 * GetBkMode (GDI.76)
1245 INT16 WINAPI
GetBkMode16( HDC16 hdc
)
1247 return GetBkMode( HDC_32(hdc
) );
1251 /***********************************************************************
1252 * GetClipBox (GDI.77)
1254 INT16 WINAPI
GetClipBox16( HDC16 hdc
, LPRECT16 rect
)
1257 INT ret
= GetClipBox( HDC_32(hdc
), &rect32
);
1261 rect
->left
= rect32
.left
;
1262 rect
->top
= rect32
.top
;
1263 rect
->right
= rect32
.right
;
1264 rect
->bottom
= rect32
.bottom
;
1270 /***********************************************************************
1271 * GetCurrentPosition (GDI.78)
1273 DWORD WINAPI
GetCurrentPosition16( HDC16 hdc
)
1276 if (!GetCurrentPositionEx( HDC_32(hdc
), &pt32
)) return 0;
1277 return MAKELONG( pt32
.x
, pt32
.y
);
1281 /***********************************************************************
1284 DWORD WINAPI
GetDCOrg16( HDC16 hdc
)
1287 if (GetDCOrgEx( HDC_32(hdc
), &pt
)) return MAKELONG( pt
.x
, pt
.y
);
1292 /***********************************************************************
1293 * GetDeviceCaps (GDI.80)
1295 INT16 WINAPI
GetDeviceCaps16( HDC16 hdc
, INT16 cap
)
1297 INT16 ret
= GetDeviceCaps( HDC_32(hdc
), cap
);
1298 /* some apps don't expect -1 and think it's a B&W screen */
1299 if ((cap
== NUMCOLORS
) && (ret
== -1)) ret
= 2048;
1304 /***********************************************************************
1305 * GetMapMode (GDI.81)
1307 INT16 WINAPI
GetMapMode16( HDC16 hdc
)
1309 return GetMapMode( HDC_32(hdc
) );
1313 /***********************************************************************
1314 * GetObject (GDI.82)
1316 INT16 WINAPI
GetObject16( HGDIOBJ16 handle16
, INT16 count
, LPVOID buffer
)
1318 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1319 switch( GetObjectType( handle
))
1324 LOGPEN16
*pen16
= buffer
;
1327 if (count
< sizeof(LOGPEN16
)) return 0;
1328 if (!GetObjectW( handle
, sizeof(pen
), &pen
)) return 0;
1330 pen16
->lopnStyle
= pen
.lopnStyle
;
1331 pen16
->lopnColor
= pen
.lopnColor
;
1332 pen16
->lopnWidth
.x
= pen
.lopnWidth
.x
;
1333 pen16
->lopnWidth
.y
= pen
.lopnWidth
.y
;
1335 return sizeof(LOGPEN16
);
1343 if (!GetObjectW( handle
, sizeof(brush
), &brush
)) return 0;
1344 brush16
.lbStyle
= brush
.lbStyle
;
1345 brush16
.lbColor
= brush
.lbColor
;
1346 brush16
.lbHatch
= brush
.lbHatch
;
1347 if (count
> sizeof(brush16
)) count
= sizeof(brush16
);
1348 memcpy( buffer
, &brush16
, count
);
1351 return sizeof(LOGBRUSH16
);
1354 return GetObjectW( handle
, count
, buffer
);
1362 if (!GetObjectW( handle
, sizeof(font
), &font
)) return 0;
1363 logfont_W_to_16( &font
, &font16
);
1364 if (count
> sizeof(font16
)) count
= sizeof(font16
);
1365 memcpy( buffer
, &font16
, count
);
1368 return sizeof(LOGFONT16
);
1374 BITMAP16
*bmp16
= buffer
;
1376 if (!(size
= GetObjectW( handle
, sizeof(dib
), &dib
))) return 0;
1377 if (size
== sizeof(DIBSECTION
) && count
> sizeof(BITMAP16
))
1379 FIXME("not implemented for DIBs: count %d\n", count
);
1384 if (count
< sizeof(BITMAP16
)) return 0;
1385 bmp16
->bmType
= dib
.dsBm
.bmType
;
1386 bmp16
->bmWidth
= dib
.dsBm
.bmWidth
;
1387 bmp16
->bmHeight
= dib
.dsBm
.bmHeight
;
1388 bmp16
->bmWidthBytes
= dib
.dsBm
.bmWidthBytes
;
1389 bmp16
->bmPlanes
= dib
.dsBm
.bmPlanes
;
1390 bmp16
->bmBitsPixel
= dib
.dsBm
.bmBitsPixel
;
1392 return sizeof(BITMAP16
);
1402 /***********************************************************************
1405 COLORREF WINAPI
GetPixel16( HDC16 hdc
, INT16 x
, INT16 y
)
1407 return GetPixel( HDC_32(hdc
), x
, y
);
1411 /***********************************************************************
1412 * GetPolyFillMode (GDI.84)
1414 INT16 WINAPI
GetPolyFillMode16( HDC16 hdc
)
1416 return GetPolyFillMode( HDC_32(hdc
) );
1420 /***********************************************************************
1423 INT16 WINAPI
GetROP216( HDC16 hdc
)
1425 return GetROP2( HDC_32(hdc
) );
1429 /***********************************************************************
1430 * GetRelAbs (GDI.86)
1432 INT16 WINAPI
GetRelAbs16( HDC16 hdc
)
1434 return GetRelAbs( HDC_32(hdc
), 0 );
1438 /***********************************************************************
1439 * GetStockObject (GDI.87)
1441 HGDIOBJ16 WINAPI
GetStockObject16( INT16 obj
)
1443 return HGDIOBJ_16( GetStockObject( obj
) );
1447 /***********************************************************************
1448 * GetStretchBltMode (GDI.88)
1450 INT16 WINAPI
GetStretchBltMode16( HDC16 hdc
)
1452 return GetStretchBltMode( HDC_32(hdc
) );
1456 /***********************************************************************
1457 * GetTextCharacterExtra (GDI.89)
1459 INT16 WINAPI
GetTextCharacterExtra16( HDC16 hdc
)
1461 return GetTextCharacterExtra( HDC_32(hdc
) );
1465 /***********************************************************************
1466 * GetTextColor (GDI.90)
1468 COLORREF WINAPI
GetTextColor16( HDC16 hdc
)
1470 return GetTextColor( HDC_32(hdc
) );
1474 /***********************************************************************
1475 * GetTextExtent (GDI.91)
1477 DWORD WINAPI
GetTextExtent16( HDC16 hdc
, LPCSTR str
, INT16 count
)
1480 if (!GetTextExtentPoint32A( HDC_32(hdc
), str
, count
, &size
)) return 0;
1481 return MAKELONG( size
.cx
, size
.cy
);
1485 /***********************************************************************
1486 * GetTextFace (GDI.92)
1488 INT16 WINAPI
GetTextFace16( HDC16 hdc
, INT16 count
, LPSTR name
)
1490 return GetTextFaceA( HDC_32(hdc
), count
, name
);
1494 /***********************************************************************
1495 * GetTextMetrics (GDI.93)
1497 BOOL16 WINAPI
GetTextMetrics16( HDC16 hdc
, TEXTMETRIC16
*tm
)
1501 if (!GetTextMetricsW( HDC_32(hdc
), &tm32
)) return FALSE
;
1503 tm
->tmHeight
= tm32
.tmHeight
;
1504 tm
->tmAscent
= tm32
.tmAscent
;
1505 tm
->tmDescent
= tm32
.tmDescent
;
1506 tm
->tmInternalLeading
= tm32
.tmInternalLeading
;
1507 tm
->tmExternalLeading
= tm32
.tmExternalLeading
;
1508 tm
->tmAveCharWidth
= tm32
.tmAveCharWidth
;
1509 tm
->tmMaxCharWidth
= tm32
.tmMaxCharWidth
;
1510 tm
->tmWeight
= tm32
.tmWeight
;
1511 tm
->tmOverhang
= tm32
.tmOverhang
;
1512 tm
->tmDigitizedAspectX
= tm32
.tmDigitizedAspectX
;
1513 tm
->tmDigitizedAspectY
= tm32
.tmDigitizedAspectY
;
1514 tm
->tmFirstChar
= tm32
.tmFirstChar
;
1515 tm
->tmLastChar
= tm32
.tmLastChar
;
1516 tm
->tmDefaultChar
= tm32
.tmDefaultChar
;
1517 tm
->tmBreakChar
= tm32
.tmBreakChar
;
1518 tm
->tmItalic
= tm32
.tmItalic
;
1519 tm
->tmUnderlined
= tm32
.tmUnderlined
;
1520 tm
->tmStruckOut
= tm32
.tmStruckOut
;
1521 tm
->tmPitchAndFamily
= tm32
.tmPitchAndFamily
;
1522 tm
->tmCharSet
= tm32
.tmCharSet
;
1527 /***********************************************************************
1528 * GetViewportExt (GDI.94)
1530 DWORD WINAPI
GetViewportExt16( HDC16 hdc
)
1533 if (!GetViewportExtEx( HDC_32(hdc
), &size
)) return 0;
1534 return MAKELONG( size
.cx
, size
.cy
);
1538 /***********************************************************************
1539 * GetViewportOrg (GDI.95)
1541 DWORD WINAPI
GetViewportOrg16( HDC16 hdc
)
1544 if (!GetViewportOrgEx( HDC_32(hdc
), &pt
)) return 0;
1545 return MAKELONG( pt
.x
, pt
.y
);
1549 /***********************************************************************
1550 * GetWindowExt (GDI.96)
1552 DWORD WINAPI
GetWindowExt16( HDC16 hdc
)
1555 if (!GetWindowExtEx( HDC_32(hdc
), &size
)) return 0;
1556 return MAKELONG( size
.cx
, size
.cy
);
1560 /***********************************************************************
1561 * GetWindowOrg (GDI.97)
1563 DWORD WINAPI
GetWindowOrg16( HDC16 hdc
)
1566 if (!GetWindowOrgEx( HDC_32(hdc
), &pt
)) return 0;
1567 return MAKELONG( pt
.x
, pt
.y
);
1573 /**********************************************************************
1576 void WINAPI
LineDDA16( INT16 nXStart
, INT16 nYStart
, INT16 nXEnd
,
1577 INT16 nYEnd
, LINEDDAPROC16 proc
, LPARAM lParam
)
1579 struct callback16_info info
;
1580 info
.proc
= (FARPROC16
)proc
;
1581 info
.param
= lParam
;
1582 LineDDA( nXStart
, nYStart
, nXEnd
, nYEnd
, linedda_callback
, (LPARAM
)&info
);
1586 /***********************************************************************
1587 * OffsetRgn (GDI.101)
1589 INT16 WINAPI
OffsetRgn16( HRGN16 hrgn
, INT16 x
, INT16 y
)
1591 return OffsetRgn( HRGN_32(hrgn
), x
, y
);
1595 /***********************************************************************
1596 * PtVisible (GDI.103)
1598 BOOL16 WINAPI
PtVisible16( HDC16 hdc
, INT16 x
, INT16 y
)
1600 return PtVisible( HDC_32(hdc
), x
, y
);
1604 /***********************************************************************
1605 * SelectVisRgn (GDI.105)
1607 INT16 WINAPI
SelectVisRgn16( HDC16 hdc
, HRGN16 hrgn
)
1609 return SelectVisRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
1613 /***********************************************************************
1614 * SetBitmapBits (GDI.106)
1616 LONG WINAPI
SetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPCVOID buffer
)
1618 return SetBitmapBits( HBITMAP_32(hbitmap
), count
, buffer
);
1622 /***********************************************************************
1623 * AddFontResource (GDI.119)
1625 INT16 WINAPI
AddFontResource16( LPCSTR filename
)
1627 return AddFontResourceA( filename
);
1631 /***********************************************************************
1634 * Disables GDI, switches back to text mode.
1635 * We don't have to do anything here,
1636 * just let console support handle everything
1638 void WINAPI
Death16(HDC16 hdc
)
1640 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc
);
1644 /***********************************************************************
1645 * Resurrection (GDI.122)
1647 * Restores GDI functionality
1649 void WINAPI
Resurrection16(HDC16 hdc
,
1650 WORD w1
, WORD w2
, WORD w3
, WORD w4
, WORD w5
, WORD w6
)
1652 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1653 hdc
, w1
, w2
, w3
, w4
, w5
, w6
);
1657 /***********************************************************************
1660 INT16 WINAPI
MulDiv16( INT16 nMultiplicand
, INT16 nMultiplier
, INT16 nDivisor
)
1663 if (!nDivisor
) return -32768;
1664 /* We want to deal with a positive divisor to simplify the logic. */
1667 nMultiplicand
= - nMultiplicand
;
1668 nDivisor
= -nDivisor
;
1670 /* If the result is positive, we "add" to round. else,
1671 * we subtract to round. */
1672 if ( ( (nMultiplicand
< 0) && (nMultiplier
< 0) ) ||
1673 ( (nMultiplicand
>= 0) && (nMultiplier
>= 0) ) )
1674 ret
= (((int)nMultiplicand
* nMultiplier
) + (nDivisor
/2)) / nDivisor
;
1676 ret
= (((int)nMultiplicand
* nMultiplier
) - (nDivisor
/2)) / nDivisor
;
1677 if ((ret
> 32767) || (ret
< -32767)) return -32768;
1682 /***********************************************************************
1683 * GetRgnBox (GDI.134)
1685 INT16 WINAPI
GetRgnBox16( HRGN16 hrgn
, LPRECT16 rect
)
1688 INT16 ret
= GetRgnBox( HRGN_32(hrgn
), &r
);
1689 rect
->left
= r
.left
;
1691 rect
->right
= r
.right
;
1692 rect
->bottom
= r
.bottom
;
1697 /***********************************************************************
1698 * RemoveFontResource (GDI.136)
1700 BOOL16 WINAPI
RemoveFontResource16( LPCSTR str
)
1702 return RemoveFontResourceA(str
);
1706 /***********************************************************************
1707 * SetBrushOrg (GDI.148)
1709 DWORD WINAPI
SetBrushOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
1713 if (!SetBrushOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
1714 return MAKELONG( pt
.x
, pt
.y
);
1718 /***********************************************************************
1719 * GetBrushOrg (GDI.149)
1721 DWORD WINAPI
GetBrushOrg16( HDC16 hdc
)
1724 if (!GetBrushOrgEx( HDC_32(hdc
), &pt
)) return 0;
1725 return MAKELONG( pt
.x
, pt
.y
);
1729 /***********************************************************************
1730 * UnrealizeObject (GDI.150)
1732 BOOL16 WINAPI
UnrealizeObject16( HGDIOBJ16 obj
)
1734 return UnrealizeObject( HGDIOBJ_32(obj
) );
1738 /***********************************************************************
1739 * CreateIC (GDI.153)
1741 HDC16 WINAPI
CreateIC16( LPCSTR driver
, LPCSTR device
, LPCSTR output
,
1742 const DEVMODEA
* initData
)
1744 return HDC_16( CreateICA( driver
, device
, output
, initData
) );
1748 /***********************************************************************
1749 * GetNearestColor (GDI.154)
1751 COLORREF WINAPI
GetNearestColor16( HDC16 hdc
, COLORREF color
)
1753 return GetNearestColor( HDC_32(hdc
), color
);
1757 /***********************************************************************
1758 * CreateDiscardableBitmap (GDI.156)
1760 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
, INT16 height
)
1762 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc
), width
, height
) );
1766 /***********************************************************************
1767 * PtInRegion (GDI.161)
1769 BOOL16 WINAPI
PtInRegion16( HRGN16 hrgn
, INT16 x
, INT16 y
)
1771 return PtInRegion( HRGN_32(hrgn
), x
, y
);
1775 /***********************************************************************
1776 * GetBitmapDimension (GDI.162)
1778 DWORD WINAPI
GetBitmapDimension16( HBITMAP16 hbitmap
)
1781 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
1782 return MAKELONG( size
.cx
, size
.cy
);
1786 /***********************************************************************
1787 * SetBitmapDimension (GDI.163)
1789 DWORD WINAPI
SetBitmapDimension16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
1792 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
1793 return MAKELONG( size
.cx
, size
.cy
);
1797 /***********************************************************************
1798 * SetRectRgn (GDI.172)
1800 * NOTE: Win 3.1 sets region to empty if left > right
1802 void WINAPI
SetRectRgn16( HRGN16 hrgn
, INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
1804 if (left
< right
) SetRectRgn( HRGN_32(hrgn
), left
, top
, right
, bottom
);
1805 else SetRectRgn( HRGN_32(hrgn
), 0, 0, 0, 0 );
1809 /******************************************************************
1810 * PlayMetaFileRecord (GDI.176)
1812 void WINAPI
PlayMetaFileRecord16( HDC16 hdc
, HANDLETABLE16
*ht
, METARECORD
*mr
, UINT16 handles
)
1814 HANDLETABLE
*ht32
= HeapAlloc( GetProcessHeap(), 0, handles
* sizeof(*ht32
) );
1817 for (i
= 0; i
< handles
; i
++) ht32
->objectHandle
[i
] = HGDIOBJ_32(ht
->objectHandle
[i
]);
1818 PlayMetaFileRecord( HDC_32(hdc
), ht32
, mr
, handles
);
1819 for (i
= 0; i
< handles
; i
++) ht
->objectHandle
[i
] = HGDIOBJ_16(ht32
->objectHandle
[i
]);
1820 HeapFree( GetProcessHeap(), 0, ht32
);
1824 /***********************************************************************
1825 * SetDCHook (GDI.190)
1827 BOOL16 WINAPI
SetDCHook16( HDC16 hdc16
, FARPROC16 hookProc
, DWORD dwHookData
)
1829 FIXME( "%04x %p %x: not supported\n", hdc16
, hookProc
, dwHookData
);
1834 /***********************************************************************
1835 * GetDCHook (GDI.191)
1837 DWORD WINAPI
GetDCHook16( HDC16 hdc16
, FARPROC16
*phookProc
)
1839 FIXME( "%04x: not supported\n", hdc16
);
1844 /***********************************************************************
1845 * SetHookFlags (GDI.192)
1847 WORD WINAPI
SetHookFlags16( HDC16 hdc
, WORD flags
)
1849 return SetHookFlags( HDC_32(hdc
), flags
);
1853 /***********************************************************************
1854 * SetBoundsRect (GDI.193)
1856 UINT16 WINAPI
SetBoundsRect16( HDC16 hdc
, const RECT16
* rect
, UINT16 flags
)
1861 rect32
.left
= rect
->left
;
1862 rect32
.top
= rect
->top
;
1863 rect32
.right
= rect
->right
;
1864 rect32
.bottom
= rect
->bottom
;
1865 return SetBoundsRect( HDC_32( hdc
), &rect32
, flags
);
1867 else return SetBoundsRect( HDC_32( hdc
), NULL
, flags
);
1871 /***********************************************************************
1872 * GetBoundsRect (GDI.194)
1874 UINT16 WINAPI
GetBoundsRect16( HDC16 hdc
, LPRECT16 rect
, UINT16 flags
)
1877 UINT ret
= GetBoundsRect( HDC_32( hdc
), &rect32
, flags
);
1880 rect
->left
= rect32
.left
;
1881 rect
->top
= rect32
.top
;
1882 rect
->right
= rect32
.right
;
1883 rect
->bottom
= rect32
.bottom
;
1889 /***********************************************************************
1890 * EngineEnumerateFont (GDI.300)
1892 WORD WINAPI
EngineEnumerateFont16(LPSTR fontname
, FARPROC16 proc
, DWORD data
)
1894 FIXME("(%s,%p,%x),stub\n",fontname
,proc
,data
);
1899 /***********************************************************************
1900 * EngineDeleteFont (GDI.301)
1902 WORD WINAPI
EngineDeleteFont16(LPFONTINFO16 lpFontInfo
)
1906 /* untested, don't know if it works.
1907 We seem to access some structure that is located after the
1908 FONTINFO. The FONTINFO documentation says that there may
1909 follow some char-width table or font bitmap or vector info.
1910 I think it is some kind of font bitmap that begins at offset 0x52,
1911 as FONTINFO goes up to 0x51.
1912 If this is correct, everything should be implemented correctly.
1914 if ( ((lpFontInfo
->dfType
& (RASTER_FONTTYPE
|DEVICE_FONTTYPE
)) == (RASTER_FONTTYPE
|DEVICE_FONTTYPE
))
1915 && (LOWORD(lpFontInfo
->dfFace
) == LOWORD(lpFontInfo
)+0x6e)
1916 && (handle
= *(WORD
*)(lpFontInfo
+0x54)) )
1918 *(WORD
*)(lpFontInfo
+0x54) = 0;
1919 GlobalFree16(handle
);
1925 /***********************************************************************
1926 * EngineRealizeFont (GDI.302)
1928 WORD WINAPI
EngineRealizeFont16(LPLOGFONT16 lplogFont
, LPTEXTXFORM16 lptextxform
, LPFONTINFO16 lpfontInfo
)
1930 FIXME("(%p,%p,%p),stub\n",lplogFont
,lptextxform
,lpfontInfo
);
1936 /***********************************************************************
1937 * EngineRealizeFontExt (GDI.315)
1939 WORD WINAPI
EngineRealizeFontExt16(LONG l1
, LONG l2
, LONG l3
, LONG l4
)
1941 FIXME("(%08x,%08x,%08x,%08x),stub\n",l1
,l2
,l3
,l4
);
1947 /***********************************************************************
1948 * EngineGetCharWidth (GDI.303)
1950 WORD WINAPI
EngineGetCharWidth16(LPFONTINFO16 lpFontInfo
, BYTE firstChar
, BYTE lastChar
, LPINT16 buffer
)
1954 for (i
= firstChar
; i
<= lastChar
; i
++)
1955 FIXME(" returns font's average width for range %d to %d\n", firstChar
, lastChar
);
1956 *buffer
++ = lpFontInfo
->dfAvgWidth
; /* insert some charwidth functionality here; use average width for now */
1961 /***********************************************************************
1962 * EngineSetFontContext (GDI.304)
1964 WORD WINAPI
EngineSetFontContext16(LPFONTINFO16 lpFontInfo
, WORD data
)
1970 /***********************************************************************
1971 * EngineGetGlyphBMP (GDI.305)
1973 WORD WINAPI
EngineGetGlyphBMP16(WORD word
, LPFONTINFO16 lpFontInfo
, WORD w1
, WORD w2
,
1974 LPSTR string
, DWORD dword
, /*LPBITMAPMETRICS16*/ LPVOID metrics
)
1981 /***********************************************************************
1982 * EngineMakeFontDir (GDI.306)
1984 DWORD WINAPI
EngineMakeFontDir16(HDC16 hdc
, LPFONTDIR16 fontdir
, LPCSTR string
)
1986 FIXME(" stub! (always fails)\n");
1987 return ~0UL; /* error */
1991 /***********************************************************************
1992 * GetCharABCWidths (GDI.307)
1994 BOOL16 WINAPI
GetCharABCWidths16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
, LPABC16 abc
)
1998 LPABC abc32
= HeapAlloc( GetProcessHeap(), 0, sizeof(ABC
) * (lastChar
- firstChar
+ 1) );
2000 if ((ret
= GetCharABCWidthsA( HDC_32(hdc
), firstChar
, lastChar
, abc32
)))
2002 for (i
= firstChar
; i
<= lastChar
; i
++)
2004 abc
[i
-firstChar
].abcA
= abc32
[i
-firstChar
].abcA
;
2005 abc
[i
-firstChar
].abcB
= abc32
[i
-firstChar
].abcB
;
2006 abc
[i
-firstChar
].abcC
= abc32
[i
-firstChar
].abcC
;
2009 HeapFree( GetProcessHeap(), 0, abc32
);
2014 /***********************************************************************
2015 * GetOutlineTextMetrics (GDI.308)
2017 * Gets metrics for TrueType fonts.
2020 * hdc [In] Handle of device context
2021 * cbData [In] Size of metric data array
2022 * lpOTM [Out] Address of metric data array
2025 * Success: Non-zero or size of required buffer
2029 * lpOTM should be LPOUTLINETEXTMETRIC
2031 UINT16 WINAPI
GetOutlineTextMetrics16( HDC16 hdc
, UINT16 cbData
,
2032 LPOUTLINETEXTMETRIC16 lpOTM
)
2034 FIXME("(%04x,%04x,%p): stub\n", hdc
,cbData
,lpOTM
);
2039 /***********************************************************************
2040 * GetGlyphOutline (GDI.309)
2042 DWORD WINAPI
GetGlyphOutline16( HDC16 hdc
, UINT16 uChar
, UINT16 fuFormat
,
2043 LPGLYPHMETRICS16 lpgm
, DWORD cbBuffer
,
2044 LPVOID lpBuffer
, const MAT2
*lpmat2
)
2049 ret
= GetGlyphOutlineA( HDC_32(hdc
), uChar
, fuFormat
, &gm32
, cbBuffer
, lpBuffer
, lpmat2
);
2050 if (ret
&& ret
!= GDI_ERROR
)
2052 lpgm
->gmBlackBoxX
= gm32
.gmBlackBoxX
;
2053 lpgm
->gmBlackBoxY
= gm32
.gmBlackBoxY
;
2054 lpgm
->gmptGlyphOrigin
.x
= gm32
.gmptGlyphOrigin
.x
;
2055 lpgm
->gmptGlyphOrigin
.y
= gm32
.gmptGlyphOrigin
.y
;
2056 lpgm
->gmCellIncX
= gm32
.gmCellIncX
;
2057 lpgm
->gmCellIncY
= gm32
.gmCellIncY
;
2063 /***********************************************************************
2064 * CreateScalableFontResource (GDI.310)
2066 BOOL16 WINAPI
CreateScalableFontResource16( UINT16 fHidden
, LPCSTR lpszResourceFile
,
2067 LPCSTR fontFile
, LPCSTR path
)
2069 return CreateScalableFontResourceA( fHidden
, lpszResourceFile
, fontFile
, path
);
2073 /*************************************************************************
2074 * GetFontData (GDI.311)
2077 DWORD WINAPI
GetFontData16( HDC16 hdc
, DWORD table
, DWORD offset
, LPVOID buffer
, DWORD count
)
2079 return GetFontData( HDC_32(hdc
), table
, offset
, buffer
, count
);
2083 /*************************************************************************
2084 * GetRasterizerCaps (GDI.313)
2086 BOOL16 WINAPI
GetRasterizerCaps16( LPRASTERIZER_STATUS lprs
, UINT16 cbNumBytes
)
2088 return GetRasterizerCaps( lprs
, cbNumBytes
);
2092 /***********************************************************************
2093 * EnumFontFamilies (GDI.330)
2095 INT16 WINAPI
EnumFontFamilies16( HDC16 hDC
, LPCSTR lpFamily
,
2096 FONTENUMPROC16 efproc
, LPARAM lpData
)
2102 if (!*lpFamily
) return 1;
2103 lstrcpynA( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
2104 lf
.lfCharSet
= DEFAULT_CHARSET
;
2105 lf
.lfPitchAndFamily
= 0;
2110 return EnumFontFamiliesEx16( hDC
, plf
, efproc
, lpData
, 0 );
2114 /*************************************************************************
2115 * GetKerningPairs (GDI.332)
2118 INT16 WINAPI
GetKerningPairs16( HDC16 hdc
, INT16 count
, LPKERNINGPAIR16 pairs
)
2120 KERNINGPAIR
*pairs32
;
2123 if (!count
) return 0;
2125 if (!(pairs32
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(*pairs32
) ))) return 0;
2126 if ((ret
= GetKerningPairsA( HDC_32(hdc
), count
, pairs32
)))
2128 for (i
= 0; i
< ret
; i
++)
2130 pairs
->wFirst
= pairs32
->wFirst
;
2131 pairs
->wSecond
= pairs32
->wSecond
;
2132 pairs
->iKernAmount
= pairs32
->iKernAmount
;
2135 HeapFree( GetProcessHeap(), 0, pairs32
);
2141 /***********************************************************************
2142 * GetTextAlign (GDI.345)
2144 UINT16 WINAPI
GetTextAlign16( HDC16 hdc
)
2146 return GetTextAlign( HDC_32(hdc
) );
2150 /***********************************************************************
2151 * SetTextAlign (GDI.346)
2153 UINT16 WINAPI
SetTextAlign16( HDC16 hdc
, UINT16 align
)
2155 return SetTextAlign( HDC_32(hdc
), align
);
2159 /***********************************************************************
2162 BOOL16 WINAPI
Chord16( HDC16 hdc
, INT16 left
, INT16 top
,
2163 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
2164 INT16 xend
, INT16 yend
)
2166 return Chord( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
2170 /***********************************************************************
2171 * SetMapperFlags (GDI.349)
2173 DWORD WINAPI
SetMapperFlags16( HDC16 hdc
, DWORD flags
)
2175 return SetMapperFlags( HDC_32(hdc
), flags
);
2179 /***********************************************************************
2180 * GetCharWidth (GDI.350)
2182 BOOL16 WINAPI
GetCharWidth16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
, LPINT16 buffer
)
2184 BOOL retVal
= FALSE
;
2186 if( firstChar
!= lastChar
)
2188 LPINT buf32
= HeapAlloc(GetProcessHeap(), 0, sizeof(INT
)*(1 + (lastChar
- firstChar
)));
2191 LPINT obuf32
= buf32
;
2194 retVal
= GetCharWidth32A( HDC_32(hdc
), firstChar
, lastChar
, buf32
);
2197 for (i
= firstChar
; i
<= lastChar
; i
++) *buffer
++ = *buf32
++;
2199 HeapFree(GetProcessHeap(), 0, obuf32
);
2202 else /* happens quite often to warrant a special treatment */
2205 retVal
= GetCharWidth32A( HDC_32(hdc
), firstChar
, lastChar
, &chWidth
);
2212 /***********************************************************************
2213 * ExtTextOut (GDI.351)
2215 BOOL16 WINAPI
ExtTextOut16( HDC16 hdc
, INT16 x
, INT16 y
, UINT16 flags
,
2216 const RECT16
*lprect
, LPCSTR str
, UINT16 count
,
2222 LPINT lpdx32
= NULL
;
2225 lpdx32
= HeapAlloc( GetProcessHeap(),0, sizeof(INT
)*count
);
2226 if(lpdx32
== NULL
) return FALSE
;
2227 for (i
=count
;i
--;) lpdx32
[i
]=lpDx
[i
];
2231 rect32
.left
= lprect
->left
;
2232 rect32
.top
= lprect
->top
;
2233 rect32
.right
= lprect
->right
;
2234 rect32
.bottom
= lprect
->bottom
;
2236 ret
= ExtTextOutA(HDC_32(hdc
),x
,y
,flags
,lprect
?&rect32
:NULL
,str
,count
,lpdx32
);
2237 HeapFree( GetProcessHeap(), 0, lpdx32
);
2242 /***********************************************************************
2243 * CreatePalette (GDI.360)
2245 HPALETTE16 WINAPI
CreatePalette16( const LOGPALETTE
* palette
)
2247 return HPALETTE_16( CreatePalette( palette
) );
2251 /***********************************************************************
2252 * GDISelectPalette (GDI.361)
2254 HPALETTE16 WINAPI
GDISelectPalette16( HDC16 hdc
, HPALETTE16 hpalette
, WORD wBkg
)
2256 return HPALETTE_16( GDISelectPalette( HDC_32(hdc
), HPALETTE_32(hpalette
), wBkg
));
2260 /***********************************************************************
2261 * GDIRealizePalette (GDI.362)
2263 UINT16 WINAPI
GDIRealizePalette16( HDC16 hdc
)
2265 return GDIRealizePalette( HDC_32(hdc
) );
2269 /***********************************************************************
2270 * GetPaletteEntries (GDI.363)
2272 UINT16 WINAPI
GetPaletteEntries16( HPALETTE16 hpalette
, UINT16 start
,
2273 UINT16 count
, LPPALETTEENTRY entries
)
2275 return GetPaletteEntries( HPALETTE_32(hpalette
), start
, count
, entries
);
2279 /***********************************************************************
2280 * SetPaletteEntries (GDI.364)
2282 UINT16 WINAPI
SetPaletteEntries16( HPALETTE16 hpalette
, UINT16 start
,
2283 UINT16 count
, const PALETTEENTRY
*entries
)
2285 return SetPaletteEntries( HPALETTE_32(hpalette
), start
, count
, entries
);
2289 /**********************************************************************
2290 * UpdateColors (GDI.366)
2292 INT16 WINAPI
UpdateColors16( HDC16 hdc
)
2294 UpdateColors( HDC_32(hdc
) );
2299 /***********************************************************************
2300 * AnimatePalette (GDI.367)
2302 void WINAPI
AnimatePalette16( HPALETTE16 hpalette
, UINT16 StartIndex
,
2303 UINT16 NumEntries
, const PALETTEENTRY
* PaletteColors
)
2305 AnimatePalette( HPALETTE_32(hpalette
), StartIndex
, NumEntries
, PaletteColors
);
2309 /***********************************************************************
2310 * ResizePalette (GDI.368)
2312 BOOL16 WINAPI
ResizePalette16( HPALETTE16 hpalette
, UINT16 cEntries
)
2314 return ResizePalette( HPALETTE_32(hpalette
), cEntries
);
2318 /***********************************************************************
2319 * GetNearestPaletteIndex (GDI.370)
2321 UINT16 WINAPI
GetNearestPaletteIndex16( HPALETTE16 hpalette
, COLORREF color
)
2323 return GetNearestPaletteIndex( HPALETTE_32(hpalette
), color
);
2327 /**********************************************************************
2328 * ExtFloodFill (GDI.372)
2330 BOOL16 WINAPI
ExtFloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
,
2333 return ExtFloodFill( HDC_32(hdc
), x
, y
, color
, fillType
);
2337 /***********************************************************************
2338 * SetSystemPaletteUse (GDI.373)
2340 UINT16 WINAPI
SetSystemPaletteUse16( HDC16 hdc
, UINT16 use
)
2342 return SetSystemPaletteUse( HDC_32(hdc
), use
);
2346 /***********************************************************************
2347 * GetSystemPaletteUse (GDI.374)
2349 UINT16 WINAPI
GetSystemPaletteUse16( HDC16 hdc
)
2351 return GetSystemPaletteUse( HDC_32(hdc
) );
2355 /***********************************************************************
2356 * GetSystemPaletteEntries (GDI.375)
2358 UINT16 WINAPI
GetSystemPaletteEntries16( HDC16 hdc
, UINT16 start
, UINT16 count
,
2359 LPPALETTEENTRY entries
)
2361 return GetSystemPaletteEntries( HDC_32(hdc
), start
, count
, entries
);
2365 /***********************************************************************
2368 HDC16 WINAPI
ResetDC16( HDC16 hdc
, const DEVMODEA
*devmode
)
2370 return HDC_16( ResetDCA(HDC_32(hdc
), devmode
) );
2374 /******************************************************************
2375 * StartDoc (GDI.377)
2377 INT16 WINAPI
StartDoc16( HDC16 hdc
, const DOCINFO16
*lpdoc
)
2381 docA
.cbSize
= lpdoc
->cbSize
;
2382 docA
.lpszDocName
= MapSL(lpdoc
->lpszDocName
);
2383 docA
.lpszOutput
= MapSL(lpdoc
->lpszOutput
);
2384 if(lpdoc
->cbSize
> offsetof(DOCINFO16
,lpszDatatype
))
2385 docA
.lpszDatatype
= MapSL(lpdoc
->lpszDatatype
);
2387 docA
.lpszDatatype
= NULL
;
2388 if(lpdoc
->cbSize
> offsetof(DOCINFO16
,fwType
))
2389 docA
.fwType
= lpdoc
->fwType
;
2392 return StartDocA( HDC_32(hdc
), &docA
);
2396 /******************************************************************
2399 INT16 WINAPI
EndDoc16( HDC16 hdc
)
2401 return EndDoc( HDC_32(hdc
) );
2405 /******************************************************************
2406 * StartPage (GDI.379)
2408 INT16 WINAPI
StartPage16( HDC16 hdc
)
2410 return StartPage( HDC_32(hdc
) );
2414 /******************************************************************
2417 INT16 WINAPI
EndPage16( HDC16 hdc
)
2419 return EndPage( HDC_32(hdc
) );
2423 /******************************************************************************
2424 * AbortDoc (GDI.382)
2426 INT16 WINAPI
AbortDoc16( HDC16 hdc
)
2428 return AbortDoc( HDC_32(hdc
) );
2432 /***********************************************************************
2433 * FastWindowFrame (GDI.400)
2435 BOOL16 WINAPI
FastWindowFrame16( HDC16 hdc
, const RECT16
*rect
,
2436 INT16 width
, INT16 height
, DWORD rop
)
2438 HDC hdc32
= HDC_32(hdc
);
2439 HBRUSH hbrush
= SelectObject( hdc32
, GetStockObject( GRAY_BRUSH
) );
2440 PatBlt( hdc32
, rect
->left
, rect
->top
,
2441 rect
->right
- rect
->left
- width
, height
, rop
);
2442 PatBlt( hdc32
, rect
->left
, rect
->top
+ height
, width
,
2443 rect
->bottom
- rect
->top
- height
, rop
);
2444 PatBlt( hdc32
, rect
->left
+ width
, rect
->bottom
- 1,
2445 rect
->right
- rect
->left
- width
, -height
, rop
);
2446 PatBlt( hdc32
, rect
->right
- 1, rect
->top
, -width
,
2447 rect
->bottom
- rect
->top
- height
, rop
);
2448 SelectObject( hdc32
, hbrush
);
2453 /***********************************************************************
2454 * GdiInit2 (GDI.403)
2456 * See "Undocumented Windows"
2460 * h2 [I] global data
2462 HANDLE16 WINAPI
GdiInit216( HANDLE16 h1
, HANDLE16 h2
)
2464 FIXME("(%04x, %04x), stub.\n", h1
, h2
);
2465 if (h2
== 0xffff) return 0xffff; /* undefined return value */
2466 return h1
; /* FIXME: should be the memory handle of h1 */
2470 /***********************************************************************
2471 * FinalGdiInit (GDI.405)
2473 void WINAPI
FinalGdiInit16( HBRUSH16 hPattern
/* [in] fill pattern of desktop */ )
2478 /***********************************************************************
2479 * CreateUserBitmap (GDI.407)
2481 HBITMAP16 WINAPI
CreateUserBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
2482 UINT16 bpp
, LPCVOID bits
)
2484 return CreateBitmap16( width
, height
, planes
, bpp
, bits
);
2488 /***********************************************************************
2489 * CreateUserDiscardableBitmap (GDI.409)
2491 HBITMAP16 WINAPI
CreateUserDiscardableBitmap16( WORD dummy
, INT16 width
, INT16 height
)
2493 HDC hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
2494 HBITMAP ret
= CreateCompatibleBitmap( hdc
, width
, height
);
2496 return HBITMAP_16(ret
);
2500 /***********************************************************************
2501 * GetCurLogFont (GDI.411)
2503 HFONT16 WINAPI
GetCurLogFont16( HDC16 hdc
)
2505 return HFONT_16( GetCurrentObject( HDC_32(hdc
), OBJ_FONT
) );
2509 /***********************************************************************
2510 * StretchDIBits (GDI.439)
2512 INT16 WINAPI
StretchDIBits16( HDC16 hdc
, INT16 xDst
, INT16 yDst
, INT16 widthDst
,
2513 INT16 heightDst
, INT16 xSrc
, INT16 ySrc
, INT16 widthSrc
,
2514 INT16 heightSrc
, const VOID
*bits
,
2515 const BITMAPINFO
*info
, UINT16 wUsage
, DWORD dwRop
)
2517 return StretchDIBits( HDC_32(hdc
), xDst
, yDst
, widthDst
, heightDst
,
2518 xSrc
, ySrc
, widthSrc
, heightSrc
, bits
,
2519 info
, wUsage
, dwRop
);
2523 /***********************************************************************
2524 * SetDIBits (GDI.440)
2526 INT16 WINAPI
SetDIBits16( HDC16 hdc
, HBITMAP16 hbitmap
, UINT16 startscan
,
2527 UINT16 lines
, LPCVOID bits
, const BITMAPINFO
*info
,
2530 return SetDIBits( HDC_32(hdc
), HBITMAP_32(hbitmap
), startscan
, lines
, bits
, info
, coloruse
);
2534 /***********************************************************************
2535 * GetDIBits (GDI.441)
2537 INT16 WINAPI
GetDIBits16( HDC16 hdc
, HBITMAP16 hbitmap
, UINT16 startscan
,
2538 UINT16 lines
, LPVOID bits
, BITMAPINFO
* info
,
2541 return GetDIBits( HDC_32(hdc
), HBITMAP_32(hbitmap
), startscan
, lines
, bits
, info
, coloruse
);
2545 /***********************************************************************
2546 * CreateDIBitmap (GDI.442)
2548 HBITMAP16 WINAPI
CreateDIBitmap16( HDC16 hdc
, const BITMAPINFOHEADER
* header
,
2549 DWORD init
, LPCVOID bits
, const BITMAPINFO
* data
,
2552 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc
), header
, init
, bits
, data
, coloruse
) );
2556 /***********************************************************************
2557 * SetDIBitsToDevice (GDI.443)
2559 INT16 WINAPI
SetDIBitsToDevice16( HDC16 hdc
, INT16 xDest
, INT16 yDest
, INT16 cx
,
2560 INT16 cy
, INT16 xSrc
, INT16 ySrc
, UINT16 startscan
,
2561 UINT16 lines
, LPCVOID bits
, const BITMAPINFO
*info
,
2564 return SetDIBitsToDevice( HDC_32(hdc
), xDest
, yDest
, cx
, cy
, xSrc
, ySrc
,
2565 startscan
, lines
, bits
, info
, coloruse
);
2569 /***********************************************************************
2570 * CreateRoundRectRgn (GDI.444)
2572 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2573 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2574 * we just let CreateRoundRectRgn convert them to +ve values.
2577 HRGN16 WINAPI
CreateRoundRectRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
,
2578 INT16 ellipse_width
, INT16 ellipse_height
)
2580 if( ellipse_width
== 0 || ellipse_height
== 0 )
2581 return CreateRectRgn16( left
, top
, right
, bottom
);
2583 return HRGN_16( CreateRoundRectRgn( left
, top
, right
, bottom
,
2584 ellipse_width
, ellipse_height
));
2588 /***********************************************************************
2589 * CreateDIBPatternBrush (GDI.445)
2591 HBRUSH16 WINAPI
CreateDIBPatternBrush16( HGLOBAL16 hbitmap
, UINT16 coloruse
)
2596 if (!(bmi
= GlobalLock16( hbitmap
))) return 0;
2597 ret
= HBRUSH_16( CreateDIBPatternBrushPt( bmi
, coloruse
));
2598 GlobalUnlock16( hbitmap
);
2603 /**********************************************************************
2604 * PolyPolygon (GDI.450)
2606 BOOL16 WINAPI
PolyPolygon16( HDC16 hdc
, const POINT16
* pt
, const INT16
* counts
,
2615 for (i
=polygons
;i
--;)
2617 pt32
= HeapAlloc( GetProcessHeap(), 0, sizeof(POINT
)*nrpts
);
2618 if(pt32
== NULL
) return FALSE
;
2621 pt32
[i
].x
= pt
[i
].x
;
2622 pt32
[i
].y
= pt
[i
].y
;
2624 counts32
= HeapAlloc( GetProcessHeap(), 0, polygons
*sizeof(INT
) );
2625 if(counts32
== NULL
) {
2626 HeapFree( GetProcessHeap(), 0, pt32
);
2629 for (i
=polygons
;i
--;) counts32
[i
]=counts
[i
];
2631 ret
= PolyPolygon(HDC_32(hdc
),pt32
,counts32
,polygons
);
2632 HeapFree( GetProcessHeap(), 0, counts32
);
2633 HeapFree( GetProcessHeap(), 0, pt32
);
2638 /***********************************************************************
2639 * CreatePolyPolygonRgn (GDI.451)
2641 HRGN16 WINAPI
CreatePolyPolygonRgn16( const POINT16
*points
,
2642 const INT16
*count
, INT16 nbpolygons
, INT16 mode
)
2649 for (i
= 0; i
< nbpolygons
; i
++) npts
+= count
[i
];
2650 points32
= HeapAlloc( GetProcessHeap(), 0, npts
* sizeof(POINT
) );
2651 for (i
= 0; i
< npts
; i
++)
2653 points32
[i
].x
= points
[i
].x
;
2654 points32
[i
].y
= points
[i
].y
;
2657 count32
= HeapAlloc( GetProcessHeap(), 0, nbpolygons
* sizeof(INT
) );
2658 for (i
= 0; i
< nbpolygons
; i
++) count32
[i
] = count
[i
];
2659 hrgn
= CreatePolyPolygonRgn( points32
, count32
, nbpolygons
, mode
);
2660 HeapFree( GetProcessHeap(), 0, count32
);
2661 HeapFree( GetProcessHeap(), 0, points32
);
2662 return HRGN_16(hrgn
);
2666 /***********************************************************************
2667 * GdiSeeGdiDo (GDI.452)
2669 DWORD WINAPI
GdiSeeGdiDo16( WORD wReqType
, WORD wParam1
, WORD wParam2
,
2676 case 0x0001: /* LocalAlloc */
2677 WARN("LocalAlloc16(%x, %x): ignoring\n", wParam1
, wParam3
);
2680 case 0x0002: /* LocalFree */
2681 WARN("LocalFree16(%x): ignoring\n", wParam1
);
2684 case 0x0003: /* LocalCompact */
2685 WARN("LocalCompact16(%x): ignoring\n", wParam3
);
2686 ret
= 65000; /* lie about the amount of free space */
2688 case 0x0103: /* LocalHeap */
2689 WARN("LocalHeap16(): ignoring\n");
2692 WARN("(wReqType=%04x): Unknown\n", wReqType
);
2699 /***********************************************************************
2700 * SetObjectOwner (GDI.461)
2702 void WINAPI
SetObjectOwner16( HGDIOBJ16 handle
, HANDLE16 owner
)
2708 /***********************************************************************
2709 * IsGDIObject (GDI.462)
2711 * returns type of object if valid (W95 system programming secrets p. 264-5)
2713 BOOL16 WINAPI
IsGDIObject16( HGDIOBJ16 handle16
)
2715 static const BYTE type_map
[] =
2726 10, /* OBJ_METAFILE */
2729 9, /* OBJ_ENHMETADC */
2730 12, /* OBJ_ENHMETAFILE */
2731 0 /* OBJ_COLORSPACE */
2734 UINT type
= GetObjectType( HGDIOBJ_32( handle16
));
2736 if (type
>= sizeof(type_map
)/sizeof(type_map
[0])) return 0;
2737 return type_map
[type
];
2741 /***********************************************************************
2742 * RectVisible (GDI.465)
2743 * RectVisibleOld (GDI.104)
2745 BOOL16 WINAPI
RectVisible16( HDC16 hdc
, const RECT16
* rect16
)
2749 rect
.left
= rect16
->left
;
2750 rect
.top
= rect16
->top
;
2751 rect
.right
= rect16
->right
;
2752 rect
.bottom
= rect16
->bottom
;
2753 return RectVisible( HDC_32(hdc
), &rect
);
2757 /***********************************************************************
2758 * RectInRegion (GDI.466)
2759 * RectInRegionOld (GDI.181)
2761 BOOL16 WINAPI
RectInRegion16( HRGN16 hrgn
, const RECT16
*rect
)
2765 r32
.left
= rect
->left
;
2766 r32
.top
= rect
->top
;
2767 r32
.right
= rect
->right
;
2768 r32
.bottom
= rect
->bottom
;
2769 return RectInRegion( HRGN_32(hrgn
), &r32
);
2773 /***********************************************************************
2774 * GetBitmapDimensionEx (GDI.468)
2776 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
2779 BOOL ret
= GetBitmapDimensionEx( HBITMAP_32(hbitmap
), &size32
);
2783 size
->cx
= size32
.cx
;
2784 size
->cy
= size32
.cy
;
2790 /***********************************************************************
2791 * GetBrushOrgEx (GDI.469)
2793 BOOL16 WINAPI
GetBrushOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
2796 if (!GetBrushOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2803 /***********************************************************************
2804 * GetCurrentPositionEx (GDI.470)
2806 BOOL16 WINAPI
GetCurrentPositionEx16( HDC16 hdc
, LPPOINT16 pt
)
2809 if (!GetCurrentPositionEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2816 /***********************************************************************
2817 * GetTextExtentPoint (GDI.471)
2819 * FIXME: Should this have a bug for compatibility?
2820 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2821 * bugs (-> MSDN KB q147647.txt).
2823 BOOL16 WINAPI
GetTextExtentPoint16( HDC16 hdc
, LPCSTR str
, INT16 count
, LPSIZE16 size
)
2826 BOOL ret
= GetTextExtentPoint32A( HDC_32(hdc
), str
, count
, &size32
);
2830 size
->cx
= size32
.cx
;
2831 size
->cy
= size32
.cy
;
2837 /***********************************************************************
2838 * GetViewportExtEx (GDI.472)
2840 BOOL16 WINAPI
GetViewportExtEx16( HDC16 hdc
, LPSIZE16 size
)
2843 if (!GetViewportExtEx( HDC_32(hdc
), &size32
)) return FALSE
;
2844 size
->cx
= size32
.cx
;
2845 size
->cy
= size32
.cy
;
2850 /***********************************************************************
2851 * GetViewportOrgEx (GDI.473)
2853 BOOL16 WINAPI
GetViewportOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
2856 if (!GetViewportOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2863 /***********************************************************************
2864 * GetWindowExtEx (GDI.474)
2866 BOOL16 WINAPI
GetWindowExtEx16( HDC16 hdc
, LPSIZE16 size
)
2869 if (!GetWindowExtEx( HDC_32(hdc
), &size32
)) return FALSE
;
2870 size
->cx
= size32
.cx
;
2871 size
->cy
= size32
.cy
;
2876 /***********************************************************************
2877 * GetWindowOrgEx (GDI.475)
2879 BOOL16 WINAPI
GetWindowOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
2882 if (!GetWindowOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2889 /***********************************************************************
2890 * OffsetViewportOrgEx (GDI.476)
2892 BOOL16 WINAPI
OffsetViewportOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2895 BOOL16 ret
= OffsetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2905 /***********************************************************************
2906 * OffsetWindowOrgEx (GDI.477)
2908 BOOL16 WINAPI
OffsetWindowOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2911 BOOL16 ret
= OffsetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2921 /***********************************************************************
2922 * SetBitmapDimensionEx (GDI.478)
2924 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
, LPSIZE16 prevSize
)
2927 BOOL ret
= SetBitmapDimensionEx( HBITMAP_32(hbitmap
), x
, y
, &size32
);
2929 if (ret
&& prevSize
)
2931 prevSize
->cx
= size32
.cx
;
2932 prevSize
->cy
= size32
.cy
;
2938 /***********************************************************************
2939 * SetViewportExtEx (GDI.479)
2941 BOOL16 WINAPI
SetViewportExtEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPSIZE16 size
)
2944 BOOL16 ret
= SetViewportExtEx( HDC_32(hdc
), x
, y
, &size32
);
2945 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
2950 /***********************************************************************
2951 * SetViewportOrgEx (GDI.480)
2953 BOOL16 WINAPI
SetViewportOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2956 BOOL16 ret
= SetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2966 /***********************************************************************
2967 * SetWindowExtEx (GDI.481)
2969 BOOL16 WINAPI
SetWindowExtEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPSIZE16 size
)
2972 BOOL16 ret
= SetWindowExtEx( HDC_32(hdc
), x
, y
, &size32
);
2973 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
2978 /***********************************************************************
2979 * SetWindowOrgEx (GDI.482)
2981 BOOL16 WINAPI
SetWindowOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
2984 BOOL16 ret
= SetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
2994 /***********************************************************************
2995 * MoveToEx (GDI.483)
2997 BOOL16 WINAPI
MoveToEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
3001 if (!MoveToEx( HDC_32(hdc
), x
, y
, &pt32
)) return FALSE
;
3011 /***********************************************************************
3012 * ScaleViewportExtEx (GDI.484)
3014 BOOL16 WINAPI
ScaleViewportExtEx16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
3015 INT16 yNum
, INT16 yDenom
, LPSIZE16 size
)
3018 BOOL16 ret
= ScaleViewportExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
,
3020 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
3025 /***********************************************************************
3026 * ScaleWindowExtEx (GDI.485)
3028 BOOL16 WINAPI
ScaleWindowExtEx16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
3029 INT16 yNum
, INT16 yDenom
, LPSIZE16 size
)
3032 BOOL16 ret
= ScaleWindowExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
,
3034 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
3039 /***********************************************************************
3040 * GetAspectRatioFilterEx (GDI.486)
3042 BOOL16 WINAPI
GetAspectRatioFilterEx16( HDC16 hdc
, LPSIZE16 pAspectRatio
)
3044 FIXME("(%04x, %p): -- Empty Stub !\n", hdc
, pAspectRatio
);
3049 /******************************************************************************
3050 * PolyBezier (GDI.502)
3052 BOOL16 WINAPI
PolyBezier16( HDC16 hdc
, const POINT16
* lppt
, INT16 cPoints
)
3056 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, cPoints
*sizeof(POINT
) );
3057 if(!pt32
) return FALSE
;
3058 for (i
=cPoints
;i
--;)
3060 pt32
[i
].x
= lppt
[i
].x
;
3061 pt32
[i
].y
= lppt
[i
].y
;
3063 ret
= PolyBezier(HDC_32(hdc
), pt32
, cPoints
);
3064 HeapFree( GetProcessHeap(), 0, pt32
);
3069 /******************************************************************************
3070 * PolyBezierTo (GDI.503)
3072 BOOL16 WINAPI
PolyBezierTo16( HDC16 hdc
, const POINT16
* lppt
, INT16 cPoints
)
3076 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0,
3077 cPoints
*sizeof(POINT
) );
3078 if(!pt32
) return FALSE
;
3079 for (i
=cPoints
;i
--;)
3081 pt32
[i
].x
= lppt
[i
].x
;
3082 pt32
[i
].y
= lppt
[i
].y
;
3084 ret
= PolyBezierTo(HDC_32(hdc
), pt32
, cPoints
);
3085 HeapFree( GetProcessHeap(), 0, pt32
);
3090 /******************************************************************************
3091 * ExtSelectClipRgn (GDI.508)
3093 INT16 WINAPI
ExtSelectClipRgn16( HDC16 hdc
, HRGN16 hrgn
, INT16 fnMode
)
3095 return ExtSelectClipRgn( HDC_32(hdc
), HRGN_32(hrgn
), fnMode
);
3099 /***********************************************************************
3100 * AbortPath (GDI.511)
3102 BOOL16 WINAPI
AbortPath16(HDC16 hdc
)
3104 return AbortPath( HDC_32(hdc
) );
3108 /***********************************************************************
3109 * BeginPath (GDI.512)
3111 BOOL16 WINAPI
BeginPath16(HDC16 hdc
)
3113 return BeginPath( HDC_32(hdc
) );
3117 /***********************************************************************
3118 * CloseFigure (GDI.513)
3120 BOOL16 WINAPI
CloseFigure16(HDC16 hdc
)
3122 return CloseFigure( HDC_32(hdc
) );
3126 /***********************************************************************
3129 BOOL16 WINAPI
EndPath16(HDC16 hdc
)
3131 return EndPath( HDC_32(hdc
) );
3135 /***********************************************************************
3136 * FillPath (GDI.515)
3138 BOOL16 WINAPI
FillPath16(HDC16 hdc
)
3140 return FillPath( HDC_32(hdc
) );
3144 /*******************************************************************
3145 * FlattenPath (GDI.516)
3147 BOOL16 WINAPI
FlattenPath16(HDC16 hdc
)
3149 return FlattenPath( HDC_32(hdc
) );
3153 /***********************************************************************
3156 INT16 WINAPI
GetPath16(HDC16 hdc
, LPPOINT16 pPoints
, LPBYTE pTypes
, INT16 nSize
)
3158 FIXME("(%d,%p,%p): stub\n",hdc
,pPoints
,pTypes
);
3163 /***********************************************************************
3164 * PathToRegion (GDI.518)
3166 HRGN16 WINAPI
PathToRegion16(HDC16 hdc
)
3168 return HRGN_16( PathToRegion( HDC_32(hdc
) ));
3172 /***********************************************************************
3173 * SelectClipPath (GDI.519)
3175 BOOL16 WINAPI
SelectClipPath16(HDC16 hdc
, INT16 iMode
)
3177 return SelectClipPath( HDC_32(hdc
), iMode
);
3181 /*******************************************************************
3182 * StrokeAndFillPath (GDI.520)
3184 BOOL16 WINAPI
StrokeAndFillPath16(HDC16 hdc
)
3186 return StrokeAndFillPath( HDC_32(hdc
) );
3190 /*******************************************************************
3191 * StrokePath (GDI.521)
3193 BOOL16 WINAPI
StrokePath16(HDC16 hdc
)
3195 return StrokePath( HDC_32(hdc
) );
3199 /*******************************************************************
3200 * WidenPath (GDI.522)
3202 BOOL16 WINAPI
WidenPath16(HDC16 hdc
)
3204 return WidenPath( HDC_32(hdc
) );
3208 /***********************************************************************
3209 * GetArcDirection (GDI.524)
3211 INT16 WINAPI
GetArcDirection16( HDC16 hdc
)
3213 return GetArcDirection( HDC_32(hdc
) );
3217 /***********************************************************************
3218 * SetArcDirection (GDI.525)
3220 INT16 WINAPI
SetArcDirection16( HDC16 hdc
, INT16 nDirection
)
3222 return SetArcDirection( HDC_32(hdc
), (INT
)nDirection
);
3226 /***********************************************************************
3227 * CreateHalftonePalette (GDI.529)
3229 HPALETTE16 WINAPI
CreateHalftonePalette16( HDC16 hdc
)
3231 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc
) ));
3235 /***********************************************************************
3236 * SetDIBColorTable (GDI.602)
3238 UINT16 WINAPI
SetDIBColorTable16( HDC16 hdc
, UINT16 startpos
, UINT16 entries
, RGBQUAD
*colors
)
3240 return SetDIBColorTable( HDC_32(hdc
), startpos
, entries
, colors
);
3244 /***********************************************************************
3245 * GetDIBColorTable (GDI.603)
3247 UINT16 WINAPI
GetDIBColorTable16( HDC16 hdc
, UINT16 startpos
, UINT16 entries
, RGBQUAD
*colors
)
3249 return GetDIBColorTable( HDC_32(hdc
), startpos
, entries
, colors
);
3253 /***********************************************************************
3254 * GetRegionData (GDI.607)
3256 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
3258 DWORD WINAPI
GetRegionData16( HRGN16 hrgn
, DWORD count
, LPRGNDATA rgndata
)
3260 return GetRegionData( HRGN_32(hrgn
), count
, rgndata
);
3264 /***********************************************************************
3265 * GdiFreeResources (GDI.609)
3267 WORD WINAPI
GdiFreeResources16( DWORD reserve
)
3269 return 90; /* lie about it, it shouldn't matter */
3273 /***********************************************************************
3274 * GdiSignalProc32 (GDI.610)
3276 WORD WINAPI
GdiSignalProc( UINT uCode
, DWORD dwThreadOrProcessID
,
3277 DWORD dwFlags
, HMODULE16 hModule
)
3283 /***********************************************************************
3284 * GetTextCharset (GDI.612)
3286 UINT16 WINAPI
GetTextCharset16( HDC16 hdc
)
3288 return GetTextCharset( HDC_32(hdc
) );
3292 /***********************************************************************
3293 * EnumFontFamiliesEx (GDI.613)
3295 INT16 WINAPI
EnumFontFamiliesEx16( HDC16 hdc
, LPLOGFONT16 plf
,
3296 FONTENUMPROC16 proc
, LPARAM lParam
,
3299 struct callback16_info info
;
3300 LOGFONTW lfW
, *plfW
;
3302 info
.proc
= (FARPROC16
)proc
;
3303 info
.param
= lParam
;
3307 logfont_16_to_W(plf
, &lfW
);
3312 return EnumFontFamiliesExW( HDC_32(hdc
), plfW
, enum_font_callback
,
3313 (LPARAM
)&info
, dwFlags
);
3317 /*************************************************************************
3318 * GetFontLanguageInfo (GDI.616)
3320 DWORD WINAPI
GetFontLanguageInfo16( HDC16 hdc
)
3322 return GetFontLanguageInfo( HDC_32(hdc
) );
3326 /***********************************************************************
3327 * SetLayout (GDI.1000)
3329 * Sets left->right or right->left text layout flags of a dc.
3331 BOOL16 WINAPI
SetLayout16( HDC16 hdc
, DWORD layout
)
3333 return SetLayout( HDC_32(hdc
), layout
);
3337 /***********************************************************************
3338 * SetSolidBrush (GDI.604)
3340 * Change the color of a solid brush.
3343 * hBrush [I] Brush to change the color of
3344 * newColor [I] New color for hBrush
3347 * Success: TRUE. The color of hBrush is set to newColor.
3351 * This function is undocumented and untested. The implementation may
3354 BOOL16 WINAPI
SetSolidBrush16(HBRUSH16 hBrush
, COLORREF newColor
)
3356 TRACE("(hBrush %04x, newColor %08x)\n", hBrush
, newColor
);
3358 return BRUSH_SetSolid( HBRUSH_32(hBrush
), newColor
);
3362 /***********************************************************************
3365 void WINAPI
Copy16( LPVOID src
, LPVOID dst
, WORD size
)
3367 memcpy( dst
, src
, size
);
3370 /***********************************************************************
3371 * RealizeDefaultPalette (GDI.365)
3373 UINT16 WINAPI
RealizeDefaultPalette16( HDC16 hdc
)
3378 TRACE("%04x\n", hdc
);
3380 if (!(dc
= get_dc_ptr( HDC_32(hdc
) ))) return 0;
3382 if (dc
->funcs
->pRealizeDefaultPalette
) ret
= dc
->funcs
->pRealizeDefaultPalette( dc
->physDev
);
3383 release_dc_ptr( dc
);
3387 /***********************************************************************
3388 * IsDCCurrentPalette (GDI.412)
3390 BOOL16 WINAPI
IsDCCurrentPalette16(HDC16 hDC
)
3392 DC
*dc
= get_dc_ptr( HDC_32(hDC
) );
3395 BOOL bRet
= dc
->hPalette
== hPrimaryPalette
;
3396 release_dc_ptr( dc
);
3402 /*********************************************************************
3403 * SetMagicColors (GDI.606)
3405 VOID WINAPI
SetMagicColors16(HDC16 hDC
, COLORREF color
, UINT16 index
)
3407 FIXME("(hDC %04x, color %04x, index %04x): stub\n", hDC
, (int)color
, index
);
3412 /***********************************************************************
3415 BOOL16 WINAPI
DPtoLP16( HDC16 hdc
, LPPOINT16 points
, INT16 count
)
3417 DC
* dc
= get_dc_ptr( HDC_32(hdc
) );
3418 if (!dc
) return FALSE
;
3422 points
->x
= MulDiv( points
->x
- dc
->vportOrgX
, dc
->wndExtX
, dc
->vportExtX
) + dc
->wndOrgX
;
3423 points
->y
= MulDiv( points
->y
- dc
->vportOrgY
, dc
->wndExtY
, dc
->vportExtY
) + dc
->wndOrgY
;
3426 release_dc_ptr( dc
);
3431 /***********************************************************************
3434 BOOL16 WINAPI
LPtoDP16( HDC16 hdc
, LPPOINT16 points
, INT16 count
)
3436 DC
* dc
= get_dc_ptr( HDC_32(hdc
) );
3437 if (!dc
) return FALSE
;
3441 points
->x
= MulDiv( points
->x
- dc
->wndOrgX
, dc
->vportExtX
, dc
->wndExtX
) + dc
->vportOrgX
;
3442 points
->y
= MulDiv( points
->y
- dc
->wndOrgY
, dc
->vportExtY
, dc
->wndExtY
) + dc
->vportOrgY
;
3445 release_dc_ptr( dc
);
3450 /***********************************************************************
3451 * GetDCState (GDI.179)
3453 HDC16 WINAPI
GetDCState16( HDC16 hdc
)
3455 ERR( "no longer supported\n" );
3460 /***********************************************************************
3461 * SetDCState (GDI.180)
3463 void WINAPI
SetDCState16( HDC16 hdc
, HDC16 hdcs
)
3465 ERR( "no longer supported\n" );
3468 /***********************************************************************
3469 * SetDCOrg (GDI.117)
3471 DWORD WINAPI
SetDCOrg16( HDC16 hdc16
, INT16 x
, INT16 y
)
3474 HDC hdc
= HDC_32( hdc16
);
3475 DC
*dc
= get_dc_ptr( hdc
);
3477 if (dc
->funcs
->pSetDCOrg
) prevOrg
= dc
->funcs
->pSetDCOrg( dc
->physDev
, x
, y
);
3478 release_dc_ptr( dc
);
3483 /***********************************************************************
3484 * InquireVisRgn (GDI.131)
3486 HRGN16 WINAPI
InquireVisRgn16( HDC16 hdc
)
3489 DC
* dc
= get_dc_ptr( HDC_32(hdc
) );
3492 ret
= HRGN_16(dc
->hVisRgn
);
3493 release_dc_ptr( dc
);
3499 /***********************************************************************
3500 * OffsetVisRgn (GDI.102)
3502 INT16 WINAPI
OffsetVisRgn16( HDC16 hdc16
, INT16 x
, INT16 y
)
3505 HDC hdc
= HDC_32( hdc16
);
3506 DC
* dc
= get_dc_ptr( hdc
);
3508 if (!dc
) return ERROR
;
3509 TRACE("%p %d,%d\n", hdc
, x
, y
);
3511 retval
= OffsetRgn( dc
->hVisRgn
, x
, y
);
3512 CLIPPING_UpdateGCRegion( dc
);
3513 release_dc_ptr( dc
);
3518 /***********************************************************************
3519 * ExcludeVisRect (GDI.73)
3521 INT16 WINAPI
ExcludeVisRect16( HDC16 hdc16
, INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
3526 HDC hdc
= HDC_32( hdc16
);
3527 DC
* dc
= get_dc_ptr( hdc
);
3528 if (!dc
) return ERROR
;
3535 LPtoDP( hdc
, pt
, 2 );
3537 TRACE("%p %d,%d - %d,%d\n", hdc
, pt
[0].x
, pt
[0].y
, pt
[1].x
, pt
[1].y
);
3539 if (!(tempRgn
= CreateRectRgn( pt
[0].x
, pt
[0].y
, pt
[1].x
, pt
[1].y
))) ret
= ERROR
;
3543 ret
= CombineRgn( dc
->hVisRgn
, dc
->hVisRgn
, tempRgn
, RGN_DIFF
);
3544 DeleteObject( tempRgn
);
3546 if (ret
!= ERROR
) CLIPPING_UpdateGCRegion( dc
);
3547 release_dc_ptr( dc
);
3552 /***********************************************************************
3553 * IntersectVisRect (GDI.98)
3555 INT16 WINAPI
IntersectVisRect16( HDC16 hdc16
, INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
3560 HDC hdc
= HDC_32( hdc16
);
3561 DC
* dc
= get_dc_ptr( hdc
);
3562 if (!dc
) return ERROR
;
3569 LPtoDP( hdc
, pt
, 2 );
3571 TRACE("%p %d,%d - %d,%d\n", hdc
, pt
[0].x
, pt
[0].y
, pt
[1].x
, pt
[1].y
);
3573 if (!(tempRgn
= CreateRectRgn( pt
[0].x
, pt
[0].y
, pt
[1].x
, pt
[1].y
))) ret
= ERROR
;
3577 ret
= CombineRgn( dc
->hVisRgn
, dc
->hVisRgn
, tempRgn
, RGN_AND
);
3578 DeleteObject( tempRgn
);
3580 if (ret
!= ERROR
) CLIPPING_UpdateGCRegion( dc
);
3581 release_dc_ptr( dc
);
3586 /***********************************************************************
3587 * SaveVisRgn (GDI.129)
3589 HRGN16 WINAPI
SaveVisRgn16( HDC16 hdc16
)
3591 struct saved_visrgn
*saved
;
3592 HDC hdc
= HDC_32( hdc16
);
3593 DC
*dc
= get_dc_ptr( hdc
);
3596 TRACE("%p\n", hdc
);
3599 if (!(saved
= HeapAlloc( GetProcessHeap(), 0, sizeof(*saved
) ))) goto error
;
3600 if (!(saved
->hrgn
= CreateRectRgn( 0, 0, 0, 0 ))) goto error
;
3601 CombineRgn( saved
->hrgn
, dc
->hVisRgn
, 0, RGN_COPY
);
3602 saved
->next
= dc
->saved_visrgn
;
3603 dc
->saved_visrgn
= saved
;
3604 release_dc_ptr( dc
);
3605 return HRGN_16(saved
->hrgn
);
3608 release_dc_ptr( dc
);
3609 HeapFree( GetProcessHeap(), 0, saved
);
3614 /***********************************************************************
3615 * RestoreVisRgn (GDI.130)
3617 INT16 WINAPI
RestoreVisRgn16( HDC16 hdc16
)
3619 struct saved_visrgn
*saved
;
3620 HDC hdc
= HDC_32( hdc16
);
3621 DC
*dc
= get_dc_ptr( hdc
);
3624 if (!dc
) return ERROR
;
3626 TRACE("%p\n", hdc
);
3628 if (!(saved
= dc
->saved_visrgn
)) goto done
;
3630 ret
= CombineRgn( dc
->hVisRgn
, saved
->hrgn
, 0, RGN_COPY
);
3631 dc
->saved_visrgn
= saved
->next
;
3632 DeleteObject( saved
->hrgn
);
3633 HeapFree( GetProcessHeap(), 0, saved
);
3634 CLIPPING_UpdateGCRegion( dc
);
3636 release_dc_ptr( dc
);
3641 /***********************************************************************
3642 * GetClipRgn (GDI.173)
3644 HRGN16 WINAPI
GetClipRgn16( HDC16 hdc
)
3647 DC
* dc
= get_dc_ptr( HDC_32(hdc
) );
3650 ret
= HRGN_16(dc
->hClipRgn
);
3651 release_dc_ptr( dc
);
3657 /***********************************************************************
3658 * MakeObjectPrivate (GDI.463)
3660 * What does that mean ?
3661 * Some little docu can be found in "Undocumented Windows",
3662 * but this is basically useless.
3664 void WINAPI
MakeObjectPrivate16( HGDIOBJ16 handle16
, BOOL16
private )
3666 FIXME( "stub: %x %u\n", handle16
, private );
3669 /***********************************************************************
3670 * CreateDIBSection (GDI.489)
3672 HBITMAP16 WINAPI
CreateDIBSection16 (HDC16 hdc
, const BITMAPINFO
*bmi
, UINT16 usage
,
3673 SEGPTR
*bits16
, HANDLE section
, DWORD offset
)
3678 hbitmap
= CreateDIBSection( HDC_32(hdc
), bmi
, usage
, &bits32
, section
, offset
);
3679 if (hbitmap
&& bits32
&& bits16
) *bits16
= alloc_segptr_bits( hbitmap
, bits32
);
3680 return HBITMAP_16(hbitmap
);