dmsynth: Remove DECLSPEC_HIDDEN usage.
[wine.git] / dlls / gdi.exe16 / gdi.c
blob3f363ef2401e0d29fd9f3302f126c36be047fe5b
1 /*
2 * GDI 16-bit functions
4 * Copyright 2002 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
22 #include <stdlib.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "ntgdi.h"
27 #include "wownt32.h"
28 #include "wine/wingdi16.h"
29 #include "wine/list.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
34 #define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
35 #define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
37 struct saved_visrgn
39 struct list entry;
40 HDC hdc;
41 HRGN hrgn;
44 static struct list saved_regions = LIST_INIT( saved_regions );
46 static HPALETTE16 hPrimaryPalette;
49 * ############################################################################
52 #include <pshpack1.h>
53 #define GDI_MAX_THUNKS 32
55 static struct gdi_thunk
57 BYTE popl_eax; /* popl %eax (return address) */
58 BYTE pushl_pfn16; /* pushl pfn16 */
59 DWORD pfn16; /* pfn16 */
60 BYTE pushl_eax; /* pushl %eax */
61 BYTE jmp; /* ljmp GDI_Callback3216 */
62 DWORD callback;
63 HDC16 hdc;
64 } *GDI_Thunks;
66 #include <poppack.h>
68 /**********************************************************************
69 * GDI_Callback3216
71 static BOOL CALLBACK GDI_Callback3216( DWORD pfn16, HDC hdc, INT code )
73 if (pfn16)
75 WORD args[2];
76 DWORD ret;
78 args[1] = HDC_16(hdc);
79 args[0] = code;
80 WOWCallback16Ex( pfn16, WCB16_PASCAL, sizeof(args), args, &ret );
81 return LOWORD(ret);
83 return TRUE;
87 /******************************************************************
88 * GDI_AddThunk
91 static struct gdi_thunk* GDI_AddThunk(HDC16 dc16, ABORTPROC16 pfn16)
93 struct gdi_thunk* thunk;
95 if (!GDI_Thunks)
97 GDI_Thunks = VirtualAlloc(NULL, GDI_MAX_THUNKS * sizeof(*GDI_Thunks),
98 MEM_COMMIT, PAGE_EXECUTE_READWRITE);
99 if (!GDI_Thunks)
101 return NULL;
103 for (thunk = GDI_Thunks; thunk < &GDI_Thunks[GDI_MAX_THUNKS]; thunk++)
105 thunk->popl_eax = 0x58; /* popl %eax */
106 thunk->pushl_pfn16 = 0x68; /* pushl pfn16 */
107 thunk->pfn16 = 0;
108 thunk->pushl_eax = 0x50; /* pushl %eax */
109 thunk->jmp = 0xe9; /* jmp GDI_Callback3216 */
110 thunk->callback = (char *)GDI_Callback3216 - (char *)(&thunk->callback + 1);
113 for (thunk = GDI_Thunks; thunk < &GDI_Thunks[GDI_MAX_THUNKS]; thunk++)
115 if (thunk->pfn16 == 0)
117 thunk->pfn16 = (DWORD)pfn16;
118 thunk->hdc = dc16;
119 return thunk;
122 FIXME("Out of mmdrv-thunks. Bump GDI_MAX_THUNKS\n");
123 return NULL;
126 /******************************************************************
127 * GDI_DeleteThunk
129 static void GDI_DeleteThunk(struct gdi_thunk* thunk)
131 thunk->pfn16 = 0;
134 /******************************************************************
135 * GDI_FindThunk
137 static struct gdi_thunk* GDI_FindThunk(HDC16 hdc)
139 struct gdi_thunk* thunk;
141 if (!GDI_Thunks) return NULL;
142 for (thunk = GDI_Thunks; thunk < &GDI_Thunks[GDI_MAX_THUNKS]; thunk++)
144 if (thunk->hdc == hdc) return thunk;
146 return NULL;
149 /**********************************************************************
150 * QueryAbort (GDI.155)
152 * Calls the app's AbortProc function if avail.
154 * RETURNS
155 * TRUE if no AbortProc avail or AbortProc wants to continue printing.
156 * FALSE if AbortProc wants to abort printing.
158 BOOL16 WINAPI QueryAbort16(HDC16 hdc16, INT16 reserved)
160 struct gdi_thunk* thunk = GDI_FindThunk(hdc16);
162 if (!thunk) {
163 ERR("Invalid hdc 0x%x\n", hdc16);
164 return FALSE;
166 return GDI_Callback3216( thunk->pfn16, HDC_32(hdc16), 0 );
170 /**********************************************************************
171 * SetAbortProc (GDI.381)
173 INT16 WINAPI SetAbortProc16(HDC16 hdc16, ABORTPROC16 abrtprc)
175 struct gdi_thunk* thunk;
177 thunk = GDI_AddThunk(hdc16, abrtprc);
178 if (!thunk) return FALSE;
179 if (!SetAbortProc(HDC_32( hdc16 ), (ABORTPROC)thunk))
181 GDI_DeleteThunk(thunk);
182 return FALSE;
184 return TRUE;
188 * ############################################################################
191 struct callback16_info
193 FARPROC16 proc;
194 LPARAM param;
197 /* callback for LineDDA16 */
198 static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
200 const struct callback16_info *info = (struct callback16_info *)param;
201 WORD args[4];
203 args[3] = x;
204 args[2] = y;
205 args[1] = HIWORD(info->param);
206 args[0] = LOWORD(info->param);
207 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, NULL );
210 /* callback for EnumObjects16 */
211 static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
213 const struct callback16_info *info = (struct callback16_info *)param;
214 LOGPEN *pen = ptr;
215 LOGPEN16 pen16;
216 SEGPTR segptr;
217 DWORD ret;
218 WORD args[4];
220 pen16.lopnStyle = pen->lopnStyle;
221 pen16.lopnWidth.x = pen->lopnWidth.x;
222 pen16.lopnWidth.y = pen->lopnWidth.y;
223 pen16.lopnColor = pen->lopnColor;
224 segptr = MapLS( &pen16 );
225 args[3] = SELECTOROF(segptr);
226 args[2] = OFFSETOF(segptr);
227 args[1] = HIWORD(info->param);
228 args[0] = LOWORD(info->param);
229 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
230 UnMapLS( segptr );
231 return LOWORD(ret);
234 /* callback for EnumObjects16 */
235 static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
237 const struct callback16_info *info = (struct callback16_info *)param;
238 LOGBRUSH *brush = ptr;
239 LOGBRUSH16 brush16;
240 SEGPTR segptr;
241 DWORD ret;
242 WORD args[4];
244 brush16.lbStyle = brush->lbStyle;
245 brush16.lbColor = brush->lbColor;
246 brush16.lbHatch = brush->lbHatch;
247 segptr = MapLS( &brush16 );
248 args[3] = SELECTOROF(segptr);
249 args[2] = OFFSETOF(segptr);
250 args[1] = HIWORD(info->param);
251 args[0] = LOWORD(info->param);
252 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
253 UnMapLS( segptr );
254 return ret;
257 /* convert a LOGFONT16 to a LOGFONTW */
258 static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
260 font32->lfHeight = font16->lfHeight;
261 font32->lfWidth = font16->lfWidth;
262 font32->lfEscapement = font16->lfEscapement;
263 font32->lfOrientation = font16->lfOrientation;
264 font32->lfWeight = font16->lfWeight;
265 font32->lfItalic = font16->lfItalic;
266 font32->lfUnderline = font16->lfUnderline;
267 font32->lfStrikeOut = font16->lfStrikeOut;
268 font32->lfCharSet = font16->lfCharSet;
269 font32->lfOutPrecision = font16->lfOutPrecision;
270 font32->lfClipPrecision = font16->lfClipPrecision;
271 font32->lfQuality = font16->lfQuality;
272 font32->lfPitchAndFamily = font16->lfPitchAndFamily;
273 MultiByteToWideChar( CP_ACP, 0, font16->lfFaceName, -1, font32->lfFaceName, LF_FACESIZE );
274 font32->lfFaceName[LF_FACESIZE-1] = 0;
277 /* convert a LOGFONTW to a LOGFONT16 */
278 static void logfont_W_to_16( const LOGFONTW* font32, LPLOGFONT16 font16 )
280 font16->lfHeight = font32->lfHeight;
281 font16->lfWidth = font32->lfWidth;
282 font16->lfEscapement = font32->lfEscapement;
283 font16->lfOrientation = font32->lfOrientation;
284 font16->lfWeight = font32->lfWeight;
285 font16->lfItalic = font32->lfItalic;
286 font16->lfUnderline = font32->lfUnderline;
287 font16->lfStrikeOut = font32->lfStrikeOut;
288 font16->lfCharSet = font32->lfCharSet;
289 font16->lfOutPrecision = font32->lfOutPrecision;
290 font16->lfClipPrecision = font32->lfClipPrecision;
291 font16->lfQuality = font32->lfQuality;
292 font16->lfPitchAndFamily = font32->lfPitchAndFamily;
293 WideCharToMultiByte( CP_ACP, 0, font32->lfFaceName, -1, font16->lfFaceName, LF_FACESIZE, NULL, NULL );
294 font16->lfFaceName[LF_FACESIZE-1] = 0;
297 /* convert a ENUMLOGFONTEXW to a ENUMLOGFONTEX16 */
298 static void enumlogfontex_W_to_16( const ENUMLOGFONTEXW *fontW,
299 LPENUMLOGFONTEX16 font16 )
301 logfont_W_to_16( (const LOGFONTW *)fontW, (LPLOGFONT16)font16);
303 WideCharToMultiByte( CP_ACP, 0, fontW->elfFullName, -1,
304 (LPSTR) font16->elfFullName, LF_FULLFACESIZE, NULL, NULL );
305 font16->elfFullName[LF_FULLFACESIZE-1] = '\0';
306 WideCharToMultiByte( CP_ACP, 0, fontW->elfStyle, -1,
307 (LPSTR) font16->elfStyle, LF_FACESIZE, NULL, NULL );
308 font16->elfStyle[LF_FACESIZE-1] = '\0';
309 WideCharToMultiByte( CP_ACP, 0, fontW->elfScript, -1,
310 (LPSTR) font16->elfScript, LF_FACESIZE, NULL, NULL );
311 font16->elfScript[LF_FACESIZE-1] = '\0';
314 /* convert a NEWTEXTMETRICEXW to a NEWTEXTMETRICEX16 */
315 static void newtextmetricex_W_to_16( const NEWTEXTMETRICEXW *ptmW,
316 LPNEWTEXTMETRICEX16 ptm16 )
318 ptm16->ntmTm.tmHeight = ptmW->ntmTm.tmHeight;
319 ptm16->ntmTm.tmAscent = ptmW->ntmTm.tmAscent;
320 ptm16->ntmTm.tmDescent = ptmW->ntmTm.tmDescent;
321 ptm16->ntmTm.tmInternalLeading = ptmW->ntmTm.tmInternalLeading;
322 ptm16->ntmTm.tmExternalLeading = ptmW->ntmTm.tmExternalLeading;
323 ptm16->ntmTm.tmAveCharWidth = ptmW->ntmTm.tmAveCharWidth;
324 ptm16->ntmTm.tmMaxCharWidth = ptmW->ntmTm.tmMaxCharWidth;
325 ptm16->ntmTm.tmWeight = ptmW->ntmTm.tmWeight;
326 ptm16->ntmTm.tmOverhang = ptmW->ntmTm.tmOverhang;
327 ptm16->ntmTm.tmDigitizedAspectX = ptmW->ntmTm.tmDigitizedAspectX;
328 ptm16->ntmTm.tmDigitizedAspectY = ptmW->ntmTm.tmDigitizedAspectY;
329 ptm16->ntmTm.tmFirstChar = ptmW->ntmTm.tmFirstChar > 255 ? 255 : ptmW->ntmTm.tmFirstChar;
330 ptm16->ntmTm.tmLastChar = ptmW->ntmTm.tmLastChar > 255 ? 255 : ptmW->ntmTm.tmLastChar;
331 ptm16->ntmTm.tmDefaultChar = ptmW->ntmTm.tmDefaultChar > 255 ? 255 : ptmW->ntmTm.tmDefaultChar;
332 ptm16->ntmTm.tmBreakChar = ptmW->ntmTm.tmBreakChar > 255 ? 255 : ptmW->ntmTm.tmBreakChar;
333 ptm16->ntmTm.tmItalic = ptmW->ntmTm.tmItalic;
334 ptm16->ntmTm.tmUnderlined = ptmW->ntmTm.tmUnderlined;
335 ptm16->ntmTm.tmStruckOut = ptmW->ntmTm.tmStruckOut;
336 ptm16->ntmTm.tmPitchAndFamily = ptmW->ntmTm.tmPitchAndFamily;
337 ptm16->ntmTm.tmCharSet = ptmW->ntmTm.tmCharSet;
338 ptm16->ntmTm.ntmFlags = ptmW->ntmTm.ntmFlags;
339 ptm16->ntmTm.ntmSizeEM = ptmW->ntmTm.ntmSizeEM;
340 ptm16->ntmTm.ntmCellHeight = ptmW->ntmTm.ntmCellHeight;
341 ptm16->ntmTm.ntmAvgWidth = ptmW->ntmTm.ntmAvgWidth;
342 ptm16->ntmFontSig = ptmW->ntmFontSig;
346 * callback for EnumFontFamiliesEx16
347 * Note: plf is really an ENUMLOGFONTEXW, and ptm is a NEWTEXTMETRICEXW.
348 * We have to use other types because of the FONTENUMPROCW definition.
350 static INT CALLBACK enum_font_callback( const LOGFONTW *plf,
351 const TEXTMETRICW *ptm, DWORD fType,
352 LPARAM param )
354 const struct callback16_info *info = (struct callback16_info *)param;
355 ENUMLOGFONTEX16 elfe16;
356 NEWTEXTMETRICEX16 ntm16;
357 SEGPTR segelfe16;
358 SEGPTR segntm16;
359 WORD args[7];
360 DWORD ret;
362 enumlogfontex_W_to_16((const ENUMLOGFONTEXW *)plf, &elfe16);
363 newtextmetricex_W_to_16((const NEWTEXTMETRICEXW *)ptm, &ntm16);
364 segelfe16 = MapLS( &elfe16 );
365 segntm16 = MapLS( &ntm16 );
366 args[6] = SELECTOROF(segelfe16);
367 args[5] = OFFSETOF(segelfe16);
368 args[4] = SELECTOROF(segntm16);
369 args[3] = OFFSETOF(segntm16);
370 args[2] = fType;
371 args[1] = HIWORD(info->param);
372 args[0] = LOWORD(info->param);
374 WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret );
375 UnMapLS( segelfe16 );
376 UnMapLS( segntm16 );
377 return LOWORD(ret);
380 struct dib_segptr_bits
382 struct list entry;
383 HBITMAP16 bmp;
384 WORD sel;
385 WORD count;
388 static struct list dib_segptr_list = LIST_INIT( dib_segptr_list );
390 static SEGPTR alloc_segptr_bits( HBITMAP bmp, void *bits32 )
392 DIBSECTION dib;
393 unsigned int i, size;
394 struct dib_segptr_bits *bits;
396 if (!(bits = HeapAlloc( GetProcessHeap(), 0, sizeof(*bits) ))) return 0;
398 GetObjectW( bmp, sizeof(dib), &dib );
399 size = dib.dsBm.bmHeight * dib.dsBm.bmWidthBytes;
401 /* calculate number of sel's needed for size with 64K steps */
402 bits->bmp = HBITMAP_16( bmp );
403 bits->count = (size + 0xffff) / 0x10000;
404 bits->sel = AllocSelectorArray16( bits->count );
406 for (i = 0; i < bits->count; i++)
408 SetSelectorBase(bits->sel + (i << __AHSHIFT), (DWORD)bits32 + i * 0x10000);
409 SetSelectorLimit16(bits->sel + (i << __AHSHIFT), size - 1); /* yep, limit is correct */
410 size -= 0x10000;
412 list_add_head( &dib_segptr_list, &bits->entry );
413 return MAKESEGPTR( bits->sel, 0 );
416 static void free_segptr_bits( HBITMAP16 bmp )
418 unsigned int i;
419 struct dib_segptr_bits *bits;
421 LIST_FOR_EACH_ENTRY( bits, &dib_segptr_list, struct dib_segptr_bits, entry )
423 if (bits->bmp != bmp) continue;
424 for (i = 0; i < bits->count; i++) FreeSelector16( bits->sel + (i << __AHSHIFT) );
426 list_remove( &bits->entry );
427 HeapFree( GetProcessHeap(), 0, bits );
428 return;
433 /***********************************************************************
434 * SetBkColor (GDI.1)
436 COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color )
438 return SetBkColor( HDC_32(hdc), color );
442 /***********************************************************************
443 * SetBkMode (GDI.2)
445 INT16 WINAPI SetBkMode16( HDC16 hdc, INT16 mode )
447 return SetBkMode( HDC_32(hdc), mode );
451 /***********************************************************************
452 * SetMapMode (GDI.3)
454 INT16 WINAPI SetMapMode16( HDC16 hdc, INT16 mode )
456 return SetMapMode( HDC_32(hdc), mode );
460 /***********************************************************************
461 * SetROP2 (GDI.4)
463 INT16 WINAPI SetROP216( HDC16 hdc, INT16 mode )
465 return SetROP2( HDC_32(hdc), mode );
469 /***********************************************************************
470 * SetRelAbs (GDI.5)
472 INT16 WINAPI SetRelAbs16( HDC16 hdc, INT16 mode )
474 return SetRelAbs( HDC_32(hdc), mode );
478 /***********************************************************************
479 * SetPolyFillMode (GDI.6)
481 INT16 WINAPI SetPolyFillMode16( HDC16 hdc, INT16 mode )
483 return SetPolyFillMode( HDC_32(hdc), mode );
487 /***********************************************************************
488 * SetStretchBltMode (GDI.7)
490 INT16 WINAPI SetStretchBltMode16( HDC16 hdc, INT16 mode )
492 return SetStretchBltMode( HDC_32(hdc), mode );
496 /***********************************************************************
497 * SetTextCharacterExtra (GDI.8)
499 INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
501 return SetTextCharacterExtra( HDC_32(hdc), extra );
505 /***********************************************************************
506 * SetTextColor (GDI.9)
508 COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color )
510 return SetTextColor( HDC_32(hdc), color );
514 /***********************************************************************
515 * SetTextJustification (GDI.10)
517 INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
519 return SetTextJustification( HDC_32(hdc), extra, breaks );
523 /***********************************************************************
524 * SetWindowOrg (GDI.11)
526 DWORD WINAPI SetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
528 POINT pt;
529 if (!SetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
530 return MAKELONG( pt.x, pt.y );
534 /***********************************************************************
535 * SetWindowExt (GDI.12)
537 DWORD WINAPI SetWindowExt16( HDC16 hdc, INT16 x, INT16 y )
539 SIZE size;
540 if (!SetWindowExtEx( HDC_32(hdc), x, y, &size )) return 0;
541 return MAKELONG( size.cx, size.cy );
545 /***********************************************************************
546 * SetViewportOrg (GDI.13)
548 DWORD WINAPI SetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
550 POINT pt;
551 if (!SetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
552 return MAKELONG( pt.x, pt.y );
556 /***********************************************************************
557 * SetViewportExt (GDI.14)
559 DWORD WINAPI SetViewportExt16( HDC16 hdc, INT16 x, INT16 y )
561 SIZE size;
562 if (!SetViewportExtEx( HDC_32(hdc), x, y, &size )) return 0;
563 return MAKELONG( size.cx, size.cy );
567 /***********************************************************************
568 * OffsetWindowOrg (GDI.15)
570 DWORD WINAPI OffsetWindowOrg16( HDC16 hdc, INT16 x, INT16 y )
572 POINT pt;
573 if (!OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
574 return MAKELONG( pt.x, pt.y );
578 /***********************************************************************
579 * ScaleWindowExt (GDI.16)
581 DWORD WINAPI ScaleWindowExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
582 INT16 yNum, INT16 yDenom )
584 SIZE size;
585 if (!ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
586 return FALSE;
587 return MAKELONG( size.cx, size.cy );
591 /***********************************************************************
592 * OffsetViewportOrg (GDI.17)
594 DWORD WINAPI OffsetViewportOrg16( HDC16 hdc, INT16 x, INT16 y )
596 POINT pt;
597 if (!OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
598 return MAKELONG( pt.x, pt.y );
602 /***********************************************************************
603 * ScaleViewportExt (GDI.18)
605 DWORD WINAPI ScaleViewportExt16( HDC16 hdc, INT16 xNum, INT16 xDenom,
606 INT16 yNum, INT16 yDenom )
608 SIZE size;
609 if (!ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom, &size ))
610 return FALSE;
611 return MAKELONG( size.cx, size.cy );
615 /***********************************************************************
616 * LineTo (GDI.19)
618 BOOL16 WINAPI LineTo16( HDC16 hdc, INT16 x, INT16 y )
620 return LineTo( HDC_32(hdc), x, y );
624 /***********************************************************************
625 * MoveTo (GDI.20)
627 DWORD WINAPI MoveTo16( HDC16 hdc, INT16 x, INT16 y )
629 POINT pt;
631 if (!MoveToEx( HDC_32(hdc), x, y, &pt )) return 0;
632 return MAKELONG(pt.x,pt.y);
636 /***********************************************************************
637 * ExcludeClipRect (GDI.21)
639 INT16 WINAPI ExcludeClipRect16( HDC16 hdc, INT16 left, INT16 top,
640 INT16 right, INT16 bottom )
642 return ExcludeClipRect( HDC_32(hdc), left, top, right, bottom );
646 /***********************************************************************
647 * IntersectClipRect (GDI.22)
649 INT16 WINAPI IntersectClipRect16( HDC16 hdc, INT16 left, INT16 top,
650 INT16 right, INT16 bottom )
652 return IntersectClipRect( HDC_32(hdc), left, top, right, bottom );
656 /***********************************************************************
657 * Arc (GDI.23)
659 BOOL16 WINAPI Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
660 INT16 bottom, INT16 xstart, INT16 ystart,
661 INT16 xend, INT16 yend )
663 return Arc( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
667 /***********************************************************************
668 * Ellipse (GDI.24)
670 BOOL16 WINAPI Ellipse16( HDC16 hdc, INT16 left, INT16 top,
671 INT16 right, INT16 bottom )
673 return Ellipse( HDC_32(hdc), left, top, right, bottom );
677 /**********************************************************************
678 * FloodFill (GDI.25)
680 BOOL16 WINAPI FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
682 return ExtFloodFill( HDC_32(hdc), x, y, color, FLOODFILLBORDER );
686 /***********************************************************************
687 * Pie (GDI.26)
689 BOOL16 WINAPI Pie16( HDC16 hdc, INT16 left, INT16 top,
690 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
691 INT16 xend, INT16 yend )
693 return Pie( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
697 /***********************************************************************
698 * Rectangle (GDI.27)
700 BOOL16 WINAPI Rectangle16( HDC16 hdc, INT16 left, INT16 top,
701 INT16 right, INT16 bottom )
703 return Rectangle( HDC_32(hdc), left, top, right, bottom );
707 /***********************************************************************
708 * RoundRect (GDI.28)
710 BOOL16 WINAPI RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
711 INT16 bottom, INT16 ell_width, INT16 ell_height )
713 return RoundRect( HDC_32(hdc), left, top, right, bottom, ell_width, ell_height );
717 /***********************************************************************
718 * PatBlt (GDI.29)
720 BOOL16 WINAPI PatBlt16( HDC16 hdc, INT16 left, INT16 top,
721 INT16 width, INT16 height, DWORD rop)
723 return PatBlt( HDC_32(hdc), left, top, width, height, rop );
727 /***********************************************************************
728 * SaveDC (GDI.30)
730 INT16 WINAPI SaveDC16( HDC16 hdc )
732 return SaveDC( HDC_32(hdc) );
736 /***********************************************************************
737 * SetPixel (GDI.31)
739 COLORREF WINAPI SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
741 return SetPixel( HDC_32(hdc), x, y, color );
745 /***********************************************************************
746 * OffsetClipRgn (GDI.32)
748 INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
750 return OffsetClipRgn( HDC_32(hdc), x, y );
754 /***********************************************************************
755 * TextOut (GDI.33)
757 BOOL16 WINAPI TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
759 return TextOutA( HDC_32(hdc), x, y, str, count );
763 /***********************************************************************
764 * BitBlt (GDI.34)
766 BOOL16 WINAPI BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width,
767 INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
768 DWORD rop )
770 return BitBlt( HDC_32(hdcDst), xDst, yDst, width, height, HDC_32(hdcSrc), xSrc, ySrc, rop );
774 /***********************************************************************
775 * StretchBlt (GDI.35)
777 BOOL16 WINAPI StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst,
778 INT16 widthDst, INT16 heightDst,
779 HDC16 hdcSrc, INT16 xSrc, INT16 ySrc,
780 INT16 widthSrc, INT16 heightSrc, DWORD rop )
782 return StretchBlt( HDC_32(hdcDst), xDst, yDst, widthDst, heightDst,
783 HDC_32(hdcSrc), xSrc, ySrc, widthSrc, heightSrc, rop );
787 /**********************************************************************
788 * Polygon (GDI.36)
790 BOOL16 WINAPI Polygon16( HDC16 hdc, const POINT16* pt, INT16 count )
792 int i;
793 BOOL ret;
794 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) );
796 if (!pt32) return FALSE;
797 for (i=count;i--;)
799 pt32[i].x = pt[i].x;
800 pt32[i].y = pt[i].y;
802 ret = Polygon(HDC_32(hdc),pt32,count);
803 HeapFree( GetProcessHeap(), 0, pt32 );
804 return ret;
808 /**********************************************************************
809 * Polyline (GDI.37)
811 BOOL16 WINAPI Polyline16( HDC16 hdc, const POINT16* pt, INT16 count )
813 int i;
814 BOOL16 ret;
815 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) );
817 if (!pt32) return FALSE;
818 for (i=count;i--;)
820 pt32[i].x = pt[i].x;
821 pt32[i].y = pt[i].y;
823 ret = Polyline(HDC_32(hdc),pt32,count);
824 HeapFree( GetProcessHeap(), 0, pt32 );
825 return ret;
829 /***********************************************************************
830 * Escape (GDI.38)
832 INT16 WINAPI Escape16( HDC16 hdc, INT16 escape, INT16 in_count, SEGPTR in_data, LPVOID out_data )
834 INT ret;
836 switch(escape)
838 /* Escape(hdc,CLIP_TO_PATH,LPINT16,NULL) */
839 /* Escape(hdc,DRAFTMODE,LPINT16,NULL) */
840 /* Escape(hdc,ENUMPAPERBINS,LPINT16,LPSTR); */
841 /* Escape(hdc,EPSPRINTING,LPINT16,NULL) */
842 /* Escape(hdc,EXT_DEVICE_CAPS,LPINT16,LPDWORD) */
843 /* Escape(hdc,GETCOLORTABLE,LPINT16,LPDWORD) */
844 /* Escape(hdc,MOUSETRAILS,LPINT16,NULL) */
845 /* Escape(hdc,POSTSCRIPT_IGNORE,LPINT16,NULL) */
846 /* Escape(hdc,QUERYESCSUPPORT,LPINT16,NULL) */
847 /* Escape(hdc,SET_ARC_DIRECTION,LPINT16,NULL) */
848 /* Escape(hdc,SET_POLY_MODE,LPINT16,NULL) */
849 /* Escape(hdc,SET_SCREEN_ANGLE,LPINT16,NULL) */
850 /* Escape(hdc,SET_SPREAD,LPINT16,NULL) */
851 case CLIP_TO_PATH:
852 case DRAFTMODE:
853 case ENUMPAPERBINS:
854 case EPSPRINTING:
855 case EXT_DEVICE_CAPS:
856 case GETCOLORTABLE:
857 case MOUSETRAILS:
858 case POSTSCRIPT_IGNORE:
859 case QUERYESCSUPPORT:
860 case SET_ARC_DIRECTION:
861 case SET_POLY_MODE:
862 case SET_SCREEN_ANGLE:
863 case SET_SPREAD:
865 INT16 *ptr = MapSL(in_data);
866 INT data = *ptr;
867 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, out_data );
870 /* Escape(hdc,ENABLEDUPLEX,LPUINT16,NULL) */
871 case ENABLEDUPLEX:
873 UINT16 *ptr = MapSL(in_data);
874 UINT data = *ptr;
875 return Escape( HDC_32(hdc), escape, sizeof(data), (LPCSTR)&data, NULL );
878 /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT16) */
879 /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT16) */
880 /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT16) */
881 case GETPHYSPAGESIZE:
882 case GETPRINTINGOFFSET:
883 case GETSCALINGFACTOR:
885 POINT16 *ptr = out_data;
886 POINT pt32;
887 ret = Escape( HDC_32(hdc), escape, 0, NULL, &pt32 );
888 ptr->x = pt32.x;
889 ptr->y = pt32.y;
890 return ret;
893 /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */
894 /* Escape(hdc,ENABLERELATIVEWIDTHS,LPINT16,LPINT16); */
895 /* Escape(hdc,SETCOPYCOUNT,LPINT16,LPINT16) */
896 /* Escape(hdc,SETKERNTRACK,LPINT16,LPINT16) */
897 /* Escape(hdc,SETLINECAP,LPINT16,LPINT16) */
898 /* Escape(hdc,SETLINEJOIN,LPINT16,LPINT16) */
899 /* Escape(hdc,SETMITERLIMIT,LPINT16,LPINT16) */
900 case ENABLEPAIRKERNING:
901 case ENABLERELATIVEWIDTHS:
902 case SETCOPYCOUNT:
903 case SETKERNTRACK:
904 case SETLINECAP:
905 case SETLINEJOIN:
906 case SETMITERLIMIT:
908 INT16 *new = MapSL(in_data);
909 INT16 *old = out_data;
910 INT out, in = *new;
911 ret = Escape( HDC_32(hdc), escape, sizeof(in), (LPCSTR)&in, &out );
912 *old = out;
913 return ret;
916 /* Escape(hdc,SETABORTPROC,ABORTPROC,NULL); */
917 case SETABORTPROC:
918 return SetAbortProc16( hdc, (ABORTPROC16)in_data );
920 /* Escape(hdc,STARTDOC,LPSTR,LPDOCINFO16);
921 * lpvOutData is actually a pointer to the DocInfo structure and used as
922 * a second input parameter */
923 case STARTDOC:
924 if (out_data)
926 ret = StartDoc16( hdc, out_data );
927 if (ret > 0) ret = StartPage( HDC_32(hdc) );
928 return ret;
930 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), NULL );
932 /* Escape(hdc,SET_BOUNDS,LPRECT16,NULL); */
933 /* Escape(hdc,SET_CLIP_BOX,LPRECT16,NULL); */
934 case SET_BOUNDS:
935 case SET_CLIP_BOX:
937 RECT16 *rc16 = MapSL(in_data);
938 RECT rc;
939 rc.left = rc16->left;
940 rc.top = rc16->top;
941 rc.right = rc16->right;
942 rc.bottom = rc16->bottom;
943 return Escape( HDC_32(hdc), escape, sizeof(rc), (LPCSTR)&rc, NULL );
946 /* Escape(hdc,NEXTBAND,NULL,LPRECT16); */
947 case NEXTBAND:
949 RECT rc;
950 RECT16 *rc16 = out_data;
951 ret = Escape( HDC_32(hdc), escape, 0, NULL, &rc );
952 rc16->left = rc.left;
953 rc16->top = rc.top;
954 rc16->right = rc.right;
955 rc16->bottom = rc.bottom;
956 return ret;
958 /* Escape(hdc,DRAWPATTERNRECT,PRECT_STRUCT*,NULL); */
959 case DRAWPATTERNRECT:
961 DRAWPATRECT pr;
962 DRAWPATRECT16 *pr16 = MapSL(in_data);
964 pr.ptPosition.x = pr16->ptPosition.x;
965 pr.ptPosition.y = pr16->ptPosition.y;
966 pr.ptSize.x = pr16->ptSize.x;
967 pr.ptSize.y = pr16->ptSize.y;
968 pr.wStyle = pr16->wStyle;
969 pr.wPattern = pr16->wPattern;
970 return Escape( HDC_32(hdc), escape, sizeof(pr), (LPCSTR)&pr, NULL );
973 /* Escape(hdc,ABORTDOC,NULL,NULL); */
974 /* Escape(hdc,BANDINFO,BANDINFOSTRUCT*,BANDINFOSTRUCT*); */
975 /* Escape(hdc,BEGIN_PATH,NULL,NULL); */
976 /* Escape(hdc,ENDDOC,NULL,NULL); */
977 /* Escape(hdc,END_PATH,PATHINFO,NULL); */
978 /* Escape(hdc,EXTTEXTOUT,EXTTEXT_STRUCT*,NULL); */
979 /* Escape(hdc,FLUSHOUTPUT,NULL,NULL); */
980 /* Escape(hdc,GETFACENAME,NULL,LPSTR); */
981 /* Escape(hdc,GETPAIRKERNTABLE,NULL,KERNPAIR*); */
982 /* Escape(hdc,GETSETPAPERBINS,BinInfo*,BinInfo*); */
983 /* Escape(hdc,GETSETPRINTORIENT,ORIENT*,NULL); */
984 /* Escape(hdc,GETSETSCREENPARAMS,SCREENPARAMS*,SCREENPARAMS*); */
985 /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */
986 /* Escape(hdc,GETTRACKKERNTABLE,NULL,KERNTRACK*); */
987 /* Escape(hdc,MFCOMMENT,LPSTR,NULL); */
988 /* Escape(hdc,NEWFRAME,NULL,NULL); */
989 /* Escape(hdc,PASSTHROUGH,LPSTR,NULL); */
990 /* Escape(hdc,RESTORE_CTM,NULL,NULL); */
991 /* Escape(hdc,SAVE_CTM,NULL,NULL); */
992 /* Escape(hdc,SETALLJUSTVALUES,EXTTEXTDATA*,NULL); */
993 /* Escape(hdc,SETCOLORTABLE,COLORTABLE_STRUCT*,LPDWORD); */
994 /* Escape(hdc,SET_BACKGROUND_COLOR,LPDWORD,LPDWORD); */
995 /* Escape(hdc,TRANSFORM_CTM,LPSTR,NULL); */
996 case ABORTDOC:
997 case BANDINFO:
998 case BEGIN_PATH:
999 case ENDDOC:
1000 case END_PATH:
1001 case EXTTEXTOUT:
1002 case FLUSHOUTPUT:
1003 case GETFACENAME:
1004 case GETPAIRKERNTABLE:
1005 case GETSETPAPERBINS:
1006 case GETSETPRINTORIENT:
1007 case GETSETSCREENPARAMS:
1008 case GETTECHNOLOGY:
1009 case GETTRACKKERNTABLE:
1010 case MFCOMMENT:
1011 case NEWFRAME:
1012 case PASSTHROUGH:
1013 case RESTORE_CTM:
1014 case SAVE_CTM:
1015 case SETALLJUSTVALUES:
1016 case SETCOLORTABLE:
1017 case SET_BACKGROUND_COLOR:
1018 case TRANSFORM_CTM:
1019 /* pass it unmodified to the 32-bit function */
1020 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
1022 /* Escape(hdc,ENUMPAPERMETRICS,LPINT16,LPRECT16); */
1023 /* Escape(hdc,GETEXTENDEDTEXTMETRICS,LPUINT16,EXTTEXTMETRIC*); */
1024 /* Escape(hdc,GETEXTENTTABLE,LPSTR,LPINT16); */
1025 /* Escape(hdc,GETSETPAPERMETRICS,LPRECT16,LPRECT16); */
1026 /* Escape(hdc,GETVECTORBRUSHSIZE,LPLOGBRUSH16,LPPOINT16); */
1027 /* Escape(hdc,GETVECTORPENSIZE,LPLOGPEN16,LPPOINT16); */
1028 case ENUMPAPERMETRICS:
1029 case GETEXTENDEDTEXTMETRICS:
1030 case GETEXTENTTABLE:
1031 case GETSETPAPERMETRICS:
1032 case GETVECTORBRUSHSIZE:
1033 case GETVECTORPENSIZE:
1034 default:
1035 FIXME("unknown/unsupported 16-bit escape %x (%d,%p,%p\n",
1036 escape, in_count, MapSL(in_data), out_data );
1037 return Escape( HDC_32(hdc), escape, in_count, MapSL(in_data), out_data );
1042 /***********************************************************************
1043 * RestoreDC (GDI.39)
1045 BOOL16 WINAPI RestoreDC16( HDC16 hdc, INT16 level )
1047 return RestoreDC( HDC_32(hdc), level );
1051 /***********************************************************************
1052 * FillRgn (GDI.40)
1054 BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
1056 return FillRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush) );
1060 /***********************************************************************
1061 * FrameRgn (GDI.41)
1063 BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
1064 INT16 nWidth, INT16 nHeight )
1066 return FrameRgn( HDC_32(hdc), HRGN_32(hrgn), HBRUSH_32(hbrush), nWidth, nHeight );
1070 /***********************************************************************
1071 * InvertRgn (GDI.42)
1073 BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
1075 return InvertRgn( HDC_32(hdc), HRGN_32(hrgn) );
1079 /***********************************************************************
1080 * PaintRgn (GDI.43)
1082 BOOL16 WINAPI PaintRgn16( HDC16 hdc, HRGN16 hrgn )
1084 return PaintRgn( HDC_32(hdc), HRGN_32(hrgn) );
1088 /***********************************************************************
1089 * SelectClipRgn (GDI.44)
1091 INT16 WINAPI SelectClipRgn16( HDC16 hdc, HRGN16 hrgn )
1093 return SelectClipRgn( HDC_32(hdc), HRGN_32(hrgn) );
1097 /***********************************************************************
1098 * SelectObject (GDI.45)
1100 HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
1102 return HGDIOBJ_16( SelectObject( HDC_32(hdc), HGDIOBJ_32(handle) ) );
1106 /***********************************************************************
1107 * CombineRgn (GDI.47)
1109 INT16 WINAPI CombineRgn16(HRGN16 hDest, HRGN16 hSrc1, HRGN16 hSrc2, INT16 mode)
1111 return CombineRgn( HRGN_32(hDest), HRGN_32(hSrc1), HRGN_32(hSrc2), mode );
1115 /***********************************************************************
1116 * CreateBitmap (GDI.48)
1118 HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes,
1119 UINT16 bpp, LPCVOID bits )
1121 return HBITMAP_16( CreateBitmap( width, height, planes & 0xff, bpp & 0xff, bits ) );
1125 /***********************************************************************
1126 * CreateBitmapIndirect (GDI.49)
1128 HBITMAP16 WINAPI CreateBitmapIndirect16( const BITMAP16 * bmp )
1130 return CreateBitmap16( bmp->bmWidth, bmp->bmHeight, bmp->bmPlanes,
1131 bmp->bmBitsPixel, MapSL( bmp->bmBits ) );
1135 /***********************************************************************
1136 * CreateBrushIndirect (GDI.50)
1138 HBRUSH16 WINAPI CreateBrushIndirect16( const LOGBRUSH16 * brush )
1140 LOGBRUSH brush32;
1142 if (brush->lbStyle == BS_DIBPATTERN || brush->lbStyle == BS_DIBPATTERN8X8)
1143 return CreateDIBPatternBrush16( brush->lbHatch, brush->lbColor );
1145 brush32.lbStyle = brush->lbStyle;
1146 brush32.lbColor = brush->lbColor;
1147 brush32.lbHatch = brush->lbHatch;
1148 return HBRUSH_16( CreateBrushIndirect(&brush32) );
1152 /***********************************************************************
1153 * CreateCompatibleBitmap (GDI.51)
1155 HBITMAP16 WINAPI CreateCompatibleBitmap16( HDC16 hdc, INT16 width, INT16 height )
1157 return HBITMAP_16( CreateCompatibleBitmap( HDC_32(hdc), width, height ) );
1161 /***********************************************************************
1162 * CreateCompatibleDC (GDI.52)
1164 HDC16 WINAPI CreateCompatibleDC16( HDC16 hdc )
1166 return HDC_16( CreateCompatibleDC( HDC_32(hdc) ) );
1170 /***********************************************************************
1171 * CreateDC (GDI.53)
1173 HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1174 const DEVMODEA *initData )
1176 if (!lstrcmpiA( driver, "dib" ) || !lstrcmpiA( driver, "dirdib" ))
1178 DRIVER_INFO_2W driver_info = { .cVersion = NTGDI_WIN16_DIB };
1179 return HDC_16( NtGdiOpenDCW( NULL, NULL, NULL, 0, TRUE, 0, &driver_info, (void *)initData ));
1181 return HDC_16( CreateDCA( driver, device, output, initData ) );
1185 /***********************************************************************
1186 * CreateEllipticRgn (GDI.54)
1188 HRGN16 WINAPI CreateEllipticRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
1190 return HRGN_16( CreateEllipticRgn( left, top, right, bottom ) );
1194 /***********************************************************************
1195 * CreateEllipticRgnIndirect (GDI.55)
1197 HRGN16 WINAPI CreateEllipticRgnIndirect16( const RECT16 *rect )
1199 return HRGN_16( CreateEllipticRgn( rect->left, rect->top, rect->right, rect->bottom ) );
1203 /***********************************************************************
1204 * CreateFont (GDI.56)
1206 HFONT16 WINAPI CreateFont16(INT16 height, INT16 width, INT16 esc, INT16 orient,
1207 INT16 weight, BYTE italic, BYTE underline,
1208 BYTE strikeout, BYTE charset, BYTE outpres,
1209 BYTE clippres, BYTE quality, BYTE pitch,
1210 LPCSTR name )
1212 return HFONT_16( CreateFontA( height, width, esc, orient, weight, italic, underline,
1213 strikeout, charset, outpres, clippres, quality, pitch, name ));
1216 /***********************************************************************
1217 * CreateFontIndirect (GDI.57)
1219 HFONT16 WINAPI CreateFontIndirect16( const LOGFONT16 *plf16 )
1221 HFONT ret;
1223 if (plf16)
1225 LOGFONTW lfW;
1226 logfont_16_to_W( plf16, &lfW );
1227 ret = CreateFontIndirectW( &lfW );
1229 else ret = CreateFontIndirectW( NULL );
1230 return HFONT_16(ret);
1234 /***********************************************************************
1235 * CreateHatchBrush (GDI.58)
1237 HBRUSH16 WINAPI CreateHatchBrush16( INT16 style, COLORREF color )
1239 return HBRUSH_16( CreateHatchBrush( style, color ) );
1243 /***********************************************************************
1244 * CreatePatternBrush (GDI.60)
1246 HBRUSH16 WINAPI CreatePatternBrush16( HBITMAP16 hbitmap )
1248 return HBRUSH_16( CreatePatternBrush( HBITMAP_32(hbitmap) ));
1252 /***********************************************************************
1253 * CreatePen (GDI.61)
1255 HPEN16 WINAPI CreatePen16( INT16 style, INT16 width, COLORREF color )
1257 LOGPEN logpen;
1259 logpen.lopnStyle = style;
1260 logpen.lopnWidth.x = width;
1261 logpen.lopnWidth.y = 0;
1262 logpen.lopnColor = color;
1263 return HPEN_16( CreatePenIndirect( &logpen ) );
1267 /***********************************************************************
1268 * CreatePenIndirect (GDI.62)
1270 HPEN16 WINAPI CreatePenIndirect16( const LOGPEN16 * pen )
1272 LOGPEN logpen;
1274 if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
1275 logpen.lopnStyle = pen->lopnStyle;
1276 logpen.lopnWidth.x = pen->lopnWidth.x;
1277 logpen.lopnWidth.y = pen->lopnWidth.y;
1278 logpen.lopnColor = pen->lopnColor;
1279 return HPEN_16( CreatePenIndirect( &logpen ) );
1283 /***********************************************************************
1284 * CreatePolygonRgn (GDI.63)
1286 HRGN16 WINAPI CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
1288 return CreatePolyPolygonRgn16( points, &count, 1, mode );
1292 /***********************************************************************
1293 * CreateRectRgn (GDI.64)
1295 * NOTE: cf. SetRectRgn16
1297 HRGN16 WINAPI CreateRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom )
1299 HRGN hrgn;
1301 if (left < right) hrgn = CreateRectRgn( left, top, right, bottom );
1302 else hrgn = CreateRectRgn( 0, 0, 0, 0 );
1303 return HRGN_16(hrgn);
1307 /***********************************************************************
1308 * CreateRectRgnIndirect (GDI.65)
1310 HRGN16 WINAPI CreateRectRgnIndirect16( const RECT16* rect )
1312 return CreateRectRgn16( rect->left, rect->top, rect->right, rect->bottom );
1316 /***********************************************************************
1317 * CreateSolidBrush (GDI.66)
1319 HBRUSH16 WINAPI CreateSolidBrush16( COLORREF color )
1321 return HBRUSH_16( CreateSolidBrush( color ) );
1325 /***********************************************************************
1326 * DeleteDC (GDI.68)
1328 BOOL16 WINAPI DeleteDC16( HDC16 hdc )
1330 if (DeleteDC( HDC_32(hdc) ))
1332 struct saved_visrgn *saved, *next;
1333 struct gdi_thunk* thunk;
1335 if ((thunk = GDI_FindThunk(hdc))) GDI_DeleteThunk(thunk);
1337 LIST_FOR_EACH_ENTRY_SAFE( saved, next, &saved_regions, struct saved_visrgn, entry )
1339 if (saved->hdc != HDC_32(hdc)) continue;
1340 list_remove( &saved->entry );
1341 DeleteObject( saved->hrgn );
1342 HeapFree( GetProcessHeap(), 0, saved );
1344 return TRUE;
1346 return FALSE;
1350 /***********************************************************************
1351 * DeleteObject (GDI.69)
1352 * SysDeleteObject (GDI.605)
1354 BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
1356 if (GetObjectType( HGDIOBJ_32(obj) ) == OBJ_BITMAP) free_segptr_bits( obj );
1357 return DeleteObject( HGDIOBJ_32(obj) );
1361 /***********************************************************************
1362 * EnumFonts (GDI.70)
1364 INT16 WINAPI EnumFonts16( HDC16 hDC, LPCSTR lpName, FONTENUMPROC16 efproc,
1365 LPARAM lpData )
1367 return EnumFontFamilies16( hDC, lpName, efproc, lpData );
1371 /***********************************************************************
1372 * EnumObjects (GDI.71)
1374 INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
1376 struct callback16_info info;
1378 info.proc = (FARPROC16)proc;
1379 info.param = lParam;
1380 switch(obj)
1382 case OBJ_PEN:
1383 return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
1384 case OBJ_BRUSH:
1385 return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
1387 return 0;
1391 /***********************************************************************
1392 * EqualRgn (GDI.72)
1394 BOOL16 WINAPI EqualRgn16( HRGN16 rgn1, HRGN16 rgn2 )
1396 return EqualRgn( HRGN_32(rgn1), HRGN_32(rgn2) );
1400 /***********************************************************************
1401 * GetBitmapBits (GDI.74)
1403 LONG WINAPI GetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPVOID buffer )
1405 return GetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1409 /***********************************************************************
1410 * GetBkColor (GDI.75)
1412 COLORREF WINAPI GetBkColor16( HDC16 hdc )
1414 return GetBkColor( HDC_32(hdc) );
1418 /***********************************************************************
1419 * GetBkMode (GDI.76)
1421 INT16 WINAPI GetBkMode16( HDC16 hdc )
1423 return GetBkMode( HDC_32(hdc) );
1427 /***********************************************************************
1428 * GetClipBox (GDI.77)
1430 INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
1432 RECT rect32;
1433 INT ret = GetClipBox( HDC_32(hdc), &rect32 );
1435 if (ret != ERROR)
1437 rect->left = rect32.left;
1438 rect->top = rect32.top;
1439 rect->right = rect32.right;
1440 rect->bottom = rect32.bottom;
1442 return ret;
1446 /***********************************************************************
1447 * GetCurrentPosition (GDI.78)
1449 DWORD WINAPI GetCurrentPosition16( HDC16 hdc )
1451 POINT pt32;
1452 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return 0;
1453 return MAKELONG( pt32.x, pt32.y );
1457 /***********************************************************************
1458 * GetDCOrg (GDI.79)
1460 DWORD WINAPI GetDCOrg16( HDC16 hdc )
1462 POINT pt;
1463 if (GetDCOrgEx( HDC_32(hdc), &pt )) return MAKELONG( pt.x, pt.y );
1464 return 0;
1468 /***********************************************************************
1469 * GetDeviceCaps (GDI.80)
1471 INT16 WINAPI GetDeviceCaps16( HDC16 hdc, INT16 cap )
1473 INT16 ret = GetDeviceCaps( HDC_32(hdc), cap );
1474 /* some apps don't expect -1 and think it's a B&W screen */
1475 if ((cap == NUMCOLORS) && (ret == -1)) ret = 2048;
1476 return ret;
1480 /***********************************************************************
1481 * GetMapMode (GDI.81)
1483 INT16 WINAPI GetMapMode16( HDC16 hdc )
1485 return GetMapMode( HDC_32(hdc) );
1489 /***********************************************************************
1490 * GetObject (GDI.82)
1492 INT16 WINAPI GetObject16( HGDIOBJ16 handle16, INT16 count, LPVOID buffer )
1494 HGDIOBJ handle = HGDIOBJ_32( handle16 );
1495 switch( GetObjectType( handle ))
1497 case OBJ_PEN:
1498 if (buffer)
1500 LOGPEN16 *pen16 = buffer;
1501 LOGPEN pen;
1503 if (count < sizeof(LOGPEN16)) return 0;
1504 if (!GetObjectW( handle, sizeof(pen), &pen )) return 0;
1506 pen16->lopnStyle = pen.lopnStyle;
1507 pen16->lopnColor = pen.lopnColor;
1508 pen16->lopnWidth.x = pen.lopnWidth.x;
1509 pen16->lopnWidth.y = pen.lopnWidth.y;
1511 return sizeof(LOGPEN16);
1513 case OBJ_BRUSH:
1514 if (buffer)
1516 LOGBRUSH brush;
1517 LOGBRUSH16 brush16;
1519 if (!GetObjectW( handle, sizeof(brush), &brush )) return 0;
1520 brush16.lbStyle = brush.lbStyle;
1521 brush16.lbColor = brush.lbColor;
1522 brush16.lbHatch = brush.lbHatch;
1523 if (count > sizeof(brush16)) count = sizeof(brush16);
1524 memcpy( buffer, &brush16, count );
1525 return count;
1527 return sizeof(LOGBRUSH16);
1529 case OBJ_PAL:
1530 return GetObjectW( handle, count, buffer );
1532 case OBJ_FONT:
1533 if (buffer)
1535 LOGFONTW font;
1536 LOGFONT16 font16;
1538 if (!GetObjectW( handle, sizeof(font), &font )) return 0;
1539 logfont_W_to_16( &font, &font16 );
1540 if (count > sizeof(font16)) count = sizeof(font16);
1541 memcpy( buffer, &font16, count );
1542 return count;
1544 return sizeof(LOGFONT16);
1546 case OBJ_BITMAP:
1548 DIBSECTION dib;
1549 INT size;
1550 BITMAP16 *bmp16 = buffer;
1552 if (!(size = GetObjectW( handle, sizeof(dib), &dib ))) return 0;
1553 if (size == sizeof(DIBSECTION) && count > sizeof(BITMAP16))
1555 FIXME("not implemented for DIBs: count %d\n", count);
1556 return 0;
1558 else
1560 if (count < sizeof(BITMAP16)) return 0;
1561 bmp16->bmType = dib.dsBm.bmType;
1562 bmp16->bmWidth = dib.dsBm.bmWidth;
1563 bmp16->bmHeight = dib.dsBm.bmHeight;
1564 bmp16->bmWidthBytes = dib.dsBm.bmWidthBytes;
1565 bmp16->bmPlanes = dib.dsBm.bmPlanes;
1566 bmp16->bmBitsPixel = dib.dsBm.bmBitsPixel;
1567 bmp16->bmBits = 0;
1568 return sizeof(BITMAP16);
1572 default:
1573 return 0;
1578 /***********************************************************************
1579 * GetPixel (GDI.83)
1581 COLORREF WINAPI GetPixel16( HDC16 hdc, INT16 x, INT16 y )
1583 return GetPixel( HDC_32(hdc), x, y );
1587 /***********************************************************************
1588 * GetPolyFillMode (GDI.84)
1590 INT16 WINAPI GetPolyFillMode16( HDC16 hdc )
1592 return GetPolyFillMode( HDC_32(hdc) );
1596 /***********************************************************************
1597 * GetROP2 (GDI.85)
1599 INT16 WINAPI GetROP216( HDC16 hdc )
1601 return GetROP2( HDC_32(hdc) );
1605 /***********************************************************************
1606 * GetRelAbs (GDI.86)
1608 INT16 WINAPI GetRelAbs16( HDC16 hdc )
1610 return GetRelAbs( HDC_32(hdc), 0 );
1614 /***********************************************************************
1615 * GetStockObject (GDI.87)
1617 HGDIOBJ16 WINAPI GetStockObject16( INT16 obj )
1619 return HGDIOBJ_16( GetStockObject( obj ) );
1623 /***********************************************************************
1624 * GetStretchBltMode (GDI.88)
1626 INT16 WINAPI GetStretchBltMode16( HDC16 hdc )
1628 return GetStretchBltMode( HDC_32(hdc) );
1632 /***********************************************************************
1633 * GetTextCharacterExtra (GDI.89)
1635 INT16 WINAPI GetTextCharacterExtra16( HDC16 hdc )
1637 return GetTextCharacterExtra( HDC_32(hdc) );
1641 /***********************************************************************
1642 * GetTextColor (GDI.90)
1644 COLORREF WINAPI GetTextColor16( HDC16 hdc )
1646 return GetTextColor( HDC_32(hdc) );
1650 /***********************************************************************
1651 * GetTextExtent (GDI.91)
1653 DWORD WINAPI GetTextExtent16( HDC16 hdc, LPCSTR str, INT16 count )
1655 SIZE size;
1656 if (!GetTextExtentPoint32A( HDC_32(hdc), str, count, &size )) return 0;
1657 return MAKELONG( size.cx, size.cy );
1661 /***********************************************************************
1662 * GetTextFace (GDI.92)
1664 INT16 WINAPI GetTextFace16( HDC16 hdc, INT16 count, LPSTR name )
1666 return GetTextFaceA( HDC_32(hdc), count, name );
1670 /***********************************************************************
1671 * GetTextMetrics (GDI.93)
1673 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *tm )
1675 TEXTMETRICW tm32;
1677 if (!GetTextMetricsW( HDC_32(hdc), &tm32 )) return FALSE;
1679 tm->tmHeight = tm32.tmHeight;
1680 tm->tmAscent = tm32.tmAscent;
1681 tm->tmDescent = tm32.tmDescent;
1682 tm->tmInternalLeading = tm32.tmInternalLeading;
1683 tm->tmExternalLeading = tm32.tmExternalLeading;
1684 tm->tmAveCharWidth = tm32.tmAveCharWidth;
1685 tm->tmMaxCharWidth = tm32.tmMaxCharWidth;
1686 tm->tmWeight = tm32.tmWeight;
1687 tm->tmOverhang = tm32.tmOverhang;
1688 tm->tmDigitizedAspectX = tm32.tmDigitizedAspectX;
1689 tm->tmDigitizedAspectY = tm32.tmDigitizedAspectY;
1690 tm->tmFirstChar = tm32.tmFirstChar;
1691 tm->tmLastChar = tm32.tmLastChar;
1692 tm->tmDefaultChar = tm32.tmDefaultChar;
1693 tm->tmBreakChar = tm32.tmBreakChar;
1694 tm->tmItalic = tm32.tmItalic;
1695 tm->tmUnderlined = tm32.tmUnderlined;
1696 tm->tmStruckOut = tm32.tmStruckOut;
1697 tm->tmPitchAndFamily = tm32.tmPitchAndFamily;
1698 tm->tmCharSet = tm32.tmCharSet;
1699 return TRUE;
1703 /***********************************************************************
1704 * GetViewportExt (GDI.94)
1706 DWORD WINAPI GetViewportExt16( HDC16 hdc )
1708 SIZE size;
1709 if (!GetViewportExtEx( HDC_32(hdc), &size )) return 0;
1710 return MAKELONG( size.cx, size.cy );
1714 /***********************************************************************
1715 * GetViewportOrg (GDI.95)
1717 DWORD WINAPI GetViewportOrg16( HDC16 hdc )
1719 POINT pt;
1720 if (!GetViewportOrgEx( HDC_32(hdc), &pt )) return 0;
1721 return MAKELONG( pt.x, pt.y );
1725 /***********************************************************************
1726 * GetWindowExt (GDI.96)
1728 DWORD WINAPI GetWindowExt16( HDC16 hdc )
1730 SIZE size;
1731 if (!GetWindowExtEx( HDC_32(hdc), &size )) return 0;
1732 return MAKELONG( size.cx, size.cy );
1736 /***********************************************************************
1737 * GetWindowOrg (GDI.97)
1739 DWORD WINAPI GetWindowOrg16( HDC16 hdc )
1741 POINT pt;
1742 if (!GetWindowOrgEx( HDC_32(hdc), &pt )) return 0;
1743 return MAKELONG( pt.x, pt.y );
1749 /**********************************************************************
1750 * LineDDA (GDI.100)
1752 void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
1753 INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
1755 struct callback16_info info;
1756 info.proc = (FARPROC16)proc;
1757 info.param = lParam;
1758 LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
1762 /***********************************************************************
1763 * OffsetRgn (GDI.101)
1765 INT16 WINAPI OffsetRgn16( HRGN16 hrgn, INT16 x, INT16 y )
1767 return OffsetRgn( HRGN_32(hrgn), x, y );
1771 /***********************************************************************
1772 * PtVisible (GDI.103)
1774 BOOL16 WINAPI PtVisible16( HDC16 hdc, INT16 x, INT16 y )
1776 return PtVisible( HDC_32(hdc), x, y );
1780 /***********************************************************************
1781 * SelectVisRgn (GDI.105)
1783 INT16 WINAPI SelectVisRgn16( HDC16 hdc, HRGN16 hrgn )
1785 FIXME( "%04x %04x no longer supported\n", hdc, hrgn );
1786 return ERROR;
1790 /***********************************************************************
1791 * SetBitmapBits (GDI.106)
1793 LONG WINAPI SetBitmapBits16( HBITMAP16 hbitmap, LONG count, LPCVOID buffer )
1795 return SetBitmapBits( HBITMAP_32(hbitmap), count, buffer );
1799 /***********************************************************************
1800 * AddFontResource (GDI.119)
1802 INT16 WINAPI AddFontResource16( LPCSTR filename )
1804 return AddFontResourceA( filename );
1808 /***********************************************************************
1809 * Death (GDI.121)
1811 * Disables GDI, switches back to text mode.
1812 * We don't have to do anything here,
1813 * just let console support handle everything
1815 void WINAPI Death16(HDC16 hdc)
1817 MESSAGE("Death(%04x) called. Application enters text mode...\n", hdc);
1821 /***********************************************************************
1822 * Resurrection (GDI.122)
1824 * Restores GDI functionality
1826 void WINAPI Resurrection16(HDC16 hdc,
1827 WORD w1, WORD w2, WORD w3, WORD w4, WORD w5, WORD w6)
1829 MESSAGE("Resurrection(%04x, %04x, %04x, %04x, %04x, %04x, %04x) called. Application left text mode.\n",
1830 hdc, w1, w2, w3, w4, w5, w6);
1834 /***********************************************************************
1835 * MulDiv (GDI.128)
1837 INT16 WINAPI MulDiv16( INT16 nMultiplicand, INT16 nMultiplier, INT16 nDivisor)
1839 INT ret;
1840 if (!nDivisor) return -32768;
1841 /* We want to deal with a positive divisor to simplify the logic. */
1842 if (nDivisor < 0)
1844 nMultiplicand = - nMultiplicand;
1845 nDivisor = -nDivisor;
1847 /* If the result is positive, we "add" to round. else,
1848 * we subtract to round. */
1849 if ( ( (nMultiplicand < 0) && (nMultiplier < 0) ) ||
1850 ( (nMultiplicand >= 0) && (nMultiplier >= 0) ) )
1851 ret = (((int)nMultiplicand * nMultiplier) + (nDivisor/2)) / nDivisor;
1852 else
1853 ret = (((int)nMultiplicand * nMultiplier) - (nDivisor/2)) / nDivisor;
1854 if ((ret > 32767) || (ret < -32767)) return -32768;
1855 return (INT16) ret;
1859 /***********************************************************************
1860 * GetRgnBox (GDI.134)
1862 INT16 WINAPI GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
1864 RECT r;
1865 INT16 ret = GetRgnBox( HRGN_32(hrgn), &r );
1866 rect->left = r.left;
1867 rect->top = r.top;
1868 rect->right = r.right;
1869 rect->bottom = r.bottom;
1870 return ret;
1874 /***********************************************************************
1875 * RemoveFontResource (GDI.136)
1877 BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
1879 return RemoveFontResourceA(str);
1883 /***********************************************************************
1884 * SetBrushOrg (GDI.148)
1886 DWORD WINAPI SetBrushOrg16( HDC16 hdc, INT16 x, INT16 y )
1888 POINT pt;
1890 if (!SetBrushOrgEx( HDC_32(hdc), x, y, &pt )) return 0;
1891 return MAKELONG( pt.x, pt.y );
1895 /***********************************************************************
1896 * GetBrushOrg (GDI.149)
1898 DWORD WINAPI GetBrushOrg16( HDC16 hdc )
1900 POINT pt;
1901 if (!GetBrushOrgEx( HDC_32(hdc), &pt )) return 0;
1902 return MAKELONG( pt.x, pt.y );
1906 /***********************************************************************
1907 * UnrealizeObject (GDI.150)
1909 BOOL16 WINAPI UnrealizeObject16( HGDIOBJ16 obj )
1911 return UnrealizeObject( HGDIOBJ_32(obj) );
1915 /***********************************************************************
1916 * CreateIC (GDI.153)
1918 HDC16 WINAPI CreateIC16( LPCSTR driver, LPCSTR device, LPCSTR output,
1919 const DEVMODEA* initData )
1921 return HDC_16( CreateICA( driver, device, output, initData ) );
1925 /***********************************************************************
1926 * GetNearestColor (GDI.154)
1928 COLORREF WINAPI GetNearestColor16( HDC16 hdc, COLORREF color )
1930 return GetNearestColor( HDC_32(hdc), color );
1934 /***********************************************************************
1935 * CreateDiscardableBitmap (GDI.156)
1937 HBITMAP16 WINAPI CreateDiscardableBitmap16( HDC16 hdc, INT16 width, INT16 height )
1939 return HBITMAP_16( CreateDiscardableBitmap( HDC_32(hdc), width, height ) );
1943 /***********************************************************************
1944 * PtInRegion (GDI.161)
1946 BOOL16 WINAPI PtInRegion16( HRGN16 hrgn, INT16 x, INT16 y )
1948 return PtInRegion( HRGN_32(hrgn), x, y );
1952 /***********************************************************************
1953 * GetBitmapDimension (GDI.162)
1955 DWORD WINAPI GetBitmapDimension16( HBITMAP16 hbitmap )
1957 SIZE16 size;
1958 if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
1959 return MAKELONG( size.cx, size.cy );
1963 /***********************************************************************
1964 * SetBitmapDimension (GDI.163)
1966 DWORD WINAPI SetBitmapDimension16( HBITMAP16 hbitmap, INT16 x, INT16 y )
1968 SIZE16 size;
1969 if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
1970 return MAKELONG( size.cx, size.cy );
1974 /***********************************************************************
1975 * SetRectRgn (GDI.172)
1977 * NOTE: Win 3.1 sets region to empty if left > right
1979 void WINAPI SetRectRgn16( HRGN16 hrgn, INT16 left, INT16 top, INT16 right, INT16 bottom )
1981 if (left < right) SetRectRgn( HRGN_32(hrgn), left, top, right, bottom );
1982 else SetRectRgn( HRGN_32(hrgn), 0, 0, 0, 0 );
1986 /******************************************************************
1987 * PlayMetaFileRecord (GDI.176)
1989 void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, UINT16 handles )
1991 HANDLETABLE *ht32 = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET(HANDLETABLE, objectHandle[handles] ));
1992 unsigned int i;
1994 for (i = 0; i < handles; i++) ht32->objectHandle[i] = HGDIOBJ_32(ht->objectHandle[i]);
1995 PlayMetaFileRecord( HDC_32(hdc), ht32, mr, handles );
1996 for (i = 0; i < handles; i++) ht->objectHandle[i] = HGDIOBJ_16(ht32->objectHandle[i]);
1997 HeapFree( GetProcessHeap(), 0, ht32 );
2001 /***********************************************************************
2002 * SetDCHook (GDI.190)
2004 BOOL16 WINAPI SetDCHook16( HDC16 hdc16, FARPROC16 hookProc, DWORD dwHookData )
2006 FIXME( "%04x %p %lx: not supported\n", hdc16, hookProc, dwHookData );
2007 return FALSE;
2011 /***********************************************************************
2012 * GetDCHook (GDI.191)
2014 DWORD WINAPI GetDCHook16( HDC16 hdc16, FARPROC16 *phookProc )
2016 FIXME( "%04x: not supported\n", hdc16 );
2017 return 0;
2021 /***********************************************************************
2022 * SetHookFlags (GDI.192)
2024 WORD WINAPI SetHookFlags16( HDC16 hdc, WORD flags )
2026 FIXME( "%04x %x: not supported\n", hdc, flags );
2027 return 0;
2031 /***********************************************************************
2032 * SetBoundsRect (GDI.193)
2034 UINT16 WINAPI SetBoundsRect16( HDC16 hdc, const RECT16* rect, UINT16 flags )
2036 if (rect)
2038 RECT rect32;
2039 rect32.left = rect->left;
2040 rect32.top = rect->top;
2041 rect32.right = rect->right;
2042 rect32.bottom = rect->bottom;
2043 return SetBoundsRect( HDC_32( hdc ), &rect32, flags );
2045 else return SetBoundsRect( HDC_32( hdc ), NULL, flags );
2049 /***********************************************************************
2050 * GetBoundsRect (GDI.194)
2052 UINT16 WINAPI GetBoundsRect16( HDC16 hdc, LPRECT16 rect, UINT16 flags)
2054 RECT rect32;
2055 UINT ret = GetBoundsRect( HDC_32( hdc ), &rect32, flags );
2056 if (rect)
2058 rect->left = rect32.left;
2059 rect->top = rect32.top;
2060 rect->right = rect32.right;
2061 rect->bottom = rect32.bottom;
2063 return ret;
2067 /***********************************************************************
2068 * EngineEnumerateFont (GDI.300)
2070 WORD WINAPI EngineEnumerateFont16(LPSTR fontname, FARPROC16 proc, DWORD data )
2072 FIXME("(%s,%p,%lx),stub\n",fontname,proc,data);
2073 return 0;
2077 /***********************************************************************
2078 * EngineDeleteFont (GDI.301)
2080 WORD WINAPI EngineDeleteFont16(LPFONTINFO16 lpFontInfo)
2082 WORD handle;
2084 /* untested, don't know if it works.
2085 We seem to access some structure that is located after the
2086 FONTINFO. The FONTINFO documentation says that there may
2087 follow some char-width table or font bitmap or vector info.
2088 I think it is some kind of font bitmap that begins at offset 0x52,
2089 as FONTINFO goes up to 0x51.
2090 If this is correct, everything should be implemented correctly.
2092 if ( ((lpFontInfo->dfType & (RASTER_FONTTYPE|DEVICE_FONTTYPE)) == (RASTER_FONTTYPE|DEVICE_FONTTYPE))
2093 && (LOWORD(lpFontInfo->dfFace) == LOWORD(lpFontInfo)+0x6e)
2094 && (handle = *(WORD *)(lpFontInfo+0x54)) )
2096 *(WORD *)(lpFontInfo+0x54) = 0;
2097 GlobalFree16(handle);
2099 return 1;
2103 /***********************************************************************
2104 * EngineRealizeFont (GDI.302)
2106 WORD WINAPI EngineRealizeFont16(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
2108 FIXME("(%p,%p,%p),stub\n",lplogFont,lptextxform,lpfontInfo);
2110 return 0;
2114 /***********************************************************************
2115 * EngineRealizeFontExt (GDI.315)
2117 WORD WINAPI EngineRealizeFontExt16(LONG l1, LONG l2, LONG l3, LONG l4)
2119 FIXME("(%08lx,%08lx,%08lx,%08lx),stub\n",l1,l2,l3,l4);
2121 return 0;
2125 /***********************************************************************
2126 * EngineGetCharWidth (GDI.303)
2128 WORD WINAPI EngineGetCharWidth16(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE lastChar, LPINT16 buffer)
2130 int i;
2132 for (i = firstChar; i <= lastChar; i++)
2133 FIXME(" returns font's average width for range %d to %d\n", firstChar, lastChar);
2134 *buffer++ = lpFontInfo->dfAvgWidth; /* insert some charwidth functionality here; use average width for now */
2135 return 1;
2139 /***********************************************************************
2140 * EngineSetFontContext (GDI.304)
2142 WORD WINAPI EngineSetFontContext16(LPFONTINFO16 lpFontInfo, WORD data)
2144 FIXME("stub?\n");
2145 return 0;
2148 /***********************************************************************
2149 * EngineGetGlyphBMP (GDI.305)
2151 WORD WINAPI EngineGetGlyphBMP16(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2,
2152 LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics)
2154 FIXME("stub?\n");
2155 return 0;
2159 /***********************************************************************
2160 * EngineMakeFontDir (GDI.306)
2162 DWORD WINAPI EngineMakeFontDir16(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string)
2164 FIXME(" stub! (always fails)\n");
2165 return ~0UL; /* error */
2169 /***********************************************************************
2170 * GetCharABCWidths (GDI.307)
2172 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPABC16 abc )
2174 BOOL ret;
2175 UINT i;
2176 LPABC abc32 = HeapAlloc( GetProcessHeap(), 0, sizeof(ABC) * (lastChar - firstChar + 1) );
2178 if ((ret = GetCharABCWidthsA( HDC_32(hdc), firstChar, lastChar, abc32 )))
2180 for (i = firstChar; i <= lastChar; i++)
2182 abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
2183 abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
2184 abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
2187 HeapFree( GetProcessHeap(), 0, abc32 );
2188 return ret;
2192 /***********************************************************************
2193 * GetOutlineTextMetrics (GDI.308)
2195 * Gets metrics for TrueType fonts.
2197 * PARAMS
2198 * hdc [In] Handle of device context
2199 * cbData [In] Size of metric data array
2200 * lpOTM [Out] Address of metric data array
2202 * RETURNS
2203 * Success: Non-zero or size of required buffer
2204 * Failure: 0
2206 * NOTES
2207 * lpOTM should be LPOUTLINETEXTMETRIC
2209 UINT16 WINAPI GetOutlineTextMetrics16( HDC16 hdc, UINT16 cbData,
2210 LPOUTLINETEXTMETRIC16 lpOTM )
2212 FIXME("(%04x,%04x,%p): stub\n", hdc,cbData,lpOTM);
2213 return 0;
2217 /***********************************************************************
2218 * GetGlyphOutline (GDI.309)
2220 DWORD WINAPI GetGlyphOutline16( HDC16 hdc, UINT16 uChar, UINT16 fuFormat,
2221 LPGLYPHMETRICS16 lpgm, DWORD cbBuffer,
2222 LPVOID lpBuffer, const MAT2 *lpmat2 )
2224 DWORD ret;
2225 GLYPHMETRICS gm32;
2227 ret = GetGlyphOutlineA( HDC_32(hdc), uChar, fuFormat, &gm32, cbBuffer, lpBuffer, lpmat2);
2228 if (ret && ret != GDI_ERROR)
2230 lpgm->gmBlackBoxX = gm32.gmBlackBoxX;
2231 lpgm->gmBlackBoxY = gm32.gmBlackBoxY;
2232 lpgm->gmptGlyphOrigin.x = gm32.gmptGlyphOrigin.x;
2233 lpgm->gmptGlyphOrigin.y = gm32.gmptGlyphOrigin.y;
2234 lpgm->gmCellIncX = gm32.gmCellIncX;
2235 lpgm->gmCellIncY = gm32.gmCellIncY;
2237 return ret;
2241 /***********************************************************************
2242 * CreateScalableFontResource (GDI.310)
2244 BOOL16 WINAPI CreateScalableFontResource16( UINT16 fHidden, LPCSTR lpszResourceFile,
2245 LPCSTR fontFile, LPCSTR path )
2247 return CreateScalableFontResourceA( fHidden, lpszResourceFile, fontFile, path );
2251 /*************************************************************************
2252 * GetFontData (GDI.311)
2255 DWORD WINAPI GetFontData16( HDC16 hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD count )
2257 return GetFontData( HDC_32(hdc), table, offset, buffer, count );
2261 /*************************************************************************
2262 * GetRasterizerCaps (GDI.313)
2264 BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes )
2266 return GetRasterizerCaps( lprs, cbNumBytes );
2270 /***********************************************************************
2271 * EnumFontFamilies (GDI.330)
2273 INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily,
2274 FONTENUMPROC16 efproc, LPARAM lpData )
2276 LOGFONT16 lf, *plf;
2278 if (lpFamily)
2280 if (!*lpFamily) return 1;
2281 lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE );
2282 lf.lfCharSet = DEFAULT_CHARSET;
2283 lf.lfPitchAndFamily = 0;
2284 plf = &lf;
2286 else plf = NULL;
2288 return EnumFontFamiliesEx16( hDC, plf, efproc, lpData, 0 );
2292 /*************************************************************************
2293 * GetKerningPairs (GDI.332)
2296 INT16 WINAPI GetKerningPairs16( HDC16 hdc, INT16 count, LPKERNINGPAIR16 pairs )
2298 KERNINGPAIR *pairs32;
2299 INT i, ret;
2301 if (!count) return 0;
2303 if (!(pairs32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pairs32) ))) return 0;
2304 if ((ret = GetKerningPairsA( HDC_32(hdc), count, pairs32 )))
2306 for (i = 0; i < ret; i++)
2308 pairs->wFirst = pairs32->wFirst;
2309 pairs->wSecond = pairs32->wSecond;
2310 pairs->iKernAmount = pairs32->iKernAmount;
2313 HeapFree( GetProcessHeap(), 0, pairs32 );
2314 return ret;
2319 /***********************************************************************
2320 * GetTextAlign (GDI.345)
2322 UINT16 WINAPI GetTextAlign16( HDC16 hdc )
2324 return GetTextAlign( HDC_32(hdc) );
2328 /***********************************************************************
2329 * SetTextAlign (GDI.346)
2331 UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
2333 return SetTextAlign( HDC_32(hdc), align );
2337 /***********************************************************************
2338 * Chord (GDI.348)
2340 BOOL16 WINAPI Chord16( HDC16 hdc, INT16 left, INT16 top,
2341 INT16 right, INT16 bottom, INT16 xstart, INT16 ystart,
2342 INT16 xend, INT16 yend )
2344 return Chord( HDC_32(hdc), left, top, right, bottom, xstart, ystart, xend, yend );
2348 /***********************************************************************
2349 * SetMapperFlags (GDI.349)
2351 DWORD WINAPI SetMapperFlags16( HDC16 hdc, DWORD flags )
2353 return SetMapperFlags( HDC_32(hdc), flags );
2357 /***********************************************************************
2358 * GetCharWidth (GDI.350)
2360 BOOL16 WINAPI GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar, LPINT16 buffer )
2362 BOOL retVal = FALSE;
2364 if( firstChar != lastChar )
2366 LPINT buf32 = HeapAlloc(GetProcessHeap(), 0, sizeof(INT)*(1 + (lastChar - firstChar)));
2367 if( buf32 )
2369 LPINT obuf32 = buf32;
2370 UINT i;
2372 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, buf32);
2373 if (retVal)
2375 for (i = firstChar; i <= lastChar; i++) *buffer++ = *buf32++;
2377 HeapFree(GetProcessHeap(), 0, obuf32);
2380 else /* happens quite often to warrant a special treatment */
2382 INT chWidth;
2383 retVal = GetCharWidth32A( HDC_32(hdc), firstChar, lastChar, &chWidth );
2384 *buffer = chWidth;
2386 return retVal;
2390 /***********************************************************************
2391 * ExtTextOut (GDI.351)
2393 BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
2394 const RECT16 *lprect, LPCSTR str, UINT16 count,
2395 const INT16 *lpDx )
2397 BOOL ret;
2398 int i;
2399 RECT rect32;
2400 LPINT lpdx32 = NULL;
2402 if (lpDx) {
2403 lpdx32 = HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
2404 if(lpdx32 == NULL) return FALSE;
2405 for (i=count;i--;) lpdx32[i]=lpDx[i];
2407 if (lprect)
2409 rect32.left = lprect->left;
2410 rect32.top = lprect->top;
2411 rect32.right = lprect->right;
2412 rect32.bottom = lprect->bottom;
2414 ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
2415 HeapFree( GetProcessHeap(), 0, lpdx32 );
2416 return ret;
2420 /***********************************************************************
2421 * CreatePalette (GDI.360)
2423 HPALETTE16 WINAPI CreatePalette16( const LOGPALETTE* palette )
2425 return HPALETTE_16( CreatePalette( palette ) );
2429 /***********************************************************************
2430 * GDISelectPalette (GDI.361)
2432 HPALETTE16 WINAPI GDISelectPalette16( HDC16 hdc, HPALETTE16 hpalette, WORD wBkg )
2434 HPALETTE16 ret = HPALETTE_16( SelectPalette( HDC_32(hdc), HPALETTE_32(hpalette), wBkg ));
2435 if (ret && !wBkg) hPrimaryPalette = hpalette;
2436 return ret;
2440 /***********************************************************************
2441 * GDIRealizePalette (GDI.362)
2443 UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
2445 return RealizePalette( HDC_32(hdc) );
2449 /***********************************************************************
2450 * GetPaletteEntries (GDI.363)
2452 UINT16 WINAPI GetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
2453 UINT16 count, LPPALETTEENTRY entries )
2455 return GetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
2459 /***********************************************************************
2460 * SetPaletteEntries (GDI.364)
2462 UINT16 WINAPI SetPaletteEntries16( HPALETTE16 hpalette, UINT16 start,
2463 UINT16 count, const PALETTEENTRY *entries )
2465 return SetPaletteEntries( HPALETTE_32(hpalette), start, count, entries );
2469 /**********************************************************************
2470 * UpdateColors (GDI.366)
2472 INT16 WINAPI UpdateColors16( HDC16 hdc )
2474 UpdateColors( HDC_32(hdc) );
2475 return TRUE;
2479 /***********************************************************************
2480 * AnimatePalette (GDI.367)
2482 void WINAPI AnimatePalette16( HPALETTE16 hpalette, UINT16 StartIndex,
2483 UINT16 NumEntries, const PALETTEENTRY* PaletteColors)
2485 AnimatePalette( HPALETTE_32(hpalette), StartIndex, NumEntries, PaletteColors );
2489 /***********************************************************************
2490 * ResizePalette (GDI.368)
2492 BOOL16 WINAPI ResizePalette16( HPALETTE16 hpalette, UINT16 cEntries )
2494 return ResizePalette( HPALETTE_32(hpalette), cEntries );
2498 /***********************************************************************
2499 * GetNearestPaletteIndex (GDI.370)
2501 UINT16 WINAPI GetNearestPaletteIndex16( HPALETTE16 hpalette, COLORREF color )
2503 return GetNearestPaletteIndex( HPALETTE_32(hpalette), color );
2507 /**********************************************************************
2508 * ExtFloodFill (GDI.372)
2510 BOOL16 WINAPI ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
2511 UINT16 fillType )
2513 return ExtFloodFill( HDC_32(hdc), x, y, color, fillType );
2517 /***********************************************************************
2518 * SetSystemPaletteUse (GDI.373)
2520 UINT16 WINAPI SetSystemPaletteUse16( HDC16 hdc, UINT16 use )
2522 return SetSystemPaletteUse( HDC_32(hdc), use );
2526 /***********************************************************************
2527 * GetSystemPaletteUse (GDI.374)
2529 UINT16 WINAPI GetSystemPaletteUse16( HDC16 hdc )
2531 return GetSystemPaletteUse( HDC_32(hdc) );
2535 /***********************************************************************
2536 * GetSystemPaletteEntries (GDI.375)
2538 UINT16 WINAPI GetSystemPaletteEntries16( HDC16 hdc, UINT16 start, UINT16 count,
2539 LPPALETTEENTRY entries )
2541 return GetSystemPaletteEntries( HDC_32(hdc), start, count, entries );
2545 /***********************************************************************
2546 * ResetDC (GDI.376)
2548 HDC16 WINAPI ResetDC16( HDC16 hdc, const DEVMODEA *devmode )
2550 return HDC_16( ResetDCA(HDC_32(hdc), devmode) );
2554 /******************************************************************
2555 * StartDoc (GDI.377)
2557 INT16 WINAPI StartDoc16( HDC16 hdc, const DOCINFO16 *lpdoc )
2559 DOCINFOA docA;
2561 docA.cbSize = lpdoc->cbSize;
2562 docA.lpszDocName = MapSL(lpdoc->lpszDocName);
2563 docA.lpszOutput = MapSL(lpdoc->lpszOutput);
2564 if(lpdoc->cbSize > offsetof(DOCINFO16,lpszDatatype))
2565 docA.lpszDatatype = MapSL(lpdoc->lpszDatatype);
2566 else
2567 docA.lpszDatatype = NULL;
2568 if(lpdoc->cbSize > offsetof(DOCINFO16,fwType))
2569 docA.fwType = lpdoc->fwType;
2570 else
2571 docA.fwType = 0;
2572 return StartDocA( HDC_32(hdc), &docA );
2576 /******************************************************************
2577 * EndDoc (GDI.378)
2579 INT16 WINAPI EndDoc16( HDC16 hdc )
2581 return EndDoc( HDC_32(hdc) );
2585 /******************************************************************
2586 * StartPage (GDI.379)
2588 INT16 WINAPI StartPage16( HDC16 hdc )
2590 return StartPage( HDC_32(hdc) );
2594 /******************************************************************
2595 * EndPage (GDI.380)
2597 INT16 WINAPI EndPage16( HDC16 hdc )
2599 return EndPage( HDC_32(hdc) );
2603 /******************************************************************************
2604 * AbortDoc (GDI.382)
2606 INT16 WINAPI AbortDoc16( HDC16 hdc )
2608 return AbortDoc( HDC_32(hdc) );
2612 /***********************************************************************
2613 * FastWindowFrame (GDI.400)
2615 BOOL16 WINAPI FastWindowFrame16( HDC16 hdc, const RECT16 *rect,
2616 INT16 width, INT16 height, DWORD rop )
2618 HDC hdc32 = HDC_32(hdc);
2619 HBRUSH hbrush = SelectObject( hdc32, GetStockObject( GRAY_BRUSH ) );
2620 PatBlt( hdc32, rect->left, rect->top,
2621 rect->right - rect->left - width, height, rop );
2622 PatBlt( hdc32, rect->left, rect->top + height, width,
2623 rect->bottom - rect->top - height, rop );
2624 PatBlt( hdc32, rect->left + width, rect->bottom - 1,
2625 rect->right - rect->left - width, -height, rop );
2626 PatBlt( hdc32, rect->right - 1, rect->top, -width,
2627 rect->bottom - rect->top - height, rop );
2628 SelectObject( hdc32, hbrush );
2629 return TRUE;
2633 /***********************************************************************
2634 * GdiInit2 (GDI.403)
2636 * See "Undocumented Windows"
2638 * PARAMS
2639 * h1 [I] GDI object
2640 * h2 [I] global data
2642 HANDLE16 WINAPI GdiInit216( HANDLE16 h1, HANDLE16 h2 )
2644 FIXME("(%04x, %04x), stub.\n", h1, h2);
2645 if (h2 == 0xffff) return 0xffff; /* undefined return value */
2646 return h1; /* FIXME: should be the memory handle of h1 */
2650 /***********************************************************************
2651 * FinalGdiInit (GDI.405)
2653 void WINAPI FinalGdiInit16( HBRUSH16 hPattern /* [in] fill pattern of desktop */ )
2658 /***********************************************************************
2659 * CreateUserBitmap (GDI.407)
2661 HBITMAP16 WINAPI CreateUserBitmap16( INT16 width, INT16 height, UINT16 planes,
2662 UINT16 bpp, LPCVOID bits )
2664 return CreateBitmap16( width, height, planes, bpp, bits );
2668 /***********************************************************************
2669 * CreateUserDiscardableBitmap (GDI.409)
2671 HBITMAP16 WINAPI CreateUserDiscardableBitmap16( WORD dummy, INT16 width, INT16 height )
2673 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
2674 HBITMAP ret = CreateCompatibleBitmap( hdc, width, height );
2675 DeleteDC( hdc );
2676 return HBITMAP_16(ret);
2680 /***********************************************************************
2681 * GetCurLogFont (GDI.411)
2683 HFONT16 WINAPI GetCurLogFont16( HDC16 hdc )
2685 return HFONT_16( GetCurrentObject( HDC_32(hdc), OBJ_FONT ) );
2689 /***********************************************************************
2690 * StretchDIBits (GDI.439)
2692 INT16 WINAPI StretchDIBits16( HDC16 hdc, INT16 xDst, INT16 yDst, INT16 widthDst,
2693 INT16 heightDst, INT16 xSrc, INT16 ySrc, INT16 widthSrc,
2694 INT16 heightSrc, const VOID *bits,
2695 const BITMAPINFO *info, UINT16 wUsage, DWORD dwRop )
2697 return StretchDIBits( HDC_32(hdc), xDst, yDst, widthDst, heightDst,
2698 xSrc, ySrc, widthSrc, heightSrc, bits,
2699 info, wUsage, dwRop );
2703 /***********************************************************************
2704 * SetDIBits (GDI.440)
2706 INT16 WINAPI SetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2707 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2708 UINT16 coloruse )
2710 return SetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2714 /***********************************************************************
2715 * GetDIBits (GDI.441)
2717 INT16 WINAPI GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
2718 UINT16 lines, LPVOID bits, BITMAPINFO * info,
2719 UINT16 coloruse )
2721 return GetDIBits( HDC_32(hdc), HBITMAP_32(hbitmap), startscan, lines, bits, info, coloruse );
2725 /***********************************************************************
2726 * CreateDIBitmap (GDI.442)
2728 HBITMAP16 WINAPI CreateDIBitmap16( HDC16 hdc, const BITMAPINFOHEADER * header,
2729 DWORD init, LPCVOID bits, const BITMAPINFO * data,
2730 UINT16 coloruse )
2732 return HBITMAP_16( CreateDIBitmap( HDC_32(hdc), header, init, bits, data, coloruse ) );
2736 /***********************************************************************
2737 * SetDIBitsToDevice (GDI.443)
2739 INT16 WINAPI SetDIBitsToDevice16( HDC16 hdc, INT16 xDest, INT16 yDest, INT16 cx,
2740 INT16 cy, INT16 xSrc, INT16 ySrc, UINT16 startscan,
2741 UINT16 lines, LPCVOID bits, const BITMAPINFO *info,
2742 UINT16 coloruse )
2744 return SetDIBitsToDevice( HDC_32(hdc), xDest, yDest, cx, cy, xSrc, ySrc,
2745 startscan, lines, bits, info, coloruse );
2749 /***********************************************************************
2750 * CreateRoundRectRgn (GDI.444)
2752 * If either ellipse dimension is zero we call CreateRectRgn16 for its
2753 * `special' behaviour. -ve ellipse dimensions can result in GPFs under win3.1
2754 * we just let CreateRoundRectRgn convert them to +ve values.
2757 HRGN16 WINAPI CreateRoundRectRgn16( INT16 left, INT16 top, INT16 right, INT16 bottom,
2758 INT16 ellipse_width, INT16 ellipse_height )
2760 if( ellipse_width == 0 || ellipse_height == 0 )
2761 return CreateRectRgn16( left, top, right, bottom );
2762 else
2763 return HRGN_16( CreateRoundRectRgn( left, top, right, bottom,
2764 ellipse_width, ellipse_height ));
2768 /***********************************************************************
2769 * CreateDIBPatternBrush (GDI.445)
2771 HBRUSH16 WINAPI CreateDIBPatternBrush16( HGLOBAL16 hbitmap, UINT16 coloruse )
2773 BITMAPINFO *bmi;
2774 HBRUSH16 ret;
2776 if (!(bmi = GlobalLock16( hbitmap ))) return 0;
2777 ret = HBRUSH_16( CreateDIBPatternBrushPt( bmi, coloruse ));
2778 GlobalUnlock16( hbitmap );
2779 return ret;
2783 /**********************************************************************
2784 * PolyPolygon (GDI.450)
2786 BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
2787 UINT16 polygons )
2789 int i,nrpts;
2790 LPPOINT pt32;
2791 LPINT counts32;
2792 BOOL16 ret;
2794 nrpts=0;
2795 for (i=polygons;i--;)
2796 nrpts+=counts[i];
2797 pt32 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
2798 if(pt32 == NULL) return FALSE;
2799 for (i=nrpts;i--;)
2801 pt32[i].x = pt[i].x;
2802 pt32[i].y = pt[i].y;
2804 counts32 = HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
2805 if(counts32 == NULL) {
2806 HeapFree( GetProcessHeap(), 0, pt32 );
2807 return FALSE;
2809 for (i=polygons;i--;) counts32[i]=counts[i];
2811 ret = PolyPolygon(HDC_32(hdc),pt32,counts32,polygons);
2812 HeapFree( GetProcessHeap(), 0, counts32 );
2813 HeapFree( GetProcessHeap(), 0, pt32 );
2814 return ret;
2818 /***********************************************************************
2819 * CreatePolyPolygonRgn (GDI.451)
2821 HRGN16 WINAPI CreatePolyPolygonRgn16( const POINT16 *points,
2822 const INT16 *count, INT16 nbpolygons, INT16 mode )
2824 HRGN hrgn;
2825 int i, npts = 0;
2826 INT *count32;
2827 POINT *points32;
2829 for (i = 0; i < nbpolygons; i++) npts += count[i];
2830 points32 = HeapAlloc( GetProcessHeap(), 0, npts * sizeof(POINT) );
2831 for (i = 0; i < npts; i++)
2833 points32[i].x = points[i].x;
2834 points32[i].y = points[i].y;
2837 count32 = HeapAlloc( GetProcessHeap(), 0, nbpolygons * sizeof(INT) );
2838 for (i = 0; i < nbpolygons; i++) count32[i] = count[i];
2839 hrgn = CreatePolyPolygonRgn( points32, count32, nbpolygons, mode );
2840 HeapFree( GetProcessHeap(), 0, count32 );
2841 HeapFree( GetProcessHeap(), 0, points32 );
2842 return HRGN_16(hrgn);
2846 /***********************************************************************
2847 * GdiSeeGdiDo (GDI.452)
2849 DWORD WINAPI GdiSeeGdiDo16( WORD wReqType, WORD wParam1, WORD wParam2,
2850 WORD wParam3 )
2852 DWORD ret = ~0U;
2854 switch (wReqType)
2856 case 0x0001: /* LocalAlloc */
2857 WARN("LocalAlloc16(%x, %x): ignoring\n", wParam1, wParam3);
2858 ret = 0;
2859 break;
2860 case 0x0002: /* LocalFree */
2861 WARN("LocalFree16(%x): ignoring\n", wParam1);
2862 ret = 0;
2863 break;
2864 case 0x0003: /* LocalCompact */
2865 WARN("LocalCompact16(%x): ignoring\n", wParam3);
2866 ret = 65000; /* lie about the amount of free space */
2867 break;
2868 case 0x0103: /* LocalHeap */
2869 WARN("LocalHeap16(): ignoring\n");
2870 break;
2871 default:
2872 WARN("(wReqType=%04x): Unknown\n", wReqType);
2873 break;
2875 return ret;
2879 /***********************************************************************
2880 * SetObjectOwner (GDI.461)
2882 void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
2884 /* Nothing to do */
2888 /***********************************************************************
2889 * IsGDIObject (GDI.462)
2891 * returns type of object if valid (W95 system programming secrets p. 264-5)
2893 BOOL16 WINAPI IsGDIObject16( HGDIOBJ16 handle16 )
2895 static const BYTE type_map[] =
2897 0, /* bad */
2898 1, /* OBJ_PEN */
2899 2, /* OBJ_BRUSH */
2900 7, /* OBJ_DC */
2901 9, /* OBJ_METADC */
2902 4, /* OBJ_PAL */
2903 3, /* OBJ_FONT */
2904 5, /* OBJ_BITMAP */
2905 6, /* OBJ_REGION */
2906 10, /* OBJ_METAFILE */
2907 7, /* OBJ_MEMDC */
2908 0, /* OBJ_EXTPEN */
2909 9, /* OBJ_ENHMETADC */
2910 12, /* OBJ_ENHMETAFILE */
2911 0 /* OBJ_COLORSPACE */
2914 UINT type = GetObjectType( HGDIOBJ_32( handle16 ));
2916 if (type >= ARRAY_SIZE(type_map)) return FALSE;
2917 return type_map[type];
2921 /***********************************************************************
2922 * RectVisible (GDI.465)
2923 * RectVisibleOld (GDI.104)
2925 BOOL16 WINAPI RectVisible16( HDC16 hdc, const RECT16* rect16 )
2927 RECT rect;
2929 rect.left = rect16->left;
2930 rect.top = rect16->top;
2931 rect.right = rect16->right;
2932 rect.bottom = rect16->bottom;
2933 return RectVisible( HDC_32(hdc), &rect );
2937 /***********************************************************************
2938 * RectInRegion (GDI.466)
2939 * RectInRegionOld (GDI.181)
2941 BOOL16 WINAPI RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
2943 RECT r32;
2945 r32.left = rect->left;
2946 r32.top = rect->top;
2947 r32.right = rect->right;
2948 r32.bottom = rect->bottom;
2949 return RectInRegion( HRGN_32(hrgn), &r32 );
2953 /***********************************************************************
2954 * GetBitmapDimensionEx (GDI.468)
2956 BOOL16 WINAPI GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
2958 SIZE size32;
2959 BOOL ret = GetBitmapDimensionEx( HBITMAP_32(hbitmap), &size32 );
2961 if (ret)
2963 size->cx = size32.cx;
2964 size->cy = size32.cy;
2966 return ret;
2970 /***********************************************************************
2971 * GetBrushOrgEx (GDI.469)
2973 BOOL16 WINAPI GetBrushOrgEx16( HDC16 hdc, LPPOINT16 pt )
2975 POINT pt32;
2976 if (!GetBrushOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
2977 pt->x = pt32.x;
2978 pt->y = pt32.y;
2979 return TRUE;
2983 /***********************************************************************
2984 * GetCurrentPositionEx (GDI.470)
2986 BOOL16 WINAPI GetCurrentPositionEx16( HDC16 hdc, LPPOINT16 pt )
2988 POINT pt32;
2989 if (!GetCurrentPositionEx( HDC_32(hdc), &pt32 )) return FALSE;
2990 pt->x = pt32.x;
2991 pt->y = pt32.y;
2992 return TRUE;
2996 /***********************************************************************
2997 * GetTextExtentPoint (GDI.471)
2999 * FIXME: Should this have a bug for compatibility?
3000 * Original Windows versions of GetTextExtentPoint{A,W} have documented
3001 * bugs (-> MSDN KB q147647.txt).
3003 BOOL16 WINAPI GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size )
3005 SIZE size32;
3006 BOOL ret = GetTextExtentPoint32A( HDC_32(hdc), str, count, &size32 );
3008 if (ret)
3010 size->cx = size32.cx;
3011 size->cy = size32.cy;
3013 return ret;
3017 /***********************************************************************
3018 * GetViewportExtEx (GDI.472)
3020 BOOL16 WINAPI GetViewportExtEx16( HDC16 hdc, LPSIZE16 size )
3022 SIZE size32;
3023 if (!GetViewportExtEx( HDC_32(hdc), &size32 )) return FALSE;
3024 size->cx = size32.cx;
3025 size->cy = size32.cy;
3026 return TRUE;
3030 /***********************************************************************
3031 * GetViewportOrgEx (GDI.473)
3033 BOOL16 WINAPI GetViewportOrgEx16( HDC16 hdc, LPPOINT16 pt )
3035 POINT pt32;
3036 if (!GetViewportOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
3037 pt->x = pt32.x;
3038 pt->y = pt32.y;
3039 return TRUE;
3043 /***********************************************************************
3044 * GetWindowExtEx (GDI.474)
3046 BOOL16 WINAPI GetWindowExtEx16( HDC16 hdc, LPSIZE16 size )
3048 SIZE size32;
3049 if (!GetWindowExtEx( HDC_32(hdc), &size32 )) return FALSE;
3050 size->cx = size32.cx;
3051 size->cy = size32.cy;
3052 return TRUE;
3056 /***********************************************************************
3057 * GetWindowOrgEx (GDI.475)
3059 BOOL16 WINAPI GetWindowOrgEx16( HDC16 hdc, LPPOINT16 pt )
3061 POINT pt32;
3062 if (!GetWindowOrgEx( HDC_32(hdc), &pt32 )) return FALSE;
3063 pt->x = pt32.x;
3064 pt->y = pt32.y;
3065 return TRUE;
3069 /***********************************************************************
3070 * OffsetViewportOrgEx (GDI.476)
3072 BOOL16 WINAPI OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt)
3074 POINT pt32;
3075 BOOL16 ret = OffsetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
3076 if (pt)
3078 pt->x = pt32.x;
3079 pt->y = pt32.y;
3081 return ret;
3085 /***********************************************************************
3086 * OffsetWindowOrgEx (GDI.477)
3088 BOOL16 WINAPI OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
3090 POINT pt32;
3091 BOOL16 ret = OffsetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
3092 if (pt)
3094 pt->x = pt32.x;
3095 pt->y = pt32.y;
3097 return ret;
3101 /***********************************************************************
3102 * SetBitmapDimensionEx (GDI.478)
3104 BOOL16 WINAPI SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, LPSIZE16 prevSize )
3106 SIZE size32;
3107 BOOL ret = SetBitmapDimensionEx( HBITMAP_32(hbitmap), x, y, &size32 );
3109 if (ret && prevSize)
3111 prevSize->cx = size32.cx;
3112 prevSize->cy = size32.cy;
3114 return ret;
3118 /***********************************************************************
3119 * SetViewportExtEx (GDI.479)
3121 BOOL16 WINAPI SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
3123 SIZE size32;
3124 BOOL16 ret = SetViewportExtEx( HDC_32(hdc), x, y, &size32 );
3125 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
3126 return ret;
3130 /***********************************************************************
3131 * SetViewportOrgEx (GDI.480)
3133 BOOL16 WINAPI SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
3135 POINT pt32;
3136 BOOL16 ret = SetViewportOrgEx( HDC_32(hdc), x, y, &pt32 );
3137 if (pt)
3139 pt->x = pt32.x;
3140 pt->y = pt32.y;
3142 return ret;
3146 /***********************************************************************
3147 * SetWindowExtEx (GDI.481)
3149 BOOL16 WINAPI SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size )
3151 SIZE size32;
3152 BOOL16 ret = SetWindowExtEx( HDC_32(hdc), x, y, &size32 );
3153 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
3154 return ret;
3158 /***********************************************************************
3159 * SetWindowOrgEx (GDI.482)
3161 BOOL16 WINAPI SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
3163 POINT pt32;
3164 BOOL16 ret = SetWindowOrgEx( HDC_32(hdc), x, y, &pt32 );
3165 if (pt)
3167 pt->x = pt32.x;
3168 pt->y = pt32.y;
3170 return ret;
3174 /***********************************************************************
3175 * MoveToEx (GDI.483)
3177 BOOL16 WINAPI MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
3179 POINT pt32;
3181 if (!MoveToEx( HDC_32(hdc), x, y, &pt32 )) return FALSE;
3182 if (pt)
3184 pt->x = pt32.x;
3185 pt->y = pt32.y;
3187 return TRUE;
3191 /***********************************************************************
3192 * ScaleViewportExtEx (GDI.484)
3194 BOOL16 WINAPI ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
3195 INT16 yNum, INT16 yDenom, LPSIZE16 size )
3197 SIZE size32;
3198 BOOL16 ret = ScaleViewportExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
3199 &size32 );
3200 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
3201 return ret;
3205 /***********************************************************************
3206 * ScaleWindowExtEx (GDI.485)
3208 BOOL16 WINAPI ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom,
3209 INT16 yNum, INT16 yDenom, LPSIZE16 size )
3211 SIZE size32;
3212 BOOL16 ret = ScaleWindowExtEx( HDC_32(hdc), xNum, xDenom, yNum, yDenom,
3213 &size32 );
3214 if (size) { size->cx = size32.cx; size->cy = size32.cy; }
3215 return ret;
3219 /***********************************************************************
3220 * GetAspectRatioFilterEx (GDI.486)
3222 BOOL16 WINAPI GetAspectRatioFilterEx16( HDC16 hdc, LPSIZE16 pAspectRatio )
3224 FIXME("(%04x, %p): -- Empty Stub !\n", hdc, pAspectRatio);
3225 return FALSE;
3229 /******************************************************************************
3230 * PolyBezier (GDI.502)
3232 BOOL16 WINAPI PolyBezier16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
3234 int i;
3235 BOOL16 ret;
3236 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, cPoints*sizeof(POINT) );
3237 if(!pt32) return FALSE;
3238 for (i=cPoints;i--;)
3240 pt32[i].x = lppt[i].x;
3241 pt32[i].y = lppt[i].y;
3243 ret= PolyBezier(HDC_32(hdc), pt32, cPoints);
3244 HeapFree( GetProcessHeap(), 0, pt32 );
3245 return ret;
3249 /******************************************************************************
3250 * PolyBezierTo (GDI.503)
3252 BOOL16 WINAPI PolyBezierTo16( HDC16 hdc, const POINT16* lppt, INT16 cPoints )
3254 int i;
3255 BOOL16 ret;
3256 LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0,
3257 cPoints*sizeof(POINT) );
3258 if(!pt32) return FALSE;
3259 for (i=cPoints;i--;)
3261 pt32[i].x = lppt[i].x;
3262 pt32[i].y = lppt[i].y;
3264 ret= PolyBezierTo(HDC_32(hdc), pt32, cPoints);
3265 HeapFree( GetProcessHeap(), 0, pt32 );
3266 return ret;
3270 /******************************************************************************
3271 * ExtSelectClipRgn (GDI.508)
3273 INT16 WINAPI ExtSelectClipRgn16( HDC16 hdc, HRGN16 hrgn, INT16 fnMode )
3275 return ExtSelectClipRgn( HDC_32(hdc), HRGN_32(hrgn), fnMode);
3279 /***********************************************************************
3280 * AbortPath (GDI.511)
3282 BOOL16 WINAPI AbortPath16(HDC16 hdc)
3284 return AbortPath( HDC_32(hdc) );
3288 /***********************************************************************
3289 * BeginPath (GDI.512)
3291 BOOL16 WINAPI BeginPath16(HDC16 hdc)
3293 return BeginPath( HDC_32(hdc) );
3297 /***********************************************************************
3298 * CloseFigure (GDI.513)
3300 BOOL16 WINAPI CloseFigure16(HDC16 hdc)
3302 return CloseFigure( HDC_32(hdc) );
3306 /***********************************************************************
3307 * EndPath (GDI.514)
3309 BOOL16 WINAPI EndPath16(HDC16 hdc)
3311 return EndPath( HDC_32(hdc) );
3315 /***********************************************************************
3316 * FillPath (GDI.515)
3318 BOOL16 WINAPI FillPath16(HDC16 hdc)
3320 return FillPath( HDC_32(hdc) );
3324 /*******************************************************************
3325 * FlattenPath (GDI.516)
3327 BOOL16 WINAPI FlattenPath16(HDC16 hdc)
3329 return FlattenPath( HDC_32(hdc) );
3333 /***********************************************************************
3334 * GetPath (GDI.517)
3336 INT16 WINAPI GetPath16(HDC16 hdc, LPPOINT16 pPoints, LPBYTE pTypes, INT16 nSize)
3338 FIXME("(%d,%p,%p): stub\n",hdc,pPoints,pTypes);
3339 return 0;
3343 /***********************************************************************
3344 * PathToRegion (GDI.518)
3346 HRGN16 WINAPI PathToRegion16(HDC16 hdc)
3348 return HRGN_16( PathToRegion( HDC_32(hdc) ));
3352 /***********************************************************************
3353 * SelectClipPath (GDI.519)
3355 BOOL16 WINAPI SelectClipPath16(HDC16 hdc, INT16 iMode)
3357 return SelectClipPath( HDC_32(hdc), iMode );
3361 /*******************************************************************
3362 * StrokeAndFillPath (GDI.520)
3364 BOOL16 WINAPI StrokeAndFillPath16(HDC16 hdc)
3366 return StrokeAndFillPath( HDC_32(hdc) );
3370 /*******************************************************************
3371 * StrokePath (GDI.521)
3373 BOOL16 WINAPI StrokePath16(HDC16 hdc)
3375 return StrokePath( HDC_32(hdc) );
3379 /*******************************************************************
3380 * WidenPath (GDI.522)
3382 BOOL16 WINAPI WidenPath16(HDC16 hdc)
3384 return WidenPath( HDC_32(hdc) );
3388 /***********************************************************************
3389 * GetArcDirection (GDI.524)
3391 INT16 WINAPI GetArcDirection16( HDC16 hdc )
3393 return GetArcDirection( HDC_32(hdc) );
3397 /***********************************************************************
3398 * SetArcDirection (GDI.525)
3400 INT16 WINAPI SetArcDirection16( HDC16 hdc, INT16 nDirection )
3402 return SetArcDirection( HDC_32(hdc), (INT)nDirection );
3406 /***********************************************************************
3407 * CreateHalftonePalette (GDI.529)
3409 HPALETTE16 WINAPI CreateHalftonePalette16( HDC16 hdc )
3411 return HPALETTE_16( CreateHalftonePalette( HDC_32(hdc) ));
3415 /***********************************************************************
3416 * SetDIBColorTable (GDI.602)
3418 UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
3420 return SetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
3424 /***********************************************************************
3425 * GetDIBColorTable (GDI.603)
3427 UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries, RGBQUAD *colors )
3429 return GetDIBColorTable( HDC_32(hdc), startpos, entries, colors );
3433 /***********************************************************************
3434 * GetRegionData (GDI.607)
3436 * FIXME: is LPRGNDATA the same in Win16 and Win32 ?
3438 DWORD WINAPI GetRegionData16( HRGN16 hrgn, DWORD count, LPRGNDATA rgndata )
3440 return GetRegionData( HRGN_32(hrgn), count, rgndata );
3444 /***********************************************************************
3445 * GdiFreeResources (GDI.609)
3447 WORD WINAPI GdiFreeResources16( DWORD reserve )
3449 return 90; /* lie about it, it shouldn't matter */
3453 /***********************************************************************
3454 * GdiSignalProc32 (GDI.610)
3456 WORD WINAPI GdiSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
3457 DWORD dwFlags, HMODULE16 hModule )
3459 return 0;
3463 /***********************************************************************
3464 * GetTextCharset (GDI.612)
3466 UINT16 WINAPI GetTextCharset16( HDC16 hdc )
3468 return GetTextCharset( HDC_32(hdc) );
3472 /***********************************************************************
3473 * EnumFontFamiliesEx (GDI.613)
3475 INT16 WINAPI EnumFontFamiliesEx16( HDC16 hdc, LPLOGFONT16 plf,
3476 FONTENUMPROC16 proc, LPARAM lParam,
3477 DWORD dwFlags)
3479 struct callback16_info info;
3480 LOGFONTW lfW, *plfW;
3482 info.proc = (FARPROC16)proc;
3483 info.param = lParam;
3485 if (plf)
3487 logfont_16_to_W(plf, &lfW);
3488 plfW = &lfW;
3490 else plfW = NULL;
3492 return EnumFontFamiliesExW( HDC_32(hdc), plfW, enum_font_callback,
3493 (LPARAM)&info, dwFlags );
3497 /*************************************************************************
3498 * GetFontLanguageInfo (GDI.616)
3500 DWORD WINAPI GetFontLanguageInfo16( HDC16 hdc )
3502 return GetFontLanguageInfo( HDC_32(hdc) );
3506 /***********************************************************************
3507 * SetLayout (GDI.1000)
3509 * Sets left->right or right->left text layout flags of a dc.
3511 BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout )
3513 return SetLayout( HDC_32(hdc), layout );
3517 /***********************************************************************
3518 * SetSolidBrush (GDI.604)
3520 * Change the color of a solid brush.
3522 * PARAMS
3523 * hBrush [I] Brush to change the color of
3524 * newColor [I] New color for hBrush
3526 * RETURNS
3527 * Success: TRUE. The color of hBrush is set to newColor.
3528 * Failure: FALSE.
3530 * FIXME
3531 * This function is undocumented and untested. The implementation may
3532 * not be correct.
3534 BOOL16 WINAPI SetSolidBrush16(HBRUSH16 hBrush, COLORREF newColor )
3536 FIXME( "%04x %08lx no longer supported\n", hBrush, newColor );
3537 return FALSE;
3541 /***********************************************************************
3542 * Copy (GDI.250)
3544 void WINAPI Copy16( LPVOID src, LPVOID dst, WORD size )
3546 memcpy( dst, src, size );
3549 /***********************************************************************
3550 * RealizeDefaultPalette (GDI.365)
3552 UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc )
3554 FIXME( "%04x semi-stub\n", hdc );
3555 return GDIRealizePalette16( hdc );
3558 /***********************************************************************
3559 * IsDCCurrentPalette (GDI.412)
3561 BOOL16 WINAPI IsDCCurrentPalette16(HDC16 hDC)
3563 return HPALETTE_16( GetCurrentObject( HDC_32(hDC), OBJ_PAL )) == hPrimaryPalette;
3566 /*********************************************************************
3567 * SetMagicColors (GDI.606)
3569 VOID WINAPI SetMagicColors16(HDC16 hDC, COLORREF color, UINT16 index)
3571 FIXME("(hDC %04x, color %04x, index %04x): stub\n", hDC, (int)color, index);
3576 /***********************************************************************
3577 * DPtoLP (GDI.67)
3579 BOOL16 WINAPI DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count )
3581 POINT points32[8], *pt32 = points32;
3582 int i;
3583 BOOL ret;
3585 if (count > 8)
3587 if (!(pt32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pt32) ))) return FALSE;
3589 for (i = 0; i < count; i++)
3591 pt32[i].x = points[i].x;
3592 pt32[i].y = points[i].y;
3594 if ((ret = DPtoLP( HDC_32(hdc), pt32, count )))
3596 for (i = 0; i < count; i++)
3598 points[i].x = pt32[i].x;
3599 points[i].y = pt32[i].y;
3602 if (pt32 != points32) HeapFree( GetProcessHeap(), 0, pt32 );
3603 return ret;
3607 /***********************************************************************
3608 * LPtoDP (GDI.99)
3610 BOOL16 WINAPI LPtoDP16( HDC16 hdc, LPPOINT16 points, INT16 count )
3612 POINT points32[8], *pt32 = points32;
3613 int i;
3614 BOOL ret;
3616 if (count > 8)
3618 if (!(pt32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pt32) ))) return FALSE;
3620 for (i = 0; i < count; i++)
3622 pt32[i].x = points[i].x;
3623 pt32[i].y = points[i].y;
3625 if ((ret = LPtoDP( HDC_32(hdc), pt32, count )))
3627 for (i = 0; i < count; i++)
3629 points[i].x = pt32[i].x;
3630 points[i].y = pt32[i].y;
3633 if (pt32 != points32) HeapFree( GetProcessHeap(), 0, pt32 );
3634 return ret;
3638 /***********************************************************************
3639 * GetDCState (GDI.179)
3641 HDC16 WINAPI GetDCState16( HDC16 hdc )
3643 ERR( "no longer supported\n" );
3644 return 0;
3648 /***********************************************************************
3649 * SetDCState (GDI.180)
3651 void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
3653 ERR( "no longer supported\n" );
3656 /***********************************************************************
3657 * SetDCOrg (GDI.117)
3659 DWORD WINAPI SetDCOrg16( HDC16 hdc16, INT16 x, INT16 y )
3661 FIXME( "%04x %d,%d no longer supported\n", hdc16, x, y );
3662 return 0;
3666 /***********************************************************************
3667 * InquireVisRgn (GDI.131)
3669 HRGN16 WINAPI InquireVisRgn16( HDC16 hdc )
3671 static HRGN hrgn;
3673 if (!hrgn) hrgn = CreateRectRgn( 0, 0, 0, 0 );
3674 GetRandomRgn( HDC_32(hdc), hrgn, SYSRGN );
3675 return HRGN_16(hrgn);
3679 /***********************************************************************
3680 * OffsetVisRgn (GDI.102)
3682 INT16 WINAPI OffsetVisRgn16( HDC16 hdc16, INT16 x, INT16 y )
3684 FIXME( "%04x %d,%d no longer supported\n", hdc16, x, y );
3685 return ERROR;
3689 /***********************************************************************
3690 * ExcludeVisRect (GDI.73)
3692 INT16 WINAPI ExcludeVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom )
3694 FIXME( "%04x %d,%d-%d,%d no longer supported\n", hdc16, left, top, right, bottom );
3695 return ERROR;
3699 /***********************************************************************
3700 * IntersectVisRect (GDI.98)
3702 INT16 WINAPI IntersectVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom )
3704 FIXME( "%04x %d,%d-%d,%d no longer supported\n", hdc16, left, top, right, bottom );
3705 return ERROR;
3709 /***********************************************************************
3710 * SaveVisRgn (GDI.129)
3712 HRGN16 WINAPI SaveVisRgn16( HDC16 hdc16 )
3714 FIXME( "%04x no longer supported\n", hdc16 );
3715 return 0;
3719 /***********************************************************************
3720 * RestoreVisRgn (GDI.130)
3722 INT16 WINAPI RestoreVisRgn16( HDC16 hdc16 )
3724 FIXME( "%04x no longer supported\n", hdc16 );
3725 return ERROR;
3729 /***********************************************************************
3730 * GetClipRgn (GDI.173)
3732 HRGN16 WINAPI GetClipRgn16( HDC16 hdc )
3734 static HRGN hrgn;
3736 if (!hrgn) hrgn = CreateRectRgn( 0, 0, 0, 0 );
3737 GetClipRgn( HDC_32(hdc), hrgn );
3738 return HRGN_16(hrgn);
3742 /***********************************************************************
3743 * MakeObjectPrivate (GDI.463)
3745 * What does that mean ?
3746 * Some little docu can be found in "Undocumented Windows",
3747 * but this is basically useless.
3749 void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private )
3751 FIXME( "stub: %x %u\n", handle16, private );
3754 /***********************************************************************
3755 * CreateDIBSection (GDI.489)
3757 HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 usage,
3758 SEGPTR *bits16, HANDLE section, DWORD offset)
3760 LPVOID bits32;
3761 HBITMAP hbitmap;
3763 hbitmap = CreateDIBSection( HDC_32(hdc), bmi, usage, &bits32, section, offset );
3764 if (hbitmap && bits32 && bits16) *bits16 = alloc_segptr_bits( hbitmap, bits32 );
3765 return HBITMAP_16(hbitmap);