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 "wine/list.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gdi
);
33 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
34 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
43 static struct list saved_regions
= LIST_INIT( saved_regions
);
45 static HPALETTE16 hPrimaryPalette
;
48 * ############################################################################
52 #define GDI_MAX_THUNKS 32
54 static struct gdi_thunk
56 BYTE popl_eax
; /* popl %eax (return address) */
57 BYTE pushl_pfn16
; /* pushl pfn16 */
58 DWORD pfn16
; /* pfn16 */
59 BYTE pushl_eax
; /* pushl %eax */
60 BYTE jmp
; /* ljmp GDI_Callback3216 */
67 /**********************************************************************
70 static BOOL CALLBACK
GDI_Callback3216( DWORD pfn16
, HDC hdc
, INT code
)
77 args
[1] = HDC_16(hdc
);
79 WOWCallback16Ex( pfn16
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
86 /******************************************************************
90 static struct gdi_thunk
* GDI_AddThunk(HDC16 dc16
, ABORTPROC16 pfn16
)
92 struct gdi_thunk
* thunk
;
96 GDI_Thunks
= VirtualAlloc(NULL
, GDI_MAX_THUNKS
* sizeof(*GDI_Thunks
),
97 MEM_COMMIT
, PAGE_EXECUTE_READWRITE
);
102 for (thunk
= GDI_Thunks
; thunk
< &GDI_Thunks
[GDI_MAX_THUNKS
]; thunk
++)
104 thunk
->popl_eax
= 0x58; /* popl %eax */
105 thunk
->pushl_pfn16
= 0x68; /* pushl pfn16 */
107 thunk
->pushl_eax
= 0x50; /* pushl %eax */
108 thunk
->jmp
= 0xe9; /* jmp GDI_Callback3216 */
109 thunk
->callback
= (char *)GDI_Callback3216
- (char *)(&thunk
->callback
+ 1);
112 for (thunk
= GDI_Thunks
; thunk
< &GDI_Thunks
[GDI_MAX_THUNKS
]; thunk
++)
114 if (thunk
->pfn16
== 0)
116 thunk
->pfn16
= (DWORD
)pfn16
;
121 FIXME("Out of mmdrv-thunks. Bump GDI_MAX_THUNKS\n");
125 /******************************************************************
128 static void GDI_DeleteThunk(struct gdi_thunk
* thunk
)
133 /******************************************************************
136 static struct gdi_thunk
* GDI_FindThunk(HDC16 hdc
)
138 struct gdi_thunk
* thunk
;
140 if (!GDI_Thunks
) return NULL
;
141 for (thunk
= GDI_Thunks
; thunk
< &GDI_Thunks
[GDI_MAX_THUNKS
]; thunk
++)
143 if (thunk
->hdc
== hdc
) return thunk
;
148 /**********************************************************************
149 * QueryAbort (GDI.155)
151 * Calls the app's AbortProc function if avail.
154 * TRUE if no AbortProc avail or AbortProc wants to continue printing.
155 * FALSE if AbortProc wants to abort printing.
157 BOOL16 WINAPI
QueryAbort16(HDC16 hdc16
, INT16 reserved
)
159 struct gdi_thunk
* thunk
= GDI_FindThunk(hdc16
);
162 ERR("Invalid hdc 0x%x\n", hdc16
);
165 return GDI_Callback3216( thunk
->pfn16
, HDC_32(hdc16
), 0 );
169 /**********************************************************************
170 * SetAbortProc (GDI.381)
172 INT16 WINAPI
SetAbortProc16(HDC16 hdc16
, ABORTPROC16 abrtprc
)
174 struct gdi_thunk
* thunk
;
176 thunk
= GDI_AddThunk(hdc16
, abrtprc
);
177 if (!thunk
) return FALSE
;
178 if (!SetAbortProc(HDC_32( hdc16
), (ABORTPROC
)thunk
))
180 GDI_DeleteThunk(thunk
);
187 * ############################################################################
190 struct callback16_info
196 /* callback for LineDDA16 */
197 static void CALLBACK
linedda_callback( INT x
, INT y
, LPARAM param
)
199 const struct callback16_info
*info
= (struct callback16_info
*)param
;
204 args
[1] = HIWORD(info
->param
);
205 args
[0] = LOWORD(info
->param
);
206 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, NULL
);
209 /* callback for EnumObjects16 */
210 static INT CALLBACK
enum_pens_callback( void *ptr
, LPARAM param
)
212 const struct callback16_info
*info
= (struct callback16_info
*)param
;
219 pen16
.lopnStyle
= pen
->lopnStyle
;
220 pen16
.lopnWidth
.x
= pen
->lopnWidth
.x
;
221 pen16
.lopnWidth
.y
= pen
->lopnWidth
.y
;
222 pen16
.lopnColor
= pen
->lopnColor
;
223 segptr
= MapLS( &pen16
);
224 args
[3] = SELECTOROF(segptr
);
225 args
[2] = OFFSETOF(segptr
);
226 args
[1] = HIWORD(info
->param
);
227 args
[0] = LOWORD(info
->param
);
228 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
233 /* callback for EnumObjects16 */
234 static INT CALLBACK
enum_brushes_callback( void *ptr
, LPARAM param
)
236 const struct callback16_info
*info
= (struct callback16_info
*)param
;
237 LOGBRUSH
*brush
= ptr
;
243 brush16
.lbStyle
= brush
->lbStyle
;
244 brush16
.lbColor
= brush
->lbColor
;
245 brush16
.lbHatch
= brush
->lbHatch
;
246 segptr
= MapLS( &brush16
);
247 args
[3] = SELECTOROF(segptr
);
248 args
[2] = OFFSETOF(segptr
);
249 args
[1] = HIWORD(info
->param
);
250 args
[0] = LOWORD(info
->param
);
251 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
256 /* convert a LOGFONT16 to a LOGFONTW */
257 static void logfont_16_to_W( const LOGFONT16
*font16
, LPLOGFONTW font32
)
259 font32
->lfHeight
= font16
->lfHeight
;
260 font32
->lfWidth
= font16
->lfWidth
;
261 font32
->lfEscapement
= font16
->lfEscapement
;
262 font32
->lfOrientation
= font16
->lfOrientation
;
263 font32
->lfWeight
= font16
->lfWeight
;
264 font32
->lfItalic
= font16
->lfItalic
;
265 font32
->lfUnderline
= font16
->lfUnderline
;
266 font32
->lfStrikeOut
= font16
->lfStrikeOut
;
267 font32
->lfCharSet
= font16
->lfCharSet
;
268 font32
->lfOutPrecision
= font16
->lfOutPrecision
;
269 font32
->lfClipPrecision
= font16
->lfClipPrecision
;
270 font32
->lfQuality
= font16
->lfQuality
;
271 font32
->lfPitchAndFamily
= font16
->lfPitchAndFamily
;
272 MultiByteToWideChar( CP_ACP
, 0, font16
->lfFaceName
, -1, font32
->lfFaceName
, LF_FACESIZE
);
273 font32
->lfFaceName
[LF_FACESIZE
-1] = 0;
276 /* convert a LOGFONTW to a LOGFONT16 */
277 static void logfont_W_to_16( const LOGFONTW
* font32
, LPLOGFONT16 font16
)
279 font16
->lfHeight
= font32
->lfHeight
;
280 font16
->lfWidth
= font32
->lfWidth
;
281 font16
->lfEscapement
= font32
->lfEscapement
;
282 font16
->lfOrientation
= font32
->lfOrientation
;
283 font16
->lfWeight
= font32
->lfWeight
;
284 font16
->lfItalic
= font32
->lfItalic
;
285 font16
->lfUnderline
= font32
->lfUnderline
;
286 font16
->lfStrikeOut
= font32
->lfStrikeOut
;
287 font16
->lfCharSet
= font32
->lfCharSet
;
288 font16
->lfOutPrecision
= font32
->lfOutPrecision
;
289 font16
->lfClipPrecision
= font32
->lfClipPrecision
;
290 font16
->lfQuality
= font32
->lfQuality
;
291 font16
->lfPitchAndFamily
= font32
->lfPitchAndFamily
;
292 WideCharToMultiByte( CP_ACP
, 0, font32
->lfFaceName
, -1, font16
->lfFaceName
, LF_FACESIZE
, NULL
, NULL
);
293 font16
->lfFaceName
[LF_FACESIZE
-1] = 0;
296 /* convert a ENUMLOGFONTEXW to a ENUMLOGFONTEX16 */
297 static void enumlogfontex_W_to_16( const ENUMLOGFONTEXW
*fontW
,
298 LPENUMLOGFONTEX16 font16
)
300 logfont_W_to_16( (const LOGFONTW
*)fontW
, (LPLOGFONT16
)font16
);
302 WideCharToMultiByte( CP_ACP
, 0, fontW
->elfFullName
, -1,
303 (LPSTR
) font16
->elfFullName
, LF_FULLFACESIZE
, NULL
, NULL
);
304 font16
->elfFullName
[LF_FULLFACESIZE
-1] = '\0';
305 WideCharToMultiByte( CP_ACP
, 0, fontW
->elfStyle
, -1,
306 (LPSTR
) font16
->elfStyle
, LF_FACESIZE
, NULL
, NULL
);
307 font16
->elfStyle
[LF_FACESIZE
-1] = '\0';
308 WideCharToMultiByte( CP_ACP
, 0, fontW
->elfScript
, -1,
309 (LPSTR
) font16
->elfScript
, LF_FACESIZE
, NULL
, NULL
);
310 font16
->elfScript
[LF_FACESIZE
-1] = '\0';
313 /* convert a NEWTEXTMETRICEXW to a NEWTEXTMETRICEX16 */
314 static void newtextmetricex_W_to_16( const NEWTEXTMETRICEXW
*ptmW
,
315 LPNEWTEXTMETRICEX16 ptm16
)
317 ptm16
->ntmTm
.tmHeight
= ptmW
->ntmTm
.tmHeight
;
318 ptm16
->ntmTm
.tmAscent
= ptmW
->ntmTm
.tmAscent
;
319 ptm16
->ntmTm
.tmDescent
= ptmW
->ntmTm
.tmDescent
;
320 ptm16
->ntmTm
.tmInternalLeading
= ptmW
->ntmTm
.tmInternalLeading
;
321 ptm16
->ntmTm
.tmExternalLeading
= ptmW
->ntmTm
.tmExternalLeading
;
322 ptm16
->ntmTm
.tmAveCharWidth
= ptmW
->ntmTm
.tmAveCharWidth
;
323 ptm16
->ntmTm
.tmMaxCharWidth
= ptmW
->ntmTm
.tmMaxCharWidth
;
324 ptm16
->ntmTm
.tmWeight
= ptmW
->ntmTm
.tmWeight
;
325 ptm16
->ntmTm
.tmOverhang
= ptmW
->ntmTm
.tmOverhang
;
326 ptm16
->ntmTm
.tmDigitizedAspectX
= ptmW
->ntmTm
.tmDigitizedAspectX
;
327 ptm16
->ntmTm
.tmDigitizedAspectY
= ptmW
->ntmTm
.tmDigitizedAspectY
;
328 ptm16
->ntmTm
.tmFirstChar
= ptmW
->ntmTm
.tmFirstChar
> 255 ? 255 : ptmW
->ntmTm
.tmFirstChar
;
329 ptm16
->ntmTm
.tmLastChar
= ptmW
->ntmTm
.tmLastChar
> 255 ? 255 : ptmW
->ntmTm
.tmLastChar
;
330 ptm16
->ntmTm
.tmDefaultChar
= ptmW
->ntmTm
.tmDefaultChar
> 255 ? 255 : ptmW
->ntmTm
.tmDefaultChar
;
331 ptm16
->ntmTm
.tmBreakChar
= ptmW
->ntmTm
.tmBreakChar
> 255 ? 255 : ptmW
->ntmTm
.tmBreakChar
;
332 ptm16
->ntmTm
.tmItalic
= ptmW
->ntmTm
.tmItalic
;
333 ptm16
->ntmTm
.tmUnderlined
= ptmW
->ntmTm
.tmUnderlined
;
334 ptm16
->ntmTm
.tmStruckOut
= ptmW
->ntmTm
.tmStruckOut
;
335 ptm16
->ntmTm
.tmPitchAndFamily
= ptmW
->ntmTm
.tmPitchAndFamily
;
336 ptm16
->ntmTm
.tmCharSet
= ptmW
->ntmTm
.tmCharSet
;
337 ptm16
->ntmTm
.ntmFlags
= ptmW
->ntmTm
.ntmFlags
;
338 ptm16
->ntmTm
.ntmSizeEM
= ptmW
->ntmTm
.ntmSizeEM
;
339 ptm16
->ntmTm
.ntmCellHeight
= ptmW
->ntmTm
.ntmCellHeight
;
340 ptm16
->ntmTm
.ntmAvgWidth
= ptmW
->ntmTm
.ntmAvgWidth
;
341 ptm16
->ntmFontSig
= ptmW
->ntmFontSig
;
345 * callback for EnumFontFamiliesEx16
346 * Note: plf is really an ENUMLOGFONTEXW, and ptm is a NEWTEXTMETRICEXW.
347 * We have to use other types because of the FONTENUMPROCW definition.
349 static INT CALLBACK
enum_font_callback( const LOGFONTW
*plf
,
350 const TEXTMETRICW
*ptm
, DWORD fType
,
353 const struct callback16_info
*info
= (struct callback16_info
*)param
;
354 ENUMLOGFONTEX16 elfe16
;
355 NEWTEXTMETRICEX16 ntm16
;
361 enumlogfontex_W_to_16((const ENUMLOGFONTEXW
*)plf
, &elfe16
);
362 newtextmetricex_W_to_16((const NEWTEXTMETRICEXW
*)ptm
, &ntm16
);
363 segelfe16
= MapLS( &elfe16
);
364 segntm16
= MapLS( &ntm16
);
365 args
[6] = SELECTOROF(segelfe16
);
366 args
[5] = OFFSETOF(segelfe16
);
367 args
[4] = SELECTOROF(segntm16
);
368 args
[3] = OFFSETOF(segntm16
);
370 args
[1] = HIWORD(info
->param
);
371 args
[0] = LOWORD(info
->param
);
373 WOWCallback16Ex( (DWORD
)info
->proc
, WCB16_PASCAL
, sizeof(args
), args
, &ret
);
374 UnMapLS( segelfe16
);
379 struct dib_segptr_bits
387 static struct list dib_segptr_list
= LIST_INIT( dib_segptr_list
);
389 static SEGPTR
alloc_segptr_bits( HBITMAP bmp
, void *bits32
)
392 unsigned int i
, size
;
393 struct dib_segptr_bits
*bits
;
395 if (!(bits
= HeapAlloc( GetProcessHeap(), 0, sizeof(*bits
) ))) return 0;
397 GetObjectW( bmp
, sizeof(dib
), &dib
);
398 size
= dib
.dsBm
.bmHeight
* dib
.dsBm
.bmWidthBytes
;
400 /* calculate number of sel's needed for size with 64K steps */
401 bits
->bmp
= HBITMAP_16( bmp
);
402 bits
->count
= (size
+ 0xffff) / 0x10000;
403 bits
->sel
= AllocSelectorArray16( bits
->count
);
405 for (i
= 0; i
< bits
->count
; i
++)
407 SetSelectorBase(bits
->sel
+ (i
<< __AHSHIFT
), (DWORD
)bits32
+ i
* 0x10000);
408 SetSelectorLimit16(bits
->sel
+ (i
<< __AHSHIFT
), size
- 1); /* yep, limit is correct */
411 list_add_head( &dib_segptr_list
, &bits
->entry
);
412 return MAKESEGPTR( bits
->sel
, 0 );
415 static void free_segptr_bits( HBITMAP16 bmp
)
418 struct dib_segptr_bits
*bits
;
420 LIST_FOR_EACH_ENTRY( bits
, &dib_segptr_list
, struct dib_segptr_bits
, entry
)
422 if (bits
->bmp
!= bmp
) continue;
423 for (i
= 0; i
< bits
->count
; i
++) FreeSelector16( bits
->sel
+ (i
<< __AHSHIFT
) );
425 list_remove( &bits
->entry
);
426 HeapFree( GetProcessHeap(), 0, bits
);
432 /***********************************************************************
435 COLORREF WINAPI
SetBkColor16( HDC16 hdc
, COLORREF color
)
437 return SetBkColor( HDC_32(hdc
), color
);
441 /***********************************************************************
444 INT16 WINAPI
SetBkMode16( HDC16 hdc
, INT16 mode
)
446 return SetBkMode( HDC_32(hdc
), mode
);
450 /***********************************************************************
453 INT16 WINAPI
SetMapMode16( HDC16 hdc
, INT16 mode
)
455 return SetMapMode( HDC_32(hdc
), mode
);
459 /***********************************************************************
462 INT16 WINAPI
SetROP216( HDC16 hdc
, INT16 mode
)
464 return SetROP2( HDC_32(hdc
), mode
);
468 /***********************************************************************
471 INT16 WINAPI
SetRelAbs16( HDC16 hdc
, INT16 mode
)
473 return SetRelAbs( HDC_32(hdc
), mode
);
477 /***********************************************************************
478 * SetPolyFillMode (GDI.6)
480 INT16 WINAPI
SetPolyFillMode16( HDC16 hdc
, INT16 mode
)
482 return SetPolyFillMode( HDC_32(hdc
), mode
);
486 /***********************************************************************
487 * SetStretchBltMode (GDI.7)
489 INT16 WINAPI
SetStretchBltMode16( HDC16 hdc
, INT16 mode
)
491 return SetStretchBltMode( HDC_32(hdc
), mode
);
495 /***********************************************************************
496 * SetTextCharacterExtra (GDI.8)
498 INT16 WINAPI
SetTextCharacterExtra16( HDC16 hdc
, INT16 extra
)
500 return SetTextCharacterExtra( HDC_32(hdc
), extra
);
504 /***********************************************************************
505 * SetTextColor (GDI.9)
507 COLORREF WINAPI
SetTextColor16( HDC16 hdc
, COLORREF color
)
509 return SetTextColor( HDC_32(hdc
), color
);
513 /***********************************************************************
514 * SetTextJustification (GDI.10)
516 INT16 WINAPI
SetTextJustification16( HDC16 hdc
, INT16 extra
, INT16 breaks
)
518 return SetTextJustification( HDC_32(hdc
), extra
, breaks
);
522 /***********************************************************************
523 * SetWindowOrg (GDI.11)
525 DWORD WINAPI
SetWindowOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
528 if (!SetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
529 return MAKELONG( pt
.x
, pt
.y
);
533 /***********************************************************************
534 * SetWindowExt (GDI.12)
536 DWORD WINAPI
SetWindowExt16( HDC16 hdc
, INT16 x
, INT16 y
)
539 if (!SetWindowExtEx( HDC_32(hdc
), x
, y
, &size
)) return 0;
540 return MAKELONG( size
.cx
, size
.cy
);
544 /***********************************************************************
545 * SetViewportOrg (GDI.13)
547 DWORD WINAPI
SetViewportOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
550 if (!SetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
551 return MAKELONG( pt
.x
, pt
.y
);
555 /***********************************************************************
556 * SetViewportExt (GDI.14)
558 DWORD WINAPI
SetViewportExt16( HDC16 hdc
, INT16 x
, INT16 y
)
561 if (!SetViewportExtEx( HDC_32(hdc
), x
, y
, &size
)) return 0;
562 return MAKELONG( size
.cx
, size
.cy
);
566 /***********************************************************************
567 * OffsetWindowOrg (GDI.15)
569 DWORD WINAPI
OffsetWindowOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
572 if (!OffsetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
573 return MAKELONG( pt
.x
, pt
.y
);
577 /***********************************************************************
578 * ScaleWindowExt (GDI.16)
580 DWORD WINAPI
ScaleWindowExt16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
581 INT16 yNum
, INT16 yDenom
)
584 if (!ScaleWindowExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
, &size
))
586 return MAKELONG( size
.cx
, size
.cy
);
590 /***********************************************************************
591 * OffsetViewportOrg (GDI.17)
593 DWORD WINAPI
OffsetViewportOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
596 if (!OffsetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
597 return MAKELONG( pt
.x
, pt
.y
);
601 /***********************************************************************
602 * ScaleViewportExt (GDI.18)
604 DWORD WINAPI
ScaleViewportExt16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
605 INT16 yNum
, INT16 yDenom
)
608 if (!ScaleViewportExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
, &size
))
610 return MAKELONG( size
.cx
, size
.cy
);
614 /***********************************************************************
617 BOOL16 WINAPI
LineTo16( HDC16 hdc
, INT16 x
, INT16 y
)
619 return LineTo( HDC_32(hdc
), x
, y
);
623 /***********************************************************************
626 DWORD WINAPI
MoveTo16( HDC16 hdc
, INT16 x
, INT16 y
)
630 if (!MoveToEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
631 return MAKELONG(pt
.x
,pt
.y
);
635 /***********************************************************************
636 * ExcludeClipRect (GDI.21)
638 INT16 WINAPI
ExcludeClipRect16( HDC16 hdc
, INT16 left
, INT16 top
,
639 INT16 right
, INT16 bottom
)
641 return ExcludeClipRect( HDC_32(hdc
), left
, top
, right
, bottom
);
645 /***********************************************************************
646 * IntersectClipRect (GDI.22)
648 INT16 WINAPI
IntersectClipRect16( HDC16 hdc
, INT16 left
, INT16 top
,
649 INT16 right
, INT16 bottom
)
651 return IntersectClipRect( HDC_32(hdc
), left
, top
, right
, bottom
);
655 /***********************************************************************
658 BOOL16 WINAPI
Arc16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
659 INT16 bottom
, INT16 xstart
, INT16 ystart
,
660 INT16 xend
, INT16 yend
)
662 return Arc( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
666 /***********************************************************************
669 BOOL16 WINAPI
Ellipse16( HDC16 hdc
, INT16 left
, INT16 top
,
670 INT16 right
, INT16 bottom
)
672 return Ellipse( HDC_32(hdc
), left
, top
, right
, bottom
);
676 /**********************************************************************
679 BOOL16 WINAPI
FloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
681 return ExtFloodFill( HDC_32(hdc
), x
, y
, color
, FLOODFILLBORDER
);
685 /***********************************************************************
688 BOOL16 WINAPI
Pie16( HDC16 hdc
, INT16 left
, INT16 top
,
689 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
690 INT16 xend
, INT16 yend
)
692 return Pie( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
696 /***********************************************************************
699 BOOL16 WINAPI
Rectangle16( HDC16 hdc
, INT16 left
, INT16 top
,
700 INT16 right
, INT16 bottom
)
702 return Rectangle( HDC_32(hdc
), left
, top
, right
, bottom
);
706 /***********************************************************************
709 BOOL16 WINAPI
RoundRect16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
710 INT16 bottom
, INT16 ell_width
, INT16 ell_height
)
712 return RoundRect( HDC_32(hdc
), left
, top
, right
, bottom
, ell_width
, ell_height
);
716 /***********************************************************************
719 BOOL16 WINAPI
PatBlt16( HDC16 hdc
, INT16 left
, INT16 top
,
720 INT16 width
, INT16 height
, DWORD rop
)
722 return PatBlt( HDC_32(hdc
), left
, top
, width
, height
, rop
);
726 /***********************************************************************
729 INT16 WINAPI
SaveDC16( HDC16 hdc
)
731 return SaveDC( HDC_32(hdc
) );
735 /***********************************************************************
738 COLORREF WINAPI
SetPixel16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
740 return SetPixel( HDC_32(hdc
), x
, y
, color
);
744 /***********************************************************************
745 * OffsetClipRgn (GDI.32)
747 INT16 WINAPI
OffsetClipRgn16( HDC16 hdc
, INT16 x
, INT16 y
)
749 return OffsetClipRgn( HDC_32(hdc
), x
, y
);
753 /***********************************************************************
756 BOOL16 WINAPI
TextOut16( HDC16 hdc
, INT16 x
, INT16 y
, LPCSTR str
, INT16 count
)
758 return TextOutA( HDC_32(hdc
), x
, y
, str
, count
);
762 /***********************************************************************
765 BOOL16 WINAPI
BitBlt16( HDC16 hdcDst
, INT16 xDst
, INT16 yDst
, INT16 width
,
766 INT16 height
, HDC16 hdcSrc
, INT16 xSrc
, INT16 ySrc
,
769 return BitBlt( HDC_32(hdcDst
), xDst
, yDst
, width
, height
, HDC_32(hdcSrc
), xSrc
, ySrc
, rop
);
773 /***********************************************************************
774 * StretchBlt (GDI.35)
776 BOOL16 WINAPI
StretchBlt16( HDC16 hdcDst
, INT16 xDst
, INT16 yDst
,
777 INT16 widthDst
, INT16 heightDst
,
778 HDC16 hdcSrc
, INT16 xSrc
, INT16 ySrc
,
779 INT16 widthSrc
, INT16 heightSrc
, DWORD rop
)
781 return StretchBlt( HDC_32(hdcDst
), xDst
, yDst
, widthDst
, heightDst
,
782 HDC_32(hdcSrc
), xSrc
, ySrc
, widthSrc
, heightSrc
, rop
);
786 /**********************************************************************
789 BOOL16 WINAPI
Polygon16( HDC16 hdc
, const POINT16
* pt
, INT16 count
)
793 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, count
*sizeof(POINT
) );
795 if (!pt32
) return FALSE
;
801 ret
= Polygon(HDC_32(hdc
),pt32
,count
);
802 HeapFree( GetProcessHeap(), 0, pt32
);
807 /**********************************************************************
810 BOOL16 WINAPI
Polyline16( HDC16 hdc
, const POINT16
* pt
, INT16 count
)
814 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, count
*sizeof(POINT
) );
816 if (!pt32
) return FALSE
;
822 ret
= Polyline(HDC_32(hdc
),pt32
,count
);
823 HeapFree( GetProcessHeap(), 0, pt32
);
828 /***********************************************************************
831 INT16 WINAPI
Escape16( HDC16 hdc
, INT16 escape
, INT16 in_count
, SEGPTR in_data
, LPVOID out_data
)
837 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
838 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
839 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
840 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
841 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
842 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
843 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
844 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
845 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
846 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
847 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
848 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
849 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
854 case EXT_DEVICE_CAPS
:
857 case POSTSCRIPT_IGNORE
:
858 case QUERYESCSUPPORT
:
859 case SET_ARC_DIRECTION
:
861 case SET_SCREEN_ANGLE
:
864 INT16
*ptr
= MapSL(in_data
);
866 return Escape( HDC_32(hdc
), escape
, sizeof(data
), (LPCSTR
)&data
, out_data
);
869 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
872 UINT16
*ptr
= MapSL(in_data
);
874 return Escape( HDC_32(hdc
), escape
, sizeof(data
), (LPCSTR
)&data
, NULL
);
877 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
878 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
879 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
880 case GETPHYSPAGESIZE
:
881 case GETPRINTINGOFFSET
:
882 case GETSCALINGFACTOR
:
884 POINT16
*ptr
= out_data
;
886 ret
= Escape( HDC_32(hdc
), escape
, 0, NULL
, &pt32
);
892 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
893 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
894 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
895 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
896 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
897 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
898 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
899 case ENABLEPAIRKERNING
:
900 case ENABLERELATIVEWIDTHS
:
907 INT16
*new = MapSL(in_data
);
908 INT16
*old
= out_data
;
910 ret
= Escape( HDC_32(hdc
), escape
, sizeof(in
), (LPCSTR
)&in
, &out
);
915 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
917 return SetAbortProc16( hdc
, (ABORTPROC16
)in_data
);
919 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
920 * lpvOutData is actually a pointer to the DocInfo structure and used as
921 * a second input parameter */
925 ret
= StartDoc16( hdc
, out_data
);
926 if (ret
> 0) ret
= StartPage( HDC_32(hdc
) );
929 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), NULL
);
931 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
932 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
936 RECT16
*rc16
= MapSL(in_data
);
938 rc
.left
= rc16
->left
;
940 rc
.right
= rc16
->right
;
941 rc
.bottom
= rc16
->bottom
;
942 return Escape( HDC_32(hdc
), escape
, sizeof(rc
), (LPCSTR
)&rc
, NULL
);
945 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
949 RECT16
*rc16
= out_data
;
950 ret
= Escape( HDC_32(hdc
), escape
, 0, NULL
, &rc
);
951 rc16
->left
= rc
.left
;
953 rc16
->right
= rc
.right
;
954 rc16
->bottom
= rc
.bottom
;
957 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
958 case DRAWPATTERNRECT
:
961 DRAWPATRECT16
*pr16
= MapSL(in_data
);
963 pr
.ptPosition
.x
= pr16
->ptPosition
.x
;
964 pr
.ptPosition
.y
= pr16
->ptPosition
.y
;
965 pr
.ptSize
.x
= pr16
->ptSize
.x
;
966 pr
.ptSize
.y
= pr16
->ptSize
.y
;
967 pr
.wStyle
= pr16
->wStyle
;
968 pr
.wPattern
= pr16
->wPattern
;
969 return Escape( HDC_32(hdc
), escape
, sizeof(pr
), (LPCSTR
)&pr
, NULL
);
972 /* Escape(hdc,ABORTDOC,NULL,NULL); */
973 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
974 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
975 /* Escape(hdc,ENDDOC,NULL,NULL); */
976 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
977 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
978 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
979 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
980 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
981 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
982 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
983 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
984 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
985 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
986 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
987 /* Escape(hdc,NEWFRAME,NULL,NULL); */
988 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
989 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
990 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
991 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
992 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
993 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
994 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
1003 case GETPAIRKERNTABLE
:
1004 case GETSETPAPERBINS
:
1005 case GETSETPRINTORIENT
:
1006 case GETSETSCREENPARAMS
:
1008 case GETTRACKKERNTABLE
:
1014 case SETALLJUSTVALUES
:
1016 case SET_BACKGROUND_COLOR
:
1018 /* pass it unmodified to the 32-bit function */
1019 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), out_data
);
1021 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
1022 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
1023 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
1024 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
1025 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
1026 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
1027 case ENUMPAPERMETRICS
:
1028 case GETEXTENDEDTEXTMETRICS
:
1029 case GETEXTENTTABLE
:
1030 case GETSETPAPERMETRICS
:
1031 case GETVECTORBRUSHSIZE
:
1032 case GETVECTORPENSIZE
:
1034 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
1035 escape
, in_count
, MapSL(in_data
), out_data
);
1036 return Escape( HDC_32(hdc
), escape
, in_count
, MapSL(in_data
), out_data
);
1041 /***********************************************************************
1042 * RestoreDC (GDI.39)
1044 BOOL16 WINAPI
RestoreDC16( HDC16 hdc
, INT16 level
)
1046 return RestoreDC( HDC_32(hdc
), level
);
1050 /***********************************************************************
1053 BOOL16 WINAPI
FillRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
)
1055 return FillRgn( HDC_32(hdc
), HRGN_32(hrgn
), HBRUSH_32(hbrush
) );
1059 /***********************************************************************
1062 BOOL16 WINAPI
FrameRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
,
1063 INT16 nWidth
, INT16 nHeight
)
1065 return FrameRgn( HDC_32(hdc
), HRGN_32(hrgn
), HBRUSH_32(hbrush
), nWidth
, nHeight
);
1069 /***********************************************************************
1070 * InvertRgn (GDI.42)
1072 BOOL16 WINAPI
InvertRgn16( HDC16 hdc
, HRGN16 hrgn
)
1074 return InvertRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
1078 /***********************************************************************
1081 BOOL16 WINAPI
PaintRgn16( HDC16 hdc
, HRGN16 hrgn
)
1083 return PaintRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
1087 /***********************************************************************
1088 * SelectClipRgn (GDI.44)
1090 INT16 WINAPI
SelectClipRgn16( HDC16 hdc
, HRGN16 hrgn
)
1092 return SelectClipRgn( HDC_32(hdc
), HRGN_32(hrgn
) );
1096 /***********************************************************************
1097 * SelectObject (GDI.45)
1099 HGDIOBJ16 WINAPI
SelectObject16( HDC16 hdc
, HGDIOBJ16 handle
)
1101 return HGDIOBJ_16( SelectObject( HDC_32(hdc
), HGDIOBJ_32(handle
) ) );
1105 /***********************************************************************
1106 * CombineRgn (GDI.47)
1108 INT16 WINAPI
CombineRgn16(HRGN16 hDest
, HRGN16 hSrc1
, HRGN16 hSrc2
, INT16 mode
)
1110 return CombineRgn( HRGN_32(hDest
), HRGN_32(hSrc1
), HRGN_32(hSrc2
), mode
);
1114 /***********************************************************************
1115 * CreateBitmap (GDI.48)
1117 HBITMAP16 WINAPI
CreateBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
1118 UINT16 bpp
, LPCVOID bits
)
1120 return HBITMAP_16( CreateBitmap( width
, height
, planes
& 0xff, bpp
& 0xff, bits
) );
1124 /***********************************************************************
1125 * CreateBitmapIndirect (GDI.49)
1127 HBITMAP16 WINAPI
CreateBitmapIndirect16( const BITMAP16
* bmp
)
1129 return CreateBitmap16( bmp
->bmWidth
, bmp
->bmHeight
, bmp
->bmPlanes
,
1130 bmp
->bmBitsPixel
, MapSL( bmp
->bmBits
) );
1134 /***********************************************************************
1135 * CreateBrushIndirect (GDI.50)
1137 HBRUSH16 WINAPI
CreateBrushIndirect16( const LOGBRUSH16
* brush
)
1141 if (brush
->lbStyle
== BS_DIBPATTERN
|| brush
->lbStyle
== BS_DIBPATTERN8X8
)
1142 return CreateDIBPatternBrush16( brush
->lbHatch
, brush
->lbColor
);
1144 brush32
.lbStyle
= brush
->lbStyle
;
1145 brush32
.lbColor
= brush
->lbColor
;
1146 brush32
.lbHatch
= brush
->lbHatch
;
1147 return HBRUSH_16( CreateBrushIndirect(&brush32
) );
1151 /***********************************************************************
1152 * CreateCompatibleBitmap (GDI.51)
1154 HBITMAP16 WINAPI
CreateCompatibleBitmap16( HDC16 hdc
, INT16 width
, INT16 height
)
1156 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc
), width
, height
) );
1160 /***********************************************************************
1161 * CreateCompatibleDC (GDI.52)
1163 HDC16 WINAPI
CreateCompatibleDC16( HDC16 hdc
)
1165 return HDC_16( CreateCompatibleDC( HDC_32(hdc
) ) );
1169 /***********************************************************************
1172 HDC16 WINAPI
CreateDC16( LPCSTR driver
, LPCSTR device
, LPCSTR output
,
1173 const DEVMODEA
*initData
)
1175 return HDC_16( CreateDCA( driver
, device
, output
, initData
) );
1179 /***********************************************************************
1180 * CreateEllipticRgn (GDI.54)
1182 HRGN16 WINAPI
CreateEllipticRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
1184 return HRGN_16( CreateEllipticRgn( left
, top
, right
, bottom
) );
1188 /***********************************************************************
1189 * CreateEllipticRgnIndirect (GDI.55)
1191 HRGN16 WINAPI
CreateEllipticRgnIndirect16( const RECT16
*rect
)
1193 return HRGN_16( CreateEllipticRgn( rect
->left
, rect
->top
, rect
->right
, rect
->bottom
) );
1197 /***********************************************************************
1198 * CreateFont (GDI.56)
1200 HFONT16 WINAPI
CreateFont16(INT16 height
, INT16 width
, INT16 esc
, INT16 orient
,
1201 INT16 weight
, BYTE italic
, BYTE underline
,
1202 BYTE strikeout
, BYTE charset
, BYTE outpres
,
1203 BYTE clippres
, BYTE quality
, BYTE pitch
,
1206 return HFONT_16( CreateFontA( height
, width
, esc
, orient
, weight
, italic
, underline
,
1207 strikeout
, charset
, outpres
, clippres
, quality
, pitch
, name
));
1210 /***********************************************************************
1211 * CreateFontIndirect (GDI.57)
1213 HFONT16 WINAPI
CreateFontIndirect16( const LOGFONT16
*plf16
)
1220 logfont_16_to_W( plf16
, &lfW
);
1221 ret
= CreateFontIndirectW( &lfW
);
1223 else ret
= CreateFontIndirectW( NULL
);
1224 return HFONT_16(ret
);
1228 /***********************************************************************
1229 * CreateHatchBrush (GDI.58)
1231 HBRUSH16 WINAPI
CreateHatchBrush16( INT16 style
, COLORREF color
)
1233 return HBRUSH_16( CreateHatchBrush( style
, color
) );
1237 /***********************************************************************
1238 * CreatePatternBrush (GDI.60)
1240 HBRUSH16 WINAPI
CreatePatternBrush16( HBITMAP16 hbitmap
)
1242 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap
) ));
1246 /***********************************************************************
1247 * CreatePen (GDI.61)
1249 HPEN16 WINAPI
CreatePen16( INT16 style
, INT16 width
, COLORREF color
)
1253 logpen
.lopnStyle
= style
;
1254 logpen
.lopnWidth
.x
= width
;
1255 logpen
.lopnWidth
.y
= 0;
1256 logpen
.lopnColor
= color
;
1257 return HPEN_16( CreatePenIndirect( &logpen
) );
1261 /***********************************************************************
1262 * CreatePenIndirect (GDI.62)
1264 HPEN16 WINAPI
CreatePenIndirect16( const LOGPEN16
* pen
)
1268 if (pen
->lopnStyle
> PS_INSIDEFRAME
) return 0;
1269 logpen
.lopnStyle
= pen
->lopnStyle
;
1270 logpen
.lopnWidth
.x
= pen
->lopnWidth
.x
;
1271 logpen
.lopnWidth
.y
= pen
->lopnWidth
.y
;
1272 logpen
.lopnColor
= pen
->lopnColor
;
1273 return HPEN_16( CreatePenIndirect( &logpen
) );
1277 /***********************************************************************
1278 * CreatePolygonRgn (GDI.63)
1280 HRGN16 WINAPI
CreatePolygonRgn16( const POINT16
* points
, INT16 count
, INT16 mode
)
1282 return CreatePolyPolygonRgn16( points
, &count
, 1, mode
);
1286 /***********************************************************************
1287 * CreateRectRgn (GDI.64)
1289 * NOTE: cf. SetRectRgn16
1291 HRGN16 WINAPI
CreateRectRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
1295 if (left
< right
) hrgn
= CreateRectRgn( left
, top
, right
, bottom
);
1296 else hrgn
= CreateRectRgn( 0, 0, 0, 0 );
1297 return HRGN_16(hrgn
);
1301 /***********************************************************************
1302 * CreateRectRgnIndirect (GDI.65)
1304 HRGN16 WINAPI
CreateRectRgnIndirect16( const RECT16
* rect
)
1306 return CreateRectRgn16( rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
1310 /***********************************************************************
1311 * CreateSolidBrush (GDI.66)
1313 HBRUSH16 WINAPI
CreateSolidBrush16( COLORREF color
)
1315 return HBRUSH_16( CreateSolidBrush( color
) );
1319 /***********************************************************************
1322 BOOL16 WINAPI
DeleteDC16( HDC16 hdc
)
1324 if (DeleteDC( HDC_32(hdc
) ))
1326 struct saved_visrgn
*saved
, *next
;
1327 struct gdi_thunk
* thunk
;
1329 if ((thunk
= GDI_FindThunk(hdc
))) GDI_DeleteThunk(thunk
);
1331 LIST_FOR_EACH_ENTRY_SAFE( saved
, next
, &saved_regions
, struct saved_visrgn
, entry
)
1333 if (saved
->hdc
!= HDC_32(hdc
)) continue;
1334 list_remove( &saved
->entry
);
1335 DeleteObject( saved
->hrgn
);
1336 HeapFree( GetProcessHeap(), 0, saved
);
1344 /***********************************************************************
1345 * DeleteObject (GDI.69)
1346 * SysDeleteObject (GDI.605)
1348 BOOL16 WINAPI
DeleteObject16( HGDIOBJ16 obj
)
1350 if (GetObjectType( HGDIOBJ_32(obj
) ) == OBJ_BITMAP
) free_segptr_bits( obj
);
1351 return DeleteObject( HGDIOBJ_32(obj
) );
1355 /***********************************************************************
1356 * EnumFonts (GDI.70)
1358 INT16 WINAPI
EnumFonts16( HDC16 hDC
, LPCSTR lpName
, FONTENUMPROC16 efproc
,
1361 return EnumFontFamilies16( hDC
, lpName
, efproc
, lpData
);
1365 /***********************************************************************
1366 * EnumObjects (GDI.71)
1368 INT16 WINAPI
EnumObjects16( HDC16 hdc
, INT16 obj
, GOBJENUMPROC16 proc
, LPARAM lParam
)
1370 struct callback16_info info
;
1372 info
.proc
= (FARPROC16
)proc
;
1373 info
.param
= lParam
;
1377 return EnumObjects( HDC_32(hdc
), OBJ_PEN
, enum_pens_callback
, (LPARAM
)&info
);
1379 return EnumObjects( HDC_32(hdc
), OBJ_BRUSH
, enum_brushes_callback
, (LPARAM
)&info
);
1385 /***********************************************************************
1388 BOOL16 WINAPI
EqualRgn16( HRGN16 rgn1
, HRGN16 rgn2
)
1390 return EqualRgn( HRGN_32(rgn1
), HRGN_32(rgn2
) );
1394 /***********************************************************************
1395 * GetBitmapBits (GDI.74)
1397 LONG WINAPI
GetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPVOID buffer
)
1399 return GetBitmapBits( HBITMAP_32(hbitmap
), count
, buffer
);
1403 /***********************************************************************
1404 * GetBkColor (GDI.75)
1406 COLORREF WINAPI
GetBkColor16( HDC16 hdc
)
1408 return GetBkColor( HDC_32(hdc
) );
1412 /***********************************************************************
1413 * GetBkMode (GDI.76)
1415 INT16 WINAPI
GetBkMode16( HDC16 hdc
)
1417 return GetBkMode( HDC_32(hdc
) );
1421 /***********************************************************************
1422 * GetClipBox (GDI.77)
1424 INT16 WINAPI
GetClipBox16( HDC16 hdc
, LPRECT16 rect
)
1427 INT ret
= GetClipBox( HDC_32(hdc
), &rect32
);
1431 rect
->left
= rect32
.left
;
1432 rect
->top
= rect32
.top
;
1433 rect
->right
= rect32
.right
;
1434 rect
->bottom
= rect32
.bottom
;
1440 /***********************************************************************
1441 * GetCurrentPosition (GDI.78)
1443 DWORD WINAPI
GetCurrentPosition16( HDC16 hdc
)
1446 if (!GetCurrentPositionEx( HDC_32(hdc
), &pt32
)) return 0;
1447 return MAKELONG( pt32
.x
, pt32
.y
);
1451 /***********************************************************************
1454 DWORD WINAPI
GetDCOrg16( HDC16 hdc
)
1457 if (GetDCOrgEx( HDC_32(hdc
), &pt
)) return MAKELONG( pt
.x
, pt
.y
);
1462 /***********************************************************************
1463 * GetDeviceCaps (GDI.80)
1465 INT16 WINAPI
GetDeviceCaps16( HDC16 hdc
, INT16 cap
)
1467 INT16 ret
= GetDeviceCaps( HDC_32(hdc
), cap
);
1468 /* some apps don't expect -1 and think it's a B&W screen */
1469 if ((cap
== NUMCOLORS
) && (ret
== -1)) ret
= 2048;
1474 /***********************************************************************
1475 * GetMapMode (GDI.81)
1477 INT16 WINAPI
GetMapMode16( HDC16 hdc
)
1479 return GetMapMode( HDC_32(hdc
) );
1483 /***********************************************************************
1484 * GetObject (GDI.82)
1486 INT16 WINAPI
GetObject16( HGDIOBJ16 handle16
, INT16 count
, LPVOID buffer
)
1488 HGDIOBJ handle
= HGDIOBJ_32( handle16
);
1489 switch( GetObjectType( handle
))
1494 LOGPEN16
*pen16
= buffer
;
1497 if (count
< sizeof(LOGPEN16
)) return 0;
1498 if (!GetObjectW( handle
, sizeof(pen
), &pen
)) return 0;
1500 pen16
->lopnStyle
= pen
.lopnStyle
;
1501 pen16
->lopnColor
= pen
.lopnColor
;
1502 pen16
->lopnWidth
.x
= pen
.lopnWidth
.x
;
1503 pen16
->lopnWidth
.y
= pen
.lopnWidth
.y
;
1505 return sizeof(LOGPEN16
);
1513 if (!GetObjectW( handle
, sizeof(brush
), &brush
)) return 0;
1514 brush16
.lbStyle
= brush
.lbStyle
;
1515 brush16
.lbColor
= brush
.lbColor
;
1516 brush16
.lbHatch
= brush
.lbHatch
;
1517 if (count
> sizeof(brush16
)) count
= sizeof(brush16
);
1518 memcpy( buffer
, &brush16
, count
);
1521 return sizeof(LOGBRUSH16
);
1524 return GetObjectW( handle
, count
, buffer
);
1532 if (!GetObjectW( handle
, sizeof(font
), &font
)) return 0;
1533 logfont_W_to_16( &font
, &font16
);
1534 if (count
> sizeof(font16
)) count
= sizeof(font16
);
1535 memcpy( buffer
, &font16
, count
);
1538 return sizeof(LOGFONT16
);
1544 BITMAP16
*bmp16
= buffer
;
1546 if (!(size
= GetObjectW( handle
, sizeof(dib
), &dib
))) return 0;
1547 if (size
== sizeof(DIBSECTION
) && count
> sizeof(BITMAP16
))
1549 FIXME("not implemented for DIBs: count %d\n", count
);
1554 if (count
< sizeof(BITMAP16
)) return 0;
1555 bmp16
->bmType
= dib
.dsBm
.bmType
;
1556 bmp16
->bmWidth
= dib
.dsBm
.bmWidth
;
1557 bmp16
->bmHeight
= dib
.dsBm
.bmHeight
;
1558 bmp16
->bmWidthBytes
= dib
.dsBm
.bmWidthBytes
;
1559 bmp16
->bmPlanes
= dib
.dsBm
.bmPlanes
;
1560 bmp16
->bmBitsPixel
= dib
.dsBm
.bmBitsPixel
;
1562 return sizeof(BITMAP16
);
1572 /***********************************************************************
1575 COLORREF WINAPI
GetPixel16( HDC16 hdc
, INT16 x
, INT16 y
)
1577 return GetPixel( HDC_32(hdc
), x
, y
);
1581 /***********************************************************************
1582 * GetPolyFillMode (GDI.84)
1584 INT16 WINAPI
GetPolyFillMode16( HDC16 hdc
)
1586 return GetPolyFillMode( HDC_32(hdc
) );
1590 /***********************************************************************
1593 INT16 WINAPI
GetROP216( HDC16 hdc
)
1595 return GetROP2( HDC_32(hdc
) );
1599 /***********************************************************************
1600 * GetRelAbs (GDI.86)
1602 INT16 WINAPI
GetRelAbs16( HDC16 hdc
)
1604 return GetRelAbs( HDC_32(hdc
), 0 );
1608 /***********************************************************************
1609 * GetStockObject (GDI.87)
1611 HGDIOBJ16 WINAPI
GetStockObject16( INT16 obj
)
1613 return HGDIOBJ_16( GetStockObject( obj
) );
1617 /***********************************************************************
1618 * GetStretchBltMode (GDI.88)
1620 INT16 WINAPI
GetStretchBltMode16( HDC16 hdc
)
1622 return GetStretchBltMode( HDC_32(hdc
) );
1626 /***********************************************************************
1627 * GetTextCharacterExtra (GDI.89)
1629 INT16 WINAPI
GetTextCharacterExtra16( HDC16 hdc
)
1631 return GetTextCharacterExtra( HDC_32(hdc
) );
1635 /***********************************************************************
1636 * GetTextColor (GDI.90)
1638 COLORREF WINAPI
GetTextColor16( HDC16 hdc
)
1640 return GetTextColor( HDC_32(hdc
) );
1644 /***********************************************************************
1645 * GetTextExtent (GDI.91)
1647 DWORD WINAPI
GetTextExtent16( HDC16 hdc
, LPCSTR str
, INT16 count
)
1650 if (!GetTextExtentPoint32A( HDC_32(hdc
), str
, count
, &size
)) return 0;
1651 return MAKELONG( size
.cx
, size
.cy
);
1655 /***********************************************************************
1656 * GetTextFace (GDI.92)
1658 INT16 WINAPI
GetTextFace16( HDC16 hdc
, INT16 count
, LPSTR name
)
1660 return GetTextFaceA( HDC_32(hdc
), count
, name
);
1664 /***********************************************************************
1665 * GetTextMetrics (GDI.93)
1667 BOOL16 WINAPI
GetTextMetrics16( HDC16 hdc
, TEXTMETRIC16
*tm
)
1671 if (!GetTextMetricsW( HDC_32(hdc
), &tm32
)) return FALSE
;
1673 tm
->tmHeight
= tm32
.tmHeight
;
1674 tm
->tmAscent
= tm32
.tmAscent
;
1675 tm
->tmDescent
= tm32
.tmDescent
;
1676 tm
->tmInternalLeading
= tm32
.tmInternalLeading
;
1677 tm
->tmExternalLeading
= tm32
.tmExternalLeading
;
1678 tm
->tmAveCharWidth
= tm32
.tmAveCharWidth
;
1679 tm
->tmMaxCharWidth
= tm32
.tmMaxCharWidth
;
1680 tm
->tmWeight
= tm32
.tmWeight
;
1681 tm
->tmOverhang
= tm32
.tmOverhang
;
1682 tm
->tmDigitizedAspectX
= tm32
.tmDigitizedAspectX
;
1683 tm
->tmDigitizedAspectY
= tm32
.tmDigitizedAspectY
;
1684 tm
->tmFirstChar
= tm32
.tmFirstChar
;
1685 tm
->tmLastChar
= tm32
.tmLastChar
;
1686 tm
->tmDefaultChar
= tm32
.tmDefaultChar
;
1687 tm
->tmBreakChar
= tm32
.tmBreakChar
;
1688 tm
->tmItalic
= tm32
.tmItalic
;
1689 tm
->tmUnderlined
= tm32
.tmUnderlined
;
1690 tm
->tmStruckOut
= tm32
.tmStruckOut
;
1691 tm
->tmPitchAndFamily
= tm32
.tmPitchAndFamily
;
1692 tm
->tmCharSet
= tm32
.tmCharSet
;
1697 /***********************************************************************
1698 * GetViewportExt (GDI.94)
1700 DWORD WINAPI
GetViewportExt16( HDC16 hdc
)
1703 if (!GetViewportExtEx( HDC_32(hdc
), &size
)) return 0;
1704 return MAKELONG( size
.cx
, size
.cy
);
1708 /***********************************************************************
1709 * GetViewportOrg (GDI.95)
1711 DWORD WINAPI
GetViewportOrg16( HDC16 hdc
)
1714 if (!GetViewportOrgEx( HDC_32(hdc
), &pt
)) return 0;
1715 return MAKELONG( pt
.x
, pt
.y
);
1719 /***********************************************************************
1720 * GetWindowExt (GDI.96)
1722 DWORD WINAPI
GetWindowExt16( HDC16 hdc
)
1725 if (!GetWindowExtEx( HDC_32(hdc
), &size
)) return 0;
1726 return MAKELONG( size
.cx
, size
.cy
);
1730 /***********************************************************************
1731 * GetWindowOrg (GDI.97)
1733 DWORD WINAPI
GetWindowOrg16( HDC16 hdc
)
1736 if (!GetWindowOrgEx( HDC_32(hdc
), &pt
)) return 0;
1737 return MAKELONG( pt
.x
, pt
.y
);
1743 /**********************************************************************
1746 void WINAPI
LineDDA16( INT16 nXStart
, INT16 nYStart
, INT16 nXEnd
,
1747 INT16 nYEnd
, LINEDDAPROC16 proc
, LPARAM lParam
)
1749 struct callback16_info info
;
1750 info
.proc
= (FARPROC16
)proc
;
1751 info
.param
= lParam
;
1752 LineDDA( nXStart
, nYStart
, nXEnd
, nYEnd
, linedda_callback
, (LPARAM
)&info
);
1756 /***********************************************************************
1757 * OffsetRgn (GDI.101)
1759 INT16 WINAPI
OffsetRgn16( HRGN16 hrgn
, INT16 x
, INT16 y
)
1761 return OffsetRgn( HRGN_32(hrgn
), x
, y
);
1765 /***********************************************************************
1766 * PtVisible (GDI.103)
1768 BOOL16 WINAPI
PtVisible16( HDC16 hdc
, INT16 x
, INT16 y
)
1770 return PtVisible( HDC_32(hdc
), x
, y
);
1774 /***********************************************************************
1775 * SelectVisRgn (GDI.105)
1777 INT16 WINAPI
SelectVisRgn16( HDC16 hdc
, HRGN16 hrgn
)
1779 FIXME( "%04x %04x no longer supported\n", hdc
, hrgn
);
1784 /***********************************************************************
1785 * SetBitmapBits (GDI.106)
1787 LONG WINAPI
SetBitmapBits16( HBITMAP16 hbitmap
, LONG count
, LPCVOID buffer
)
1789 return SetBitmapBits( HBITMAP_32(hbitmap
), count
, buffer
);
1793 /***********************************************************************
1794 * AddFontResource (GDI.119)
1796 INT16 WINAPI
AddFontResource16( LPCSTR filename
)
1798 return AddFontResourceA( filename
);
1802 /***********************************************************************
1805 * Disables GDI, switches back to text mode.
1806 * We don't have to do anything here,
1807 * just let console support handle everything
1809 void WINAPI
Death16(HDC16 hdc
)
1811 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc
);
1815 /***********************************************************************
1816 * Resurrection (GDI.122)
1818 * Restores GDI functionality
1820 void WINAPI
Resurrection16(HDC16 hdc
,
1821 WORD w1
, WORD w2
, WORD w3
, WORD w4
, WORD w5
, WORD w6
)
1823 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1824 hdc
, w1
, w2
, w3
, w4
, w5
, w6
);
1828 /***********************************************************************
1831 INT16 WINAPI
MulDiv16( INT16 nMultiplicand
, INT16 nMultiplier
, INT16 nDivisor
)
1834 if (!nDivisor
) return -32768;
1835 /* We want to deal with a positive divisor to simplify the logic. */
1838 nMultiplicand
= - nMultiplicand
;
1839 nDivisor
= -nDivisor
;
1841 /* If the result is positive, we "add" to round. else,
1842 * we subtract to round. */
1843 if ( ( (nMultiplicand
< 0) && (nMultiplier
< 0) ) ||
1844 ( (nMultiplicand
>= 0) && (nMultiplier
>= 0) ) )
1845 ret
= (((int)nMultiplicand
* nMultiplier
) + (nDivisor
/2)) / nDivisor
;
1847 ret
= (((int)nMultiplicand
* nMultiplier
) - (nDivisor
/2)) / nDivisor
;
1848 if ((ret
> 32767) || (ret
< -32767)) return -32768;
1853 /***********************************************************************
1854 * GetRgnBox (GDI.134)
1856 INT16 WINAPI
GetRgnBox16( HRGN16 hrgn
, LPRECT16 rect
)
1859 INT16 ret
= GetRgnBox( HRGN_32(hrgn
), &r
);
1860 rect
->left
= r
.left
;
1862 rect
->right
= r
.right
;
1863 rect
->bottom
= r
.bottom
;
1868 /***********************************************************************
1869 * RemoveFontResource (GDI.136)
1871 BOOL16 WINAPI
RemoveFontResource16( LPCSTR str
)
1873 return RemoveFontResourceA(str
);
1877 /***********************************************************************
1878 * SetBrushOrg (GDI.148)
1880 DWORD WINAPI
SetBrushOrg16( HDC16 hdc
, INT16 x
, INT16 y
)
1884 if (!SetBrushOrgEx( HDC_32(hdc
), x
, y
, &pt
)) return 0;
1885 return MAKELONG( pt
.x
, pt
.y
);
1889 /***********************************************************************
1890 * GetBrushOrg (GDI.149)
1892 DWORD WINAPI
GetBrushOrg16( HDC16 hdc
)
1895 if (!GetBrushOrgEx( HDC_32(hdc
), &pt
)) return 0;
1896 return MAKELONG( pt
.x
, pt
.y
);
1900 /***********************************************************************
1901 * UnrealizeObject (GDI.150)
1903 BOOL16 WINAPI
UnrealizeObject16( HGDIOBJ16 obj
)
1905 return UnrealizeObject( HGDIOBJ_32(obj
) );
1909 /***********************************************************************
1910 * CreateIC (GDI.153)
1912 HDC16 WINAPI
CreateIC16( LPCSTR driver
, LPCSTR device
, LPCSTR output
,
1913 const DEVMODEA
* initData
)
1915 return HDC_16( CreateICA( driver
, device
, output
, initData
) );
1919 /***********************************************************************
1920 * GetNearestColor (GDI.154)
1922 COLORREF WINAPI
GetNearestColor16( HDC16 hdc
, COLORREF color
)
1924 return GetNearestColor( HDC_32(hdc
), color
);
1928 /***********************************************************************
1929 * CreateDiscardableBitmap (GDI.156)
1931 HBITMAP16 WINAPI
CreateDiscardableBitmap16( HDC16 hdc
, INT16 width
, INT16 height
)
1933 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc
), width
, height
) );
1937 /***********************************************************************
1938 * PtInRegion (GDI.161)
1940 BOOL16 WINAPI
PtInRegion16( HRGN16 hrgn
, INT16 x
, INT16 y
)
1942 return PtInRegion( HRGN_32(hrgn
), x
, y
);
1946 /***********************************************************************
1947 * GetBitmapDimension (GDI.162)
1949 DWORD WINAPI
GetBitmapDimension16( HBITMAP16 hbitmap
)
1952 if (!GetBitmapDimensionEx16( hbitmap
, &size
)) return 0;
1953 return MAKELONG( size
.cx
, size
.cy
);
1957 /***********************************************************************
1958 * SetBitmapDimension (GDI.163)
1960 DWORD WINAPI
SetBitmapDimension16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
)
1963 if (!SetBitmapDimensionEx16( hbitmap
, x
, y
, &size
)) return 0;
1964 return MAKELONG( size
.cx
, size
.cy
);
1968 /***********************************************************************
1969 * SetRectRgn (GDI.172)
1971 * NOTE: Win 3.1 sets region to empty if left > right
1973 void WINAPI
SetRectRgn16( HRGN16 hrgn
, INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
1975 if (left
< right
) SetRectRgn( HRGN_32(hrgn
), left
, top
, right
, bottom
);
1976 else SetRectRgn( HRGN_32(hrgn
), 0, 0, 0, 0 );
1980 /******************************************************************
1981 * PlayMetaFileRecord (GDI.176)
1983 void WINAPI
PlayMetaFileRecord16( HDC16 hdc
, HANDLETABLE16
*ht
, METARECORD
*mr
, UINT16 handles
)
1985 HANDLETABLE
*ht32
= HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET(HANDLETABLE
, objectHandle
[handles
] ));
1988 for (i
= 0; i
< handles
; i
++) ht32
->objectHandle
[i
] = HGDIOBJ_32(ht
->objectHandle
[i
]);
1989 PlayMetaFileRecord( HDC_32(hdc
), ht32
, mr
, handles
);
1990 for (i
= 0; i
< handles
; i
++) ht
->objectHandle
[i
] = HGDIOBJ_16(ht32
->objectHandle
[i
]);
1991 HeapFree( GetProcessHeap(), 0, ht32
);
1995 /***********************************************************************
1996 * SetDCHook (GDI.190)
1998 BOOL16 WINAPI
SetDCHook16( HDC16 hdc16
, FARPROC16 hookProc
, DWORD dwHookData
)
2000 FIXME( "%04x %p %x: not supported\n", hdc16
, hookProc
, dwHookData
);
2005 /***********************************************************************
2006 * GetDCHook (GDI.191)
2008 DWORD WINAPI
GetDCHook16( HDC16 hdc16
, FARPROC16
*phookProc
)
2010 FIXME( "%04x: not supported\n", hdc16
);
2015 /***********************************************************************
2016 * SetHookFlags (GDI.192)
2018 WORD WINAPI
SetHookFlags16( HDC16 hdc
, WORD flags
)
2020 FIXME( "%04x %x: not supported\n", hdc
, flags
);
2025 /***********************************************************************
2026 * SetBoundsRect (GDI.193)
2028 UINT16 WINAPI
SetBoundsRect16( HDC16 hdc
, const RECT16
* rect
, UINT16 flags
)
2033 rect32
.left
= rect
->left
;
2034 rect32
.top
= rect
->top
;
2035 rect32
.right
= rect
->right
;
2036 rect32
.bottom
= rect
->bottom
;
2037 return SetBoundsRect( HDC_32( hdc
), &rect32
, flags
);
2039 else return SetBoundsRect( HDC_32( hdc
), NULL
, flags
);
2043 /***********************************************************************
2044 * GetBoundsRect (GDI.194)
2046 UINT16 WINAPI
GetBoundsRect16( HDC16 hdc
, LPRECT16 rect
, UINT16 flags
)
2049 UINT ret
= GetBoundsRect( HDC_32( hdc
), &rect32
, flags
);
2052 rect
->left
= rect32
.left
;
2053 rect
->top
= rect32
.top
;
2054 rect
->right
= rect32
.right
;
2055 rect
->bottom
= rect32
.bottom
;
2061 /***********************************************************************
2062 * EngineEnumerateFont (GDI.300)
2064 WORD WINAPI
EngineEnumerateFont16(LPSTR fontname
, FARPROC16 proc
, DWORD data
)
2066 FIXME("(%s,%p,%x),stub\n",fontname
,proc
,data
);
2071 /***********************************************************************
2072 * EngineDeleteFont (GDI.301)
2074 WORD WINAPI
EngineDeleteFont16(LPFONTINFO16 lpFontInfo
)
2078 /* untested, don't know if it works.
2079 We seem to access some structure that is located after the
2080 FONTINFO. The FONTINFO documentation says that there may
2081 follow some char-width table or font bitmap or vector info.
2082 I think it is some kind of font bitmap that begins at offset 0x52,
2083 as FONTINFO goes up to 0x51.
2084 If this is correct, everything should be implemented correctly.
2086 if ( ((lpFontInfo
->dfType
& (RASTER_FONTTYPE
|DEVICE_FONTTYPE
)) == (RASTER_FONTTYPE
|DEVICE_FONTTYPE
))
2087 && (LOWORD(lpFontInfo
->dfFace
) == LOWORD(lpFontInfo
)+0x6e)
2088 && (handle
= *(WORD
*)(lpFontInfo
+0x54)) )
2090 *(WORD
*)(lpFontInfo
+0x54) = 0;
2091 GlobalFree16(handle
);
2097 /***********************************************************************
2098 * EngineRealizeFont (GDI.302)
2100 WORD WINAPI
EngineRealizeFont16(LPLOGFONT16 lplogFont
, LPTEXTXFORM16 lptextxform
, LPFONTINFO16 lpfontInfo
)
2102 FIXME("(%p,%p,%p),stub\n",lplogFont
,lptextxform
,lpfontInfo
);
2108 /***********************************************************************
2109 * EngineRealizeFontExt (GDI.315)
2111 WORD WINAPI
EngineRealizeFontExt16(LONG l1
, LONG l2
, LONG l3
, LONG l4
)
2113 FIXME("(%08x,%08x,%08x,%08x),stub\n",l1
,l2
,l3
,l4
);
2119 /***********************************************************************
2120 * EngineGetCharWidth (GDI.303)
2122 WORD WINAPI
EngineGetCharWidth16(LPFONTINFO16 lpFontInfo
, BYTE firstChar
, BYTE lastChar
, LPINT16 buffer
)
2126 for (i
= firstChar
; i
<= lastChar
; i
++)
2127 FIXME(" returns font's average width for range %d to %d\n", firstChar
, lastChar
);
2128 *buffer
++ = lpFontInfo
->dfAvgWidth
; /* insert some charwidth functionality here; use average width for now */
2133 /***********************************************************************
2134 * EngineSetFontContext (GDI.304)
2136 WORD WINAPI
EngineSetFontContext16(LPFONTINFO16 lpFontInfo
, WORD data
)
2142 /***********************************************************************
2143 * EngineGetGlyphBMP (GDI.305)
2145 WORD WINAPI
EngineGetGlyphBMP16(WORD word
, LPFONTINFO16 lpFontInfo
, WORD w1
, WORD w2
,
2146 LPSTR string
, DWORD dword
, /*LPBITMAPMETRICS16*/ LPVOID metrics
)
2153 /***********************************************************************
2154 * EngineMakeFontDir (GDI.306)
2156 DWORD WINAPI
EngineMakeFontDir16(HDC16 hdc
, LPFONTDIR16 fontdir
, LPCSTR string
)
2158 FIXME(" stub! (always fails)\n");
2159 return ~0UL; /* error */
2163 /***********************************************************************
2164 * GetCharABCWidths (GDI.307)
2166 BOOL16 WINAPI
GetCharABCWidths16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
, LPABC16 abc
)
2170 LPABC abc32
= HeapAlloc( GetProcessHeap(), 0, sizeof(ABC
) * (lastChar
- firstChar
+ 1) );
2172 if ((ret
= GetCharABCWidthsA( HDC_32(hdc
), firstChar
, lastChar
, abc32
)))
2174 for (i
= firstChar
; i
<= lastChar
; i
++)
2176 abc
[i
-firstChar
].abcA
= abc32
[i
-firstChar
].abcA
;
2177 abc
[i
-firstChar
].abcB
= abc32
[i
-firstChar
].abcB
;
2178 abc
[i
-firstChar
].abcC
= abc32
[i
-firstChar
].abcC
;
2181 HeapFree( GetProcessHeap(), 0, abc32
);
2186 /***********************************************************************
2187 * GetOutlineTextMetrics (GDI.308)
2189 * Gets metrics for TrueType fonts.
2192 * hdc [In] Handle of device context
2193 * cbData [In] Size of metric data array
2194 * lpOTM [Out] Address of metric data array
2197 * Success: Non-zero or size of required buffer
2201 * lpOTM should be LPOUTLINETEXTMETRIC
2203 UINT16 WINAPI
GetOutlineTextMetrics16( HDC16 hdc
, UINT16 cbData
,
2204 LPOUTLINETEXTMETRIC16 lpOTM
)
2206 FIXME("(%04x,%04x,%p): stub\n", hdc
,cbData
,lpOTM
);
2211 /***********************************************************************
2212 * GetGlyphOutline (GDI.309)
2214 DWORD WINAPI
GetGlyphOutline16( HDC16 hdc
, UINT16 uChar
, UINT16 fuFormat
,
2215 LPGLYPHMETRICS16 lpgm
, DWORD cbBuffer
,
2216 LPVOID lpBuffer
, const MAT2
*lpmat2
)
2221 ret
= GetGlyphOutlineA( HDC_32(hdc
), uChar
, fuFormat
, &gm32
, cbBuffer
, lpBuffer
, lpmat2
);
2222 if (ret
&& ret
!= GDI_ERROR
)
2224 lpgm
->gmBlackBoxX
= gm32
.gmBlackBoxX
;
2225 lpgm
->gmBlackBoxY
= gm32
.gmBlackBoxY
;
2226 lpgm
->gmptGlyphOrigin
.x
= gm32
.gmptGlyphOrigin
.x
;
2227 lpgm
->gmptGlyphOrigin
.y
= gm32
.gmptGlyphOrigin
.y
;
2228 lpgm
->gmCellIncX
= gm32
.gmCellIncX
;
2229 lpgm
->gmCellIncY
= gm32
.gmCellIncY
;
2235 /***********************************************************************
2236 * CreateScalableFontResource (GDI.310)
2238 BOOL16 WINAPI
CreateScalableFontResource16( UINT16 fHidden
, LPCSTR lpszResourceFile
,
2239 LPCSTR fontFile
, LPCSTR path
)
2241 return CreateScalableFontResourceA( fHidden
, lpszResourceFile
, fontFile
, path
);
2245 /*************************************************************************
2246 * GetFontData (GDI.311)
2249 DWORD WINAPI
GetFontData16( HDC16 hdc
, DWORD table
, DWORD offset
, LPVOID buffer
, DWORD count
)
2251 return GetFontData( HDC_32(hdc
), table
, offset
, buffer
, count
);
2255 /*************************************************************************
2256 * GetRasterizerCaps (GDI.313)
2258 BOOL16 WINAPI
GetRasterizerCaps16( LPRASTERIZER_STATUS lprs
, UINT16 cbNumBytes
)
2260 return GetRasterizerCaps( lprs
, cbNumBytes
);
2264 /***********************************************************************
2265 * EnumFontFamilies (GDI.330)
2267 INT16 WINAPI
EnumFontFamilies16( HDC16 hDC
, LPCSTR lpFamily
,
2268 FONTENUMPROC16 efproc
, LPARAM lpData
)
2274 if (!*lpFamily
) return 1;
2275 lstrcpynA( lf
.lfFaceName
, lpFamily
, LF_FACESIZE
);
2276 lf
.lfCharSet
= DEFAULT_CHARSET
;
2277 lf
.lfPitchAndFamily
= 0;
2282 return EnumFontFamiliesEx16( hDC
, plf
, efproc
, lpData
, 0 );
2286 /*************************************************************************
2287 * GetKerningPairs (GDI.332)
2290 INT16 WINAPI
GetKerningPairs16( HDC16 hdc
, INT16 count
, LPKERNINGPAIR16 pairs
)
2292 KERNINGPAIR
*pairs32
;
2295 if (!count
) return 0;
2297 if (!(pairs32
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(*pairs32
) ))) return 0;
2298 if ((ret
= GetKerningPairsA( HDC_32(hdc
), count
, pairs32
)))
2300 for (i
= 0; i
< ret
; i
++)
2302 pairs
->wFirst
= pairs32
->wFirst
;
2303 pairs
->wSecond
= pairs32
->wSecond
;
2304 pairs
->iKernAmount
= pairs32
->iKernAmount
;
2307 HeapFree( GetProcessHeap(), 0, pairs32
);
2313 /***********************************************************************
2314 * GetTextAlign (GDI.345)
2316 UINT16 WINAPI
GetTextAlign16( HDC16 hdc
)
2318 return GetTextAlign( HDC_32(hdc
) );
2322 /***********************************************************************
2323 * SetTextAlign (GDI.346)
2325 UINT16 WINAPI
SetTextAlign16( HDC16 hdc
, UINT16 align
)
2327 return SetTextAlign( HDC_32(hdc
), align
);
2331 /***********************************************************************
2334 BOOL16 WINAPI
Chord16( HDC16 hdc
, INT16 left
, INT16 top
,
2335 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
2336 INT16 xend
, INT16 yend
)
2338 return Chord( HDC_32(hdc
), left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
2342 /***********************************************************************
2343 * SetMapperFlags (GDI.349)
2345 DWORD WINAPI
SetMapperFlags16( HDC16 hdc
, DWORD flags
)
2347 return SetMapperFlags( HDC_32(hdc
), flags
);
2351 /***********************************************************************
2352 * GetCharWidth (GDI.350)
2354 BOOL16 WINAPI
GetCharWidth16( HDC16 hdc
, UINT16 firstChar
, UINT16 lastChar
, LPINT16 buffer
)
2356 BOOL retVal
= FALSE
;
2358 if( firstChar
!= lastChar
)
2360 LPINT buf32
= HeapAlloc(GetProcessHeap(), 0, sizeof(INT
)*(1 + (lastChar
- firstChar
)));
2363 LPINT obuf32
= buf32
;
2366 retVal
= GetCharWidth32A( HDC_32(hdc
), firstChar
, lastChar
, buf32
);
2369 for (i
= firstChar
; i
<= lastChar
; i
++) *buffer
++ = *buf32
++;
2371 HeapFree(GetProcessHeap(), 0, obuf32
);
2374 else /* happens quite often to warrant a special treatment */
2377 retVal
= GetCharWidth32A( HDC_32(hdc
), firstChar
, lastChar
, &chWidth
);
2384 /***********************************************************************
2385 * ExtTextOut (GDI.351)
2387 BOOL16 WINAPI
ExtTextOut16( HDC16 hdc
, INT16 x
, INT16 y
, UINT16 flags
,
2388 const RECT16
*lprect
, LPCSTR str
, UINT16 count
,
2394 LPINT lpdx32
= NULL
;
2397 lpdx32
= HeapAlloc( GetProcessHeap(),0, sizeof(INT
)*count
);
2398 if(lpdx32
== NULL
) return FALSE
;
2399 for (i
=count
;i
--;) lpdx32
[i
]=lpDx
[i
];
2403 rect32
.left
= lprect
->left
;
2404 rect32
.top
= lprect
->top
;
2405 rect32
.right
= lprect
->right
;
2406 rect32
.bottom
= lprect
->bottom
;
2408 ret
= ExtTextOutA(HDC_32(hdc
),x
,y
,flags
,lprect
?&rect32
:NULL
,str
,count
,lpdx32
);
2409 HeapFree( GetProcessHeap(), 0, lpdx32
);
2414 /***********************************************************************
2415 * CreatePalette (GDI.360)
2417 HPALETTE16 WINAPI
CreatePalette16( const LOGPALETTE
* palette
)
2419 return HPALETTE_16( CreatePalette( palette
) );
2423 /***********************************************************************
2424 * GDISelectPalette (GDI.361)
2426 HPALETTE16 WINAPI
GDISelectPalette16( HDC16 hdc
, HPALETTE16 hpalette
, WORD wBkg
)
2428 HPALETTE16 ret
= HPALETTE_16( SelectPalette( HDC_32(hdc
), HPALETTE_32(hpalette
), wBkg
));
2429 if (ret
&& !wBkg
) hPrimaryPalette
= hpalette
;
2434 /***********************************************************************
2435 * GDIRealizePalette (GDI.362)
2437 UINT16 WINAPI
GDIRealizePalette16( HDC16 hdc
)
2439 return RealizePalette( HDC_32(hdc
) );
2443 /***********************************************************************
2444 * GetPaletteEntries (GDI.363)
2446 UINT16 WINAPI
GetPaletteEntries16( HPALETTE16 hpalette
, UINT16 start
,
2447 UINT16 count
, LPPALETTEENTRY entries
)
2449 return GetPaletteEntries( HPALETTE_32(hpalette
), start
, count
, entries
);
2453 /***********************************************************************
2454 * SetPaletteEntries (GDI.364)
2456 UINT16 WINAPI
SetPaletteEntries16( HPALETTE16 hpalette
, UINT16 start
,
2457 UINT16 count
, const PALETTEENTRY
*entries
)
2459 return SetPaletteEntries( HPALETTE_32(hpalette
), start
, count
, entries
);
2463 /**********************************************************************
2464 * UpdateColors (GDI.366)
2466 INT16 WINAPI
UpdateColors16( HDC16 hdc
)
2468 UpdateColors( HDC_32(hdc
) );
2473 /***********************************************************************
2474 * AnimatePalette (GDI.367)
2476 void WINAPI
AnimatePalette16( HPALETTE16 hpalette
, UINT16 StartIndex
,
2477 UINT16 NumEntries
, const PALETTEENTRY
* PaletteColors
)
2479 AnimatePalette( HPALETTE_32(hpalette
), StartIndex
, NumEntries
, PaletteColors
);
2483 /***********************************************************************
2484 * ResizePalette (GDI.368)
2486 BOOL16 WINAPI
ResizePalette16( HPALETTE16 hpalette
, UINT16 cEntries
)
2488 return ResizePalette( HPALETTE_32(hpalette
), cEntries
);
2492 /***********************************************************************
2493 * GetNearestPaletteIndex (GDI.370)
2495 UINT16 WINAPI
GetNearestPaletteIndex16( HPALETTE16 hpalette
, COLORREF color
)
2497 return GetNearestPaletteIndex( HPALETTE_32(hpalette
), color
);
2501 /**********************************************************************
2502 * ExtFloodFill (GDI.372)
2504 BOOL16 WINAPI
ExtFloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
,
2507 return ExtFloodFill( HDC_32(hdc
), x
, y
, color
, fillType
);
2511 /***********************************************************************
2512 * SetSystemPaletteUse (GDI.373)
2514 UINT16 WINAPI
SetSystemPaletteUse16( HDC16 hdc
, UINT16 use
)
2516 return SetSystemPaletteUse( HDC_32(hdc
), use
);
2520 /***********************************************************************
2521 * GetSystemPaletteUse (GDI.374)
2523 UINT16 WINAPI
GetSystemPaletteUse16( HDC16 hdc
)
2525 return GetSystemPaletteUse( HDC_32(hdc
) );
2529 /***********************************************************************
2530 * GetSystemPaletteEntries (GDI.375)
2532 UINT16 WINAPI
GetSystemPaletteEntries16( HDC16 hdc
, UINT16 start
, UINT16 count
,
2533 LPPALETTEENTRY entries
)
2535 return GetSystemPaletteEntries( HDC_32(hdc
), start
, count
, entries
);
2539 /***********************************************************************
2542 HDC16 WINAPI
ResetDC16( HDC16 hdc
, const DEVMODEA
*devmode
)
2544 return HDC_16( ResetDCA(HDC_32(hdc
), devmode
) );
2548 /******************************************************************
2549 * StartDoc (GDI.377)
2551 INT16 WINAPI
StartDoc16( HDC16 hdc
, const DOCINFO16
*lpdoc
)
2555 docA
.cbSize
= lpdoc
->cbSize
;
2556 docA
.lpszDocName
= MapSL(lpdoc
->lpszDocName
);
2557 docA
.lpszOutput
= MapSL(lpdoc
->lpszOutput
);
2558 if(lpdoc
->cbSize
> offsetof(DOCINFO16
,lpszDatatype
))
2559 docA
.lpszDatatype
= MapSL(lpdoc
->lpszDatatype
);
2561 docA
.lpszDatatype
= NULL
;
2562 if(lpdoc
->cbSize
> offsetof(DOCINFO16
,fwType
))
2563 docA
.fwType
= lpdoc
->fwType
;
2566 return StartDocA( HDC_32(hdc
), &docA
);
2570 /******************************************************************
2573 INT16 WINAPI
EndDoc16( HDC16 hdc
)
2575 return EndDoc( HDC_32(hdc
) );
2579 /******************************************************************
2580 * StartPage (GDI.379)
2582 INT16 WINAPI
StartPage16( HDC16 hdc
)
2584 return StartPage( HDC_32(hdc
) );
2588 /******************************************************************
2591 INT16 WINAPI
EndPage16( HDC16 hdc
)
2593 return EndPage( HDC_32(hdc
) );
2597 /******************************************************************************
2598 * AbortDoc (GDI.382)
2600 INT16 WINAPI
AbortDoc16( HDC16 hdc
)
2602 return AbortDoc( HDC_32(hdc
) );
2606 /***********************************************************************
2607 * FastWindowFrame (GDI.400)
2609 BOOL16 WINAPI
FastWindowFrame16( HDC16 hdc
, const RECT16
*rect
,
2610 INT16 width
, INT16 height
, DWORD rop
)
2612 HDC hdc32
= HDC_32(hdc
);
2613 HBRUSH hbrush
= SelectObject( hdc32
, GetStockObject( GRAY_BRUSH
) );
2614 PatBlt( hdc32
, rect
->left
, rect
->top
,
2615 rect
->right
- rect
->left
- width
, height
, rop
);
2616 PatBlt( hdc32
, rect
->left
, rect
->top
+ height
, width
,
2617 rect
->bottom
- rect
->top
- height
, rop
);
2618 PatBlt( hdc32
, rect
->left
+ width
, rect
->bottom
- 1,
2619 rect
->right
- rect
->left
- width
, -height
, rop
);
2620 PatBlt( hdc32
, rect
->right
- 1, rect
->top
, -width
,
2621 rect
->bottom
- rect
->top
- height
, rop
);
2622 SelectObject( hdc32
, hbrush
);
2627 /***********************************************************************
2628 * GdiInit2 (GDI.403)
2630 * See "Undocumented Windows"
2634 * h2 [I] global data
2636 HANDLE16 WINAPI
GdiInit216( HANDLE16 h1
, HANDLE16 h2
)
2638 FIXME("(%04x, %04x), stub.\n", h1
, h2
);
2639 if (h2
== 0xffff) return 0xffff; /* undefined return value */
2640 return h1
; /* FIXME: should be the memory handle of h1 */
2644 /***********************************************************************
2645 * FinalGdiInit (GDI.405)
2647 void WINAPI
FinalGdiInit16( HBRUSH16 hPattern
/* [in] fill pattern of desktop */ )
2652 /***********************************************************************
2653 * CreateUserBitmap (GDI.407)
2655 HBITMAP16 WINAPI
CreateUserBitmap16( INT16 width
, INT16 height
, UINT16 planes
,
2656 UINT16 bpp
, LPCVOID bits
)
2658 return CreateBitmap16( width
, height
, planes
, bpp
, bits
);
2662 /***********************************************************************
2663 * CreateUserDiscardableBitmap (GDI.409)
2665 HBITMAP16 WINAPI
CreateUserDiscardableBitmap16( WORD dummy
, INT16 width
, INT16 height
)
2667 HDC hdc
= CreateDCA( "DISPLAY", NULL
, NULL
, NULL
);
2668 HBITMAP ret
= CreateCompatibleBitmap( hdc
, width
, height
);
2670 return HBITMAP_16(ret
);
2674 /***********************************************************************
2675 * GetCurLogFont (GDI.411)
2677 HFONT16 WINAPI
GetCurLogFont16( HDC16 hdc
)
2679 return HFONT_16( GetCurrentObject( HDC_32(hdc
), OBJ_FONT
) );
2683 /***********************************************************************
2684 * StretchDIBits (GDI.439)
2686 INT16 WINAPI
StretchDIBits16( HDC16 hdc
, INT16 xDst
, INT16 yDst
, INT16 widthDst
,
2687 INT16 heightDst
, INT16 xSrc
, INT16 ySrc
, INT16 widthSrc
,
2688 INT16 heightSrc
, const VOID
*bits
,
2689 const BITMAPINFO
*info
, UINT16 wUsage
, DWORD dwRop
)
2691 return StretchDIBits( HDC_32(hdc
), xDst
, yDst
, widthDst
, heightDst
,
2692 xSrc
, ySrc
, widthSrc
, heightSrc
, bits
,
2693 info
, wUsage
, dwRop
);
2697 /***********************************************************************
2698 * SetDIBits (GDI.440)
2700 INT16 WINAPI
SetDIBits16( HDC16 hdc
, HBITMAP16 hbitmap
, UINT16 startscan
,
2701 UINT16 lines
, LPCVOID bits
, const BITMAPINFO
*info
,
2704 return SetDIBits( HDC_32(hdc
), HBITMAP_32(hbitmap
), startscan
, lines
, bits
, info
, coloruse
);
2708 /***********************************************************************
2709 * GetDIBits (GDI.441)
2711 INT16 WINAPI
GetDIBits16( HDC16 hdc
, HBITMAP16 hbitmap
, UINT16 startscan
,
2712 UINT16 lines
, LPVOID bits
, BITMAPINFO
* info
,
2715 return GetDIBits( HDC_32(hdc
), HBITMAP_32(hbitmap
), startscan
, lines
, bits
, info
, coloruse
);
2719 /***********************************************************************
2720 * CreateDIBitmap (GDI.442)
2722 HBITMAP16 WINAPI
CreateDIBitmap16( HDC16 hdc
, const BITMAPINFOHEADER
* header
,
2723 DWORD init
, LPCVOID bits
, const BITMAPINFO
* data
,
2726 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc
), header
, init
, bits
, data
, coloruse
) );
2730 /***********************************************************************
2731 * SetDIBitsToDevice (GDI.443)
2733 INT16 WINAPI
SetDIBitsToDevice16( HDC16 hdc
, INT16 xDest
, INT16 yDest
, INT16 cx
,
2734 INT16 cy
, INT16 xSrc
, INT16 ySrc
, UINT16 startscan
,
2735 UINT16 lines
, LPCVOID bits
, const BITMAPINFO
*info
,
2738 return SetDIBitsToDevice( HDC_32(hdc
), xDest
, yDest
, cx
, cy
, xSrc
, ySrc
,
2739 startscan
, lines
, bits
, info
, coloruse
);
2743 /***********************************************************************
2744 * CreateRoundRectRgn (GDI.444)
2746 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2747 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2748 * we just let CreateRoundRectRgn convert them to +ve values.
2751 HRGN16 WINAPI
CreateRoundRectRgn16( INT16 left
, INT16 top
, INT16 right
, INT16 bottom
,
2752 INT16 ellipse_width
, INT16 ellipse_height
)
2754 if( ellipse_width
== 0 || ellipse_height
== 0 )
2755 return CreateRectRgn16( left
, top
, right
, bottom
);
2757 return HRGN_16( CreateRoundRectRgn( left
, top
, right
, bottom
,
2758 ellipse_width
, ellipse_height
));
2762 /***********************************************************************
2763 * CreateDIBPatternBrush (GDI.445)
2765 HBRUSH16 WINAPI
CreateDIBPatternBrush16( HGLOBAL16 hbitmap
, UINT16 coloruse
)
2770 if (!(bmi
= GlobalLock16( hbitmap
))) return 0;
2771 ret
= HBRUSH_16( CreateDIBPatternBrushPt( bmi
, coloruse
));
2772 GlobalUnlock16( hbitmap
);
2777 /**********************************************************************
2778 * PolyPolygon (GDI.450)
2780 BOOL16 WINAPI
PolyPolygon16( HDC16 hdc
, const POINT16
* pt
, const INT16
* counts
,
2789 for (i
=polygons
;i
--;)
2791 pt32
= HeapAlloc( GetProcessHeap(), 0, sizeof(POINT
)*nrpts
);
2792 if(pt32
== NULL
) return FALSE
;
2795 pt32
[i
].x
= pt
[i
].x
;
2796 pt32
[i
].y
= pt
[i
].y
;
2798 counts32
= HeapAlloc( GetProcessHeap(), 0, polygons
*sizeof(INT
) );
2799 if(counts32
== NULL
) {
2800 HeapFree( GetProcessHeap(), 0, pt32
);
2803 for (i
=polygons
;i
--;) counts32
[i
]=counts
[i
];
2805 ret
= PolyPolygon(HDC_32(hdc
),pt32
,counts32
,polygons
);
2806 HeapFree( GetProcessHeap(), 0, counts32
);
2807 HeapFree( GetProcessHeap(), 0, pt32
);
2812 /***********************************************************************
2813 * CreatePolyPolygonRgn (GDI.451)
2815 HRGN16 WINAPI
CreatePolyPolygonRgn16( const POINT16
*points
,
2816 const INT16
*count
, INT16 nbpolygons
, INT16 mode
)
2823 for (i
= 0; i
< nbpolygons
; i
++) npts
+= count
[i
];
2824 points32
= HeapAlloc( GetProcessHeap(), 0, npts
* sizeof(POINT
) );
2825 for (i
= 0; i
< npts
; i
++)
2827 points32
[i
].x
= points
[i
].x
;
2828 points32
[i
].y
= points
[i
].y
;
2831 count32
= HeapAlloc( GetProcessHeap(), 0, nbpolygons
* sizeof(INT
) );
2832 for (i
= 0; i
< nbpolygons
; i
++) count32
[i
] = count
[i
];
2833 hrgn
= CreatePolyPolygonRgn( points32
, count32
, nbpolygons
, mode
);
2834 HeapFree( GetProcessHeap(), 0, count32
);
2835 HeapFree( GetProcessHeap(), 0, points32
);
2836 return HRGN_16(hrgn
);
2840 /***********************************************************************
2841 * GdiSeeGdiDo (GDI.452)
2843 DWORD WINAPI
GdiSeeGdiDo16( WORD wReqType
, WORD wParam1
, WORD wParam2
,
2850 case 0x0001: /* LocalAlloc */
2851 WARN("LocalAlloc16(%x, %x): ignoring\n", wParam1
, wParam3
);
2854 case 0x0002: /* LocalFree */
2855 WARN("LocalFree16(%x): ignoring\n", wParam1
);
2858 case 0x0003: /* LocalCompact */
2859 WARN("LocalCompact16(%x): ignoring\n", wParam3
);
2860 ret
= 65000; /* lie about the amount of free space */
2862 case 0x0103: /* LocalHeap */
2863 WARN("LocalHeap16(): ignoring\n");
2866 WARN("(wReqType=%04x): Unknown\n", wReqType
);
2873 /***********************************************************************
2874 * SetObjectOwner (GDI.461)
2876 void WINAPI
SetObjectOwner16( HGDIOBJ16 handle
, HANDLE16 owner
)
2882 /***********************************************************************
2883 * IsGDIObject (GDI.462)
2885 * returns type of object if valid (W95 system programming secrets p. 264-5)
2887 BOOL16 WINAPI
IsGDIObject16( HGDIOBJ16 handle16
)
2889 static const BYTE type_map
[] =
2900 10, /* OBJ_METAFILE */
2903 9, /* OBJ_ENHMETADC */
2904 12, /* OBJ_ENHMETAFILE */
2905 0 /* OBJ_COLORSPACE */
2908 UINT type
= GetObjectType( HGDIOBJ_32( handle16
));
2910 if (type
>= sizeof(type_map
)/sizeof(type_map
[0])) return FALSE
;
2911 return type_map
[type
];
2915 /***********************************************************************
2916 * RectVisible (GDI.465)
2917 * RectVisibleOld (GDI.104)
2919 BOOL16 WINAPI
RectVisible16( HDC16 hdc
, const RECT16
* rect16
)
2923 rect
.left
= rect16
->left
;
2924 rect
.top
= rect16
->top
;
2925 rect
.right
= rect16
->right
;
2926 rect
.bottom
= rect16
->bottom
;
2927 return RectVisible( HDC_32(hdc
), &rect
);
2931 /***********************************************************************
2932 * RectInRegion (GDI.466)
2933 * RectInRegionOld (GDI.181)
2935 BOOL16 WINAPI
RectInRegion16( HRGN16 hrgn
, const RECT16
*rect
)
2939 r32
.left
= rect
->left
;
2940 r32
.top
= rect
->top
;
2941 r32
.right
= rect
->right
;
2942 r32
.bottom
= rect
->bottom
;
2943 return RectInRegion( HRGN_32(hrgn
), &r32
);
2947 /***********************************************************************
2948 * GetBitmapDimensionEx (GDI.468)
2950 BOOL16 WINAPI
GetBitmapDimensionEx16( HBITMAP16 hbitmap
, LPSIZE16 size
)
2953 BOOL ret
= GetBitmapDimensionEx( HBITMAP_32(hbitmap
), &size32
);
2957 size
->cx
= size32
.cx
;
2958 size
->cy
= size32
.cy
;
2964 /***********************************************************************
2965 * GetBrushOrgEx (GDI.469)
2967 BOOL16 WINAPI
GetBrushOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
2970 if (!GetBrushOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2977 /***********************************************************************
2978 * GetCurrentPositionEx (GDI.470)
2980 BOOL16 WINAPI
GetCurrentPositionEx16( HDC16 hdc
, LPPOINT16 pt
)
2983 if (!GetCurrentPositionEx( HDC_32(hdc
), &pt32
)) return FALSE
;
2990 /***********************************************************************
2991 * GetTextExtentPoint (GDI.471)
2993 * FIXME: Should this have a bug for compatibility?
2994 * Original Windows versions of GetTextExtentPoint{A,W} have documented
2995 * bugs (-> MSDN KB q147647.txt).
2997 BOOL16 WINAPI
GetTextExtentPoint16( HDC16 hdc
, LPCSTR str
, INT16 count
, LPSIZE16 size
)
3000 BOOL ret
= GetTextExtentPoint32A( HDC_32(hdc
), str
, count
, &size32
);
3004 size
->cx
= size32
.cx
;
3005 size
->cy
= size32
.cy
;
3011 /***********************************************************************
3012 * GetViewportExtEx (GDI.472)
3014 BOOL16 WINAPI
GetViewportExtEx16( HDC16 hdc
, LPSIZE16 size
)
3017 if (!GetViewportExtEx( HDC_32(hdc
), &size32
)) return FALSE
;
3018 size
->cx
= size32
.cx
;
3019 size
->cy
= size32
.cy
;
3024 /***********************************************************************
3025 * GetViewportOrgEx (GDI.473)
3027 BOOL16 WINAPI
GetViewportOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
3030 if (!GetViewportOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
3037 /***********************************************************************
3038 * GetWindowExtEx (GDI.474)
3040 BOOL16 WINAPI
GetWindowExtEx16( HDC16 hdc
, LPSIZE16 size
)
3043 if (!GetWindowExtEx( HDC_32(hdc
), &size32
)) return FALSE
;
3044 size
->cx
= size32
.cx
;
3045 size
->cy
= size32
.cy
;
3050 /***********************************************************************
3051 * GetWindowOrgEx (GDI.475)
3053 BOOL16 WINAPI
GetWindowOrgEx16( HDC16 hdc
, LPPOINT16 pt
)
3056 if (!GetWindowOrgEx( HDC_32(hdc
), &pt32
)) return FALSE
;
3063 /***********************************************************************
3064 * OffsetViewportOrgEx (GDI.476)
3066 BOOL16 WINAPI
OffsetViewportOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
3069 BOOL16 ret
= OffsetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
3079 /***********************************************************************
3080 * OffsetWindowOrgEx (GDI.477)
3082 BOOL16 WINAPI
OffsetWindowOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
3085 BOOL16 ret
= OffsetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
3095 /***********************************************************************
3096 * SetBitmapDimensionEx (GDI.478)
3098 BOOL16 WINAPI
SetBitmapDimensionEx16( HBITMAP16 hbitmap
, INT16 x
, INT16 y
, LPSIZE16 prevSize
)
3101 BOOL ret
= SetBitmapDimensionEx( HBITMAP_32(hbitmap
), x
, y
, &size32
);
3103 if (ret
&& prevSize
)
3105 prevSize
->cx
= size32
.cx
;
3106 prevSize
->cy
= size32
.cy
;
3112 /***********************************************************************
3113 * SetViewportExtEx (GDI.479)
3115 BOOL16 WINAPI
SetViewportExtEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPSIZE16 size
)
3118 BOOL16 ret
= SetViewportExtEx( HDC_32(hdc
), x
, y
, &size32
);
3119 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
3124 /***********************************************************************
3125 * SetViewportOrgEx (GDI.480)
3127 BOOL16 WINAPI
SetViewportOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
3130 BOOL16 ret
= SetViewportOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
3140 /***********************************************************************
3141 * SetWindowExtEx (GDI.481)
3143 BOOL16 WINAPI
SetWindowExtEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPSIZE16 size
)
3146 BOOL16 ret
= SetWindowExtEx( HDC_32(hdc
), x
, y
, &size32
);
3147 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
3152 /***********************************************************************
3153 * SetWindowOrgEx (GDI.482)
3155 BOOL16 WINAPI
SetWindowOrgEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
3158 BOOL16 ret
= SetWindowOrgEx( HDC_32(hdc
), x
, y
, &pt32
);
3168 /***********************************************************************
3169 * MoveToEx (GDI.483)
3171 BOOL16 WINAPI
MoveToEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
3175 if (!MoveToEx( HDC_32(hdc
), x
, y
, &pt32
)) return FALSE
;
3185 /***********************************************************************
3186 * ScaleViewportExtEx (GDI.484)
3188 BOOL16 WINAPI
ScaleViewportExtEx16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
3189 INT16 yNum
, INT16 yDenom
, LPSIZE16 size
)
3192 BOOL16 ret
= ScaleViewportExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
,
3194 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
3199 /***********************************************************************
3200 * ScaleWindowExtEx (GDI.485)
3202 BOOL16 WINAPI
ScaleWindowExtEx16( HDC16 hdc
, INT16 xNum
, INT16 xDenom
,
3203 INT16 yNum
, INT16 yDenom
, LPSIZE16 size
)
3206 BOOL16 ret
= ScaleWindowExtEx( HDC_32(hdc
), xNum
, xDenom
, yNum
, yDenom
,
3208 if (size
) { size
->cx
= size32
.cx
; size
->cy
= size32
.cy
; }
3213 /***********************************************************************
3214 * GetAspectRatioFilterEx (GDI.486)
3216 BOOL16 WINAPI
GetAspectRatioFilterEx16( HDC16 hdc
, LPSIZE16 pAspectRatio
)
3218 FIXME("(%04x, %p): -- Empty Stub !\n", hdc
, pAspectRatio
);
3223 /******************************************************************************
3224 * PolyBezier (GDI.502)
3226 BOOL16 WINAPI
PolyBezier16( HDC16 hdc
, const POINT16
* lppt
, INT16 cPoints
)
3230 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0, cPoints
*sizeof(POINT
) );
3231 if(!pt32
) return FALSE
;
3232 for (i
=cPoints
;i
--;)
3234 pt32
[i
].x
= lppt
[i
].x
;
3235 pt32
[i
].y
= lppt
[i
].y
;
3237 ret
= PolyBezier(HDC_32(hdc
), pt32
, cPoints
);
3238 HeapFree( GetProcessHeap(), 0, pt32
);
3243 /******************************************************************************
3244 * PolyBezierTo (GDI.503)
3246 BOOL16 WINAPI
PolyBezierTo16( HDC16 hdc
, const POINT16
* lppt
, INT16 cPoints
)
3250 LPPOINT pt32
= HeapAlloc( GetProcessHeap(), 0,
3251 cPoints
*sizeof(POINT
) );
3252 if(!pt32
) return FALSE
;
3253 for (i
=cPoints
;i
--;)
3255 pt32
[i
].x
= lppt
[i
].x
;
3256 pt32
[i
].y
= lppt
[i
].y
;
3258 ret
= PolyBezierTo(HDC_32(hdc
), pt32
, cPoints
);
3259 HeapFree( GetProcessHeap(), 0, pt32
);
3264 /******************************************************************************
3265 * ExtSelectClipRgn (GDI.508)
3267 INT16 WINAPI
ExtSelectClipRgn16( HDC16 hdc
, HRGN16 hrgn
, INT16 fnMode
)
3269 return ExtSelectClipRgn( HDC_32(hdc
), HRGN_32(hrgn
), fnMode
);
3273 /***********************************************************************
3274 * AbortPath (GDI.511)
3276 BOOL16 WINAPI
AbortPath16(HDC16 hdc
)
3278 return AbortPath( HDC_32(hdc
) );
3282 /***********************************************************************
3283 * BeginPath (GDI.512)
3285 BOOL16 WINAPI
BeginPath16(HDC16 hdc
)
3287 return BeginPath( HDC_32(hdc
) );
3291 /***********************************************************************
3292 * CloseFigure (GDI.513)
3294 BOOL16 WINAPI
CloseFigure16(HDC16 hdc
)
3296 return CloseFigure( HDC_32(hdc
) );
3300 /***********************************************************************
3303 BOOL16 WINAPI
EndPath16(HDC16 hdc
)
3305 return EndPath( HDC_32(hdc
) );
3309 /***********************************************************************
3310 * FillPath (GDI.515)
3312 BOOL16 WINAPI
FillPath16(HDC16 hdc
)
3314 return FillPath( HDC_32(hdc
) );
3318 /*******************************************************************
3319 * FlattenPath (GDI.516)
3321 BOOL16 WINAPI
FlattenPath16(HDC16 hdc
)
3323 return FlattenPath( HDC_32(hdc
) );
3327 /***********************************************************************
3330 INT16 WINAPI
GetPath16(HDC16 hdc
, LPPOINT16 pPoints
, LPBYTE pTypes
, INT16 nSize
)
3332 FIXME("(%d,%p,%p): stub\n",hdc
,pPoints
,pTypes
);
3337 /***********************************************************************
3338 * PathToRegion (GDI.518)
3340 HRGN16 WINAPI
PathToRegion16(HDC16 hdc
)
3342 return HRGN_16( PathToRegion( HDC_32(hdc
) ));
3346 /***********************************************************************
3347 * SelectClipPath (GDI.519)
3349 BOOL16 WINAPI
SelectClipPath16(HDC16 hdc
, INT16 iMode
)
3351 return SelectClipPath( HDC_32(hdc
), iMode
);
3355 /*******************************************************************
3356 * StrokeAndFillPath (GDI.520)
3358 BOOL16 WINAPI
StrokeAndFillPath16(HDC16 hdc
)
3360 return StrokeAndFillPath( HDC_32(hdc
) );
3364 /*******************************************************************
3365 * StrokePath (GDI.521)
3367 BOOL16 WINAPI
StrokePath16(HDC16 hdc
)
3369 return StrokePath( HDC_32(hdc
) );
3373 /*******************************************************************
3374 * WidenPath (GDI.522)
3376 BOOL16 WINAPI
WidenPath16(HDC16 hdc
)
3378 return WidenPath( HDC_32(hdc
) );
3382 /***********************************************************************
3383 * GetArcDirection (GDI.524)
3385 INT16 WINAPI
GetArcDirection16( HDC16 hdc
)
3387 return GetArcDirection( HDC_32(hdc
) );
3391 /***********************************************************************
3392 * SetArcDirection (GDI.525)
3394 INT16 WINAPI
SetArcDirection16( HDC16 hdc
, INT16 nDirection
)
3396 return SetArcDirection( HDC_32(hdc
), (INT
)nDirection
);
3400 /***********************************************************************
3401 * CreateHalftonePalette (GDI.529)
3403 HPALETTE16 WINAPI
CreateHalftonePalette16( HDC16 hdc
)
3405 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc
) ));
3409 /***********************************************************************
3410 * SetDIBColorTable (GDI.602)
3412 UINT16 WINAPI
SetDIBColorTable16( HDC16 hdc
, UINT16 startpos
, UINT16 entries
, RGBQUAD
*colors
)
3414 return SetDIBColorTable( HDC_32(hdc
), startpos
, entries
, colors
);
3418 /***********************************************************************
3419 * GetDIBColorTable (GDI.603)
3421 UINT16 WINAPI
GetDIBColorTable16( HDC16 hdc
, UINT16 startpos
, UINT16 entries
, RGBQUAD
*colors
)
3423 return GetDIBColorTable( HDC_32(hdc
), startpos
, entries
, colors
);
3427 /***********************************************************************
3428 * GetRegionData (GDI.607)
3430 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
3432 DWORD WINAPI
GetRegionData16( HRGN16 hrgn
, DWORD count
, LPRGNDATA rgndata
)
3434 return GetRegionData( HRGN_32(hrgn
), count
, rgndata
);
3438 /***********************************************************************
3439 * GdiFreeResources (GDI.609)
3441 WORD WINAPI
GdiFreeResources16( DWORD reserve
)
3443 return 90; /* lie about it, it shouldn't matter */
3447 /***********************************************************************
3448 * GdiSignalProc32 (GDI.610)
3450 WORD WINAPI
GdiSignalProc( UINT uCode
, DWORD dwThreadOrProcessID
,
3451 DWORD dwFlags
, HMODULE16 hModule
)
3457 /***********************************************************************
3458 * GetTextCharset (GDI.612)
3460 UINT16 WINAPI
GetTextCharset16( HDC16 hdc
)
3462 return GetTextCharset( HDC_32(hdc
) );
3466 /***********************************************************************
3467 * EnumFontFamiliesEx (GDI.613)
3469 INT16 WINAPI
EnumFontFamiliesEx16( HDC16 hdc
, LPLOGFONT16 plf
,
3470 FONTENUMPROC16 proc
, LPARAM lParam
,
3473 struct callback16_info info
;
3474 LOGFONTW lfW
, *plfW
;
3476 info
.proc
= (FARPROC16
)proc
;
3477 info
.param
= lParam
;
3481 logfont_16_to_W(plf
, &lfW
);
3486 return EnumFontFamiliesExW( HDC_32(hdc
), plfW
, enum_font_callback
,
3487 (LPARAM
)&info
, dwFlags
);
3491 /*************************************************************************
3492 * GetFontLanguageInfo (GDI.616)
3494 DWORD WINAPI
GetFontLanguageInfo16( HDC16 hdc
)
3496 return GetFontLanguageInfo( HDC_32(hdc
) );
3500 /***********************************************************************
3501 * SetLayout (GDI.1000)
3503 * Sets left->right or right->left text layout flags of a dc.
3505 BOOL16 WINAPI
SetLayout16( HDC16 hdc
, DWORD layout
)
3507 return SetLayout( HDC_32(hdc
), layout
);
3511 /***********************************************************************
3512 * SetSolidBrush (GDI.604)
3514 * Change the color of a solid brush.
3517 * hBrush [I] Brush to change the color of
3518 * newColor [I] New color for hBrush
3521 * Success: TRUE. The color of hBrush is set to newColor.
3525 * This function is undocumented and untested. The implementation may
3528 BOOL16 WINAPI
SetSolidBrush16(HBRUSH16 hBrush
, COLORREF newColor
)
3530 FIXME( "%04x %08x no longer supported\n", hBrush
, newColor
);
3535 /***********************************************************************
3538 void WINAPI
Copy16( LPVOID src
, LPVOID dst
, WORD size
)
3540 memcpy( dst
, src
, size
);
3543 /***********************************************************************
3544 * RealizeDefaultPalette (GDI.365)
3546 UINT16 WINAPI
RealizeDefaultPalette16( HDC16 hdc
)
3548 FIXME( "%04x semi-stub\n", hdc
);
3549 return GDIRealizePalette16( hdc
);
3552 /***********************************************************************
3553 * IsDCCurrentPalette (GDI.412)
3555 BOOL16 WINAPI
IsDCCurrentPalette16(HDC16 hDC
)
3557 return HPALETTE_16( GetCurrentObject( HDC_32(hDC
), OBJ_PAL
)) == hPrimaryPalette
;
3560 /*********************************************************************
3561 * SetMagicColors (GDI.606)
3563 VOID WINAPI
SetMagicColors16(HDC16 hDC
, COLORREF color
, UINT16 index
)
3565 FIXME("(hDC %04x, color %04x, index %04x): stub\n", hDC
, (int)color
, index
);
3570 /***********************************************************************
3573 BOOL16 WINAPI
DPtoLP16( HDC16 hdc
, LPPOINT16 points
, INT16 count
)
3575 POINT points32
[8], *pt32
= points32
;
3581 if (!(pt32
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(*pt32
) ))) return FALSE
;
3583 for (i
= 0; i
< count
; i
++)
3585 pt32
[i
].x
= points
[i
].x
;
3586 pt32
[i
].y
= points
[i
].y
;
3588 if ((ret
= DPtoLP( HDC_32(hdc
), pt32
, count
)))
3590 for (i
= 0; i
< count
; i
++)
3592 points
[i
].x
= pt32
[i
].x
;
3593 points
[i
].y
= pt32
[i
].y
;
3596 if (pt32
!= points32
) HeapFree( GetProcessHeap(), 0, pt32
);
3601 /***********************************************************************
3604 BOOL16 WINAPI
LPtoDP16( HDC16 hdc
, LPPOINT16 points
, INT16 count
)
3606 POINT points32
[8], *pt32
= points32
;
3612 if (!(pt32
= HeapAlloc( GetProcessHeap(), 0, count
* sizeof(*pt32
) ))) return FALSE
;
3614 for (i
= 0; i
< count
; i
++)
3616 pt32
[i
].x
= points
[i
].x
;
3617 pt32
[i
].y
= points
[i
].y
;
3619 if ((ret
= LPtoDP( HDC_32(hdc
), pt32
, count
)))
3621 for (i
= 0; i
< count
; i
++)
3623 points
[i
].x
= pt32
[i
].x
;
3624 points
[i
].y
= pt32
[i
].y
;
3627 if (pt32
!= points32
) HeapFree( GetProcessHeap(), 0, pt32
);
3632 /***********************************************************************
3633 * GetDCState (GDI.179)
3635 HDC16 WINAPI
GetDCState16( HDC16 hdc
)
3637 ERR( "no longer supported\n" );
3642 /***********************************************************************
3643 * SetDCState (GDI.180)
3645 void WINAPI
SetDCState16( HDC16 hdc
, HDC16 hdcs
)
3647 ERR( "no longer supported\n" );
3650 /***********************************************************************
3651 * SetDCOrg (GDI.117)
3653 DWORD WINAPI
SetDCOrg16( HDC16 hdc16
, INT16 x
, INT16 y
)
3655 FIXME( "%04x %d,%d no longer supported\n", hdc16
, x
, y
);
3660 /***********************************************************************
3661 * InquireVisRgn (GDI.131)
3663 HRGN16 WINAPI
InquireVisRgn16( HDC16 hdc
)
3667 if (!hrgn
) hrgn
= CreateRectRgn( 0, 0, 0, 0 );
3668 GetRandomRgn( HDC_32(hdc
), hrgn
, SYSRGN
);
3669 return HRGN_16(hrgn
);
3673 /***********************************************************************
3674 * OffsetVisRgn (GDI.102)
3676 INT16 WINAPI
OffsetVisRgn16( HDC16 hdc16
, INT16 x
, INT16 y
)
3678 FIXME( "%04x %d,%d no longer supported\n", hdc16
, x
, y
);
3683 /***********************************************************************
3684 * ExcludeVisRect (GDI.73)
3686 INT16 WINAPI
ExcludeVisRect16( HDC16 hdc16
, INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
3688 FIXME( "%04x %d,%d-%d,%d no longer supported\n", hdc16
, left
, top
, right
, bottom
);
3693 /***********************************************************************
3694 * IntersectVisRect (GDI.98)
3696 INT16 WINAPI
IntersectVisRect16( HDC16 hdc16
, INT16 left
, INT16 top
, INT16 right
, INT16 bottom
)
3698 FIXME( "%04x %d,%d-%d,%d no longer supported\n", hdc16
, left
, top
, right
, bottom
);
3703 /***********************************************************************
3704 * SaveVisRgn (GDI.129)
3706 HRGN16 WINAPI
SaveVisRgn16( HDC16 hdc16
)
3708 FIXME( "%04x no longer supported\n", hdc16
);
3713 /***********************************************************************
3714 * RestoreVisRgn (GDI.130)
3716 INT16 WINAPI
RestoreVisRgn16( HDC16 hdc16
)
3718 FIXME( "%04x no longer supported\n", hdc16
);
3723 /***********************************************************************
3724 * GetClipRgn (GDI.173)
3726 HRGN16 WINAPI
GetClipRgn16( HDC16 hdc
)
3730 if (!hrgn
) hrgn
= CreateRectRgn( 0, 0, 0, 0 );
3731 GetClipRgn( HDC_32(hdc
), hrgn
);
3732 return HRGN_16(hrgn
);
3736 /***********************************************************************
3737 * MakeObjectPrivate (GDI.463)
3739 * What does that mean ?
3740 * Some little docu can be found in "Undocumented Windows",
3741 * but this is basically useless.
3743 void WINAPI
MakeObjectPrivate16( HGDIOBJ16 handle16
, BOOL16
private )
3745 FIXME( "stub: %x %u\n", handle16
, private );
3748 /***********************************************************************
3749 * CreateDIBSection (GDI.489)
3751 HBITMAP16 WINAPI
CreateDIBSection16 (HDC16 hdc
, const BITMAPINFO
*bmi
, UINT16 usage
,
3752 SEGPTR
*bits16
, HANDLE section
, DWORD offset
)
3757 hbitmap
= CreateDIBSection( HDC_32(hdc
), bmi
, usage
, &bits32
, section
, offset
);
3758 if (hbitmap
&& bits32
&& bits16
) *bits16
= alloc_segptr_bits( hbitmap
, bits32
);
3759 return HBITMAP_16(hbitmap
);