msi: Make TransformView_Create static.
[wine.git] / dlls / gdi32 / dc.c
blob368a38db788d1c84a8cb6f516a4b605a9edb5576
1 /*
2 * GDI Device Context functions
4 * Copyright 1993, 1994 Alexandre Julliard
5 * Copyright 1997 Bertho A. Stultiens
6 * 1999 Huw D M Davies
7 * Copyright 2021 Jacek Caban for CodeWeavers
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "gdi_private.h"
25 #include "ntuser.h"
26 #include "ddrawgdi.h"
27 #include "winnls.h"
29 #include "wine/list.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
34 static struct list drivers = LIST_INIT( drivers );
36 static CRITICAL_SECTION driver_section;
37 static CRITICAL_SECTION_DEBUG critsect_debug =
39 0, 0, &driver_section,
40 { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
41 0, 0, { (DWORD_PTR)(__FILE__ ": driver_section") }
43 static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };
45 typedef HDC (CDECL *driver_entry_point)( const WCHAR *device,
46 const DEVMODEW *devmode, const WCHAR *output );
48 struct graphics_driver
50 struct list entry;
51 HMODULE module; /* module handle */
52 driver_entry_point entry_point;
55 enum print_flags
57 CALL_START_PAGE = 0x1,
58 CALL_END_PAGE = 0x2,
59 WRITE_DEVMODE = 0x4,
60 BANDING = 0x8,
63 struct print
65 HANDLE printer;
66 WCHAR *output;
67 enum print_flags flags;
68 DEVMODEW *devmode;
71 DC_ATTR *get_dc_attr( HDC hdc )
73 DWORD type = gdi_handle_type( hdc );
74 DC_ATTR *dc_attr;
75 if ((type & 0x1f0000) != NTGDI_OBJ_DC || !(dc_attr = get_gdi_client_ptr( hdc, 0 )))
77 SetLastError( ERROR_INVALID_HANDLE );
78 return NULL;
80 return dc_attr->disabled ? NULL : dc_attr;
83 static BOOL is_display_device( const WCHAR *name )
85 const WCHAR *p = name;
87 if (!name)
88 return FALSE;
90 if (wcsnicmp( name, L"\\\\.\\DISPLAY", lstrlenW(L"\\\\.\\DISPLAY") )) return FALSE;
92 p += lstrlenW(L"\\\\.\\DISPLAY");
94 if (!iswdigit( *p++ ))
95 return FALSE;
97 for (; *p; p++)
99 if (!iswdigit( *p ))
100 return FALSE;
103 return TRUE;
106 static BOOL get_driver_name( const WCHAR *device, WCHAR *driver, DWORD size )
108 WCHAR *p;
110 /* display is a special case */
111 if (!wcsicmp( device, L"display" ) || is_display_device( device ))
113 lstrcpynW( driver, L"display", size );
114 return TRUE;
117 size = GetProfileStringW(L"devices", device, L"", driver, size);
118 if (!size)
120 WARN("Unable to find %s in [devices] section of win.ini\n", debugstr_w(device));
121 return FALSE;
123 p = wcschr(driver, ',');
124 if (!p)
126 WARN("%s entry in [devices] section of win.ini is malformed.\n", debugstr_w(device));
127 return FALSE;
129 *p = 0;
130 TRACE("Found %s for %s\n", debugstr_w(driver), debugstr_w(device));
131 return TRUE;
134 static struct graphics_driver *create_driver( HMODULE module )
136 struct graphics_driver *driver;
138 if (!(driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver)))) return NULL;
139 driver->module = module;
141 if (module)
142 driver->entry_point = (void *)GetProcAddress( module, "wine_driver_open_dc" );
143 else
144 driver->entry_point = NULL;
146 return driver;
149 #ifdef __i386__
150 static const WCHAR printer_env[] = L"w32x86";
151 #elif defined __x86_64__
152 static const WCHAR printer_env[] = L"x64";
153 #elif defined __arm__
154 static const WCHAR printer_env[] = L"arm";
155 #elif defined __aarch64__
156 static const WCHAR printer_env[] = L"arm64";
157 #else
158 #error not defined for this cpu
159 #endif
161 static driver_entry_point load_driver( LPCWSTR name )
163 HMODULE module;
164 struct graphics_driver *driver, *new_driver;
166 if ((module = GetModuleHandleW( name )))
168 EnterCriticalSection( &driver_section );
169 LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
171 if (driver->module == module) goto done;
173 LeaveCriticalSection( &driver_section );
176 if (!(module = LoadLibraryW( name )))
178 WCHAR path[MAX_PATH];
180 GetSystemDirectoryW( path, MAX_PATH );
181 swprintf( path + wcslen(path), MAX_PATH - wcslen(path), L"\\spool\\drivers\\%s\\3\\%s",
182 printer_env, name );
183 if (!(module = LoadLibraryW( path ))) return NULL;
186 if (!(new_driver = create_driver( module )))
188 FreeLibrary( module );
189 return NULL;
192 /* check if someone else added it in the meantime */
193 EnterCriticalSection( &driver_section );
194 LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
196 if (driver->module != module) continue;
197 FreeLibrary( module );
198 HeapFree( GetProcessHeap(), 0, new_driver );
199 goto done;
201 driver = new_driver;
202 list_add_head( &drivers, &driver->entry );
203 TRACE( "loaded driver %p for %s\n", driver, debugstr_w(name) );
204 done:
205 LeaveCriticalSection( &driver_section );
206 return driver->entry_point;
209 static BOOL print_copy_devmode( struct print *print, const DEVMODEW *devmode )
211 size_t size;
213 if (!print) return TRUE;
214 if (!print->devmode && !devmode) return TRUE;
215 HeapFree( GetProcessHeap(), 0, print->devmode );
217 if (!devmode)
219 print->devmode = NULL;
220 print->flags |= WRITE_DEVMODE;
221 return TRUE;
224 size = devmode->dmSize + devmode->dmDriverExtra;
225 print->devmode = HeapAlloc( GetProcessHeap(), 0, size );
226 if (!print->devmode) return FALSE;
227 memcpy(print->devmode, devmode, size);
228 print->flags |= WRITE_DEVMODE;
229 return TRUE;
232 /***********************************************************************
233 * CreateDCW (GDI32.@)
235 HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
236 const DEVMODEW *devmode )
238 UNICODE_STRING device_str, output_str;
239 driver_entry_point entry_point = NULL;
240 const WCHAR *display = NULL, *p;
241 WCHAR buf[300], *port = NULL;
242 struct print *print = NULL;
243 BOOL is_display = FALSE;
244 HANDLE hspool = NULL;
245 DC_ATTR *dc_attr;
246 HDC ret;
248 if (!device || !get_driver_name( device, buf, 300 ))
250 if (!driver)
252 ERR( "no device found for %s\n", debugstr_w(device) );
253 return 0;
255 lstrcpyW(buf, driver);
258 if (output)
260 output_str.Length = output_str.MaximumLength = lstrlenW(output) * sizeof(WCHAR);
261 output_str.Buffer = (WCHAR *)output;
264 if (is_display_device( driver ))
266 display = driver;
267 is_display = TRUE;
269 else if (is_display_device( device ))
271 display = device;
272 is_display = TRUE;
274 else if (!wcsicmp( buf, L"display" ) || is_display_device( buf ))
276 is_display = TRUE;
278 else if (!(entry_point = load_driver( buf )))
280 ERR( "no driver found for %s\n", debugstr_w(buf) );
281 return 0;
283 else if (!OpenPrinterW( (WCHAR *)device, &hspool, NULL ))
285 return 0;
287 else if (output && !(port = HeapAlloc( GetProcessHeap(), 0, output_str.Length + sizeof(WCHAR) )))
289 ClosePrinter( hspool );
290 return 0;
292 else if (!(print = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*print) )) ||
293 !print_copy_devmode( print, devmode ))
295 HeapFree( GetProcessHeap(), 0, print );
296 ClosePrinter( hspool );
297 HeapFree( GetProcessHeap(), 0, port );
298 return 0;
301 if (display)
303 /* Use only the display name. For example, \\.\DISPLAY1 in \\.\DISPLAY1\Monitor0 */
304 p = display + 12;
305 while (iswdigit( *p )) p++;
307 device_str.Length = device_str.MaximumLength = (p - display) * sizeof(WCHAR);
308 device_str.Buffer = (WCHAR *)display;
310 else if (device)
312 device_str.Length = device_str.MaximumLength = lstrlenW( device ) * sizeof(WCHAR);
313 device_str.Buffer = (WCHAR *)device;
316 if (entry_point)
317 ret = entry_point( device, devmode, output );
318 else
319 ret = NtGdiOpenDCW( device || display ? &device_str : NULL, devmode,
320 output ? &output_str : NULL,
321 0, is_display, entry_point, NULL, NULL );
323 if (ret && hspool && (dc_attr = get_dc_attr( ret )))
325 if (port)
327 memcpy( port, output, output_str.Length );
328 port[output_str.Length / sizeof(WCHAR)] = 0;
330 print->printer = hspool;
331 print->output = port;
332 dc_attr->print = (UINT_PTR)print;
334 else if (hspool)
336 ClosePrinter( hspool );
337 HeapFree( GetProcessHeap(), 0, port );
338 HeapFree( GetProcessHeap(), 0, print->devmode );
339 HeapFree( GetProcessHeap(), 0, print );
342 return ret;
345 /***********************************************************************
346 * CreateDCA (GDI32.@)
348 HDC WINAPI CreateDCA( const char *driver, const char *device, const char *output,
349 const DEVMODEA *init_data )
351 UNICODE_STRING driverW, deviceW, outputW;
352 DEVMODEW *init_dataW = NULL;
353 HDC ret;
355 if (driver) RtlCreateUnicodeStringFromAsciiz( &driverW, driver );
356 else driverW.Buffer = NULL;
358 if (device) RtlCreateUnicodeStringFromAsciiz( &deviceW, device );
359 else deviceW.Buffer = NULL;
361 if (output) RtlCreateUnicodeStringFromAsciiz( &outputW, output );
362 else outputW.Buffer = NULL;
364 if (init_data)
366 /* don't convert init_data for DISPLAY driver, it's not used */
367 if (!driverW.Buffer || wcsicmp( driverW.Buffer, L"display" ))
368 init_dataW = GdiConvertToDevmodeW( init_data );
371 ret = CreateDCW( driverW.Buffer, deviceW.Buffer, outputW.Buffer, init_dataW );
373 RtlFreeUnicodeString( &driverW );
374 RtlFreeUnicodeString( &deviceW );
375 RtlFreeUnicodeString( &outputW );
376 HeapFree( GetProcessHeap(), 0, init_dataW );
377 return ret;
380 /***********************************************************************
381 * CreateICA (GDI32.@)
383 HDC WINAPI CreateICA( const char *driver, const char *device, const char *output,
384 const DEVMODEA *init_data )
386 /* Nothing special yet for ICs */
387 return CreateDCA( driver, device, output, init_data );
391 /***********************************************************************
392 * CreateICW (GDI32.@)
394 HDC WINAPI CreateICW( const WCHAR *driver, const WCHAR *device, const WCHAR *output,
395 const DEVMODEW *init_data )
397 /* Nothing special yet for ICs */
398 return CreateDCW( driver, device, output, init_data );
401 /***********************************************************************
402 * GdiConvertToDevmodeW (GDI32.@)
404 DEVMODEW *WINAPI GdiConvertToDevmodeW( const DEVMODEA *dmA )
406 DEVMODEW *dmW;
407 WORD dmW_size, dmA_size;
409 dmA_size = dmA->dmSize;
411 /* this is the minimal dmSize that XP accepts */
412 if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
413 return NULL;
415 if (dmA_size > sizeof(DEVMODEA))
416 dmA_size = sizeof(DEVMODEA);
418 dmW_size = dmA_size + CCHDEVICENAME;
419 if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
420 dmW_size += CCHFORMNAME;
422 dmW = HeapAlloc( GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra );
423 if (!dmW) return NULL;
425 MultiByteToWideChar( CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
426 dmW->dmDeviceName, CCHDEVICENAME );
427 /* copy slightly more, to avoid long computations */
428 memcpy( &dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME );
430 if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
432 if (dmA->dmFields & DM_FORMNAME)
433 MultiByteToWideChar( CP_ACP, 0, (const char*) dmA->dmFormName, -1,
434 dmW->dmFormName, CCHFORMNAME );
435 else
436 dmW->dmFormName[0] = 0;
438 if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
439 memcpy( &dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels) );
442 if (dmA->dmDriverExtra)
443 memcpy( (char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra );
445 dmW->dmSize = dmW_size;
447 return dmW;
450 static inline struct print *get_dc_print( DC_ATTR *dc_attr )
452 return (struct print *)(UINT_PTR)dc_attr->print;
455 void print_call_start_page( DC_ATTR *dc_attr )
457 struct print *print = get_dc_print( dc_attr );
459 if (print->flags & CALL_START_PAGE) StartPage( UlongToHandle(dc_attr->hdc) );
462 static void delete_print_dc( DC_ATTR *dc_attr )
464 struct print *print = get_dc_print( dc_attr );
466 ClosePrinter( print->printer );
467 HeapFree( GetProcessHeap(), 0, print->output );
468 HeapFree( GetProcessHeap(), 0, print->devmode );
469 HeapFree( GetProcessHeap(), 0, print );
470 dc_attr->print = 0;
473 /***********************************************************************
474 * DeleteDC (GDI32.@)
476 BOOL WINAPI DeleteDC( HDC hdc )
478 DC_ATTR *dc_attr;
480 if (is_meta_dc( hdc )) return METADC_DeleteDC( hdc );
481 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
482 if (dc_attr->print)
484 if (dc_attr->emf)
485 AbortDoc( hdc );
486 delete_print_dc( dc_attr );
488 if (dc_attr->emf) EMFDC_DeleteDC( dc_attr );
489 return NtGdiDeleteObjectApp( hdc );
492 /***********************************************************************
493 * ResetDCA (GDI32.@)
495 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
497 DEVMODEW *devmodeW;
498 HDC ret;
500 if (devmode) devmodeW = GdiConvertToDevmodeW( devmode );
501 else devmodeW = NULL;
503 ret = ResetDCW( hdc, devmodeW );
505 HeapFree( GetProcessHeap(), 0, devmodeW );
506 return ret;
509 /***********************************************************************
510 * ResetDCW (GDI32.@)
512 HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
514 struct print *print;
515 DC_ATTR *dc_attr;
517 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
518 print = get_dc_print( dc_attr );
519 if (print && print->flags & CALL_END_PAGE) return 0;
520 if (!NtGdiResetDC( hdc, devmode, NULL, NULL, NULL )) return 0;
521 if (print && !print_copy_devmode( print, devmode )) return 0;
522 return hdc;
525 /***********************************************************************
526 * SaveDC (GDI32.@)
528 INT WINAPI SaveDC( HDC hdc )
530 DC_ATTR *dc_attr;
532 if (is_meta_dc( hdc )) return METADC_SaveDC( hdc );
533 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
534 if (dc_attr->emf && !EMFDC_SaveDC( dc_attr )) return FALSE;
535 return NtGdiSaveDC( hdc );
538 /***********************************************************************
539 * RestoreDC (GDI32.@)
541 BOOL WINAPI RestoreDC( HDC hdc, INT level )
543 DC_ATTR *dc_attr;
545 if (is_meta_dc( hdc )) return METADC_RestoreDC( hdc, level );
546 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
547 if (dc_attr->emf && !EMFDC_RestoreDC( dc_attr, level )) return FALSE;
548 return NtGdiRestoreDC( hdc, level );
551 /***********************************************************************
552 * GetDeviceCaps (GDI32.@)
554 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
556 if (is_meta_dc( hdc )) return METADC_GetDeviceCaps( hdc, cap );
557 if (!get_dc_attr( hdc )) return FALSE;
558 return NtGdiGetDeviceCaps( hdc, cap );
561 /***********************************************************************
562 * Escape (GDI32.@)
564 INT WINAPI Escape( HDC hdc, INT escape, INT in_count, const char *in_data, void *out_data )
566 INT ret;
567 POINT *pt;
569 switch (escape)
571 case ABORTDOC:
572 return AbortDoc( hdc );
574 case NEXTBAND:
576 RECT *rect = out_data;
577 struct print *print;
578 DC_ATTR *dc_attr;
580 if (!(dc_attr = get_dc_attr( hdc )) || !(print = get_dc_print( dc_attr ))) break;
581 if (print->flags & BANDING)
583 print->flags &= ~BANDING;
584 SetRectEmpty( rect );
585 return EndPage( hdc );
587 print->flags |= BANDING;
588 SetRect( rect, 0, 0, GetDeviceCaps(hdc, HORZRES), GetDeviceCaps(hdc, VERTRES) );
589 return 1;
592 case ENDDOC:
593 return EndDoc( hdc );
595 case GETPHYSPAGESIZE:
596 pt = out_data;
597 pt->x = GetDeviceCaps( hdc, PHYSICALWIDTH );
598 pt->y = GetDeviceCaps( hdc, PHYSICALHEIGHT );
599 return 1;
601 case GETPRINTINGOFFSET:
602 pt = out_data;
603 pt->x = GetDeviceCaps( hdc, PHYSICALOFFSETX );
604 pt->y = GetDeviceCaps( hdc, PHYSICALOFFSETY );
605 return 1;
607 case GETSCALINGFACTOR:
608 pt = out_data;
609 pt->x = GetDeviceCaps( hdc, SCALINGFACTORX );
610 pt->y = GetDeviceCaps( hdc, SCALINGFACTORY );
611 return 1;
613 case NEWFRAME:
614 return EndPage( hdc );
616 case SETABORTPROC:
617 return SetAbortProc( hdc, (ABORTPROC)in_data );
619 case STARTDOC:
621 DOCINFOA doc;
622 char *name = NULL;
624 /* in_data may not be 0 terminated so we must copy it */
625 if (in_data)
627 name = HeapAlloc( GetProcessHeap(), 0, in_count+1 );
628 memcpy( name, in_data, in_count );
629 name[in_count] = 0;
631 /* out_data is actually a pointer to the DocInfo structure and used as
632 * a second input parameter */
633 if (out_data) doc = *(DOCINFOA *)out_data;
634 else
636 doc.cbSize = sizeof(doc);
637 doc.lpszOutput = NULL;
638 doc.lpszDatatype = NULL;
639 doc.fwType = 0;
641 doc.lpszDocName = name;
642 ret = StartDocA( hdc, &doc );
643 HeapFree( GetProcessHeap(), 0, name );
644 if (ret > 0) ret = StartPage( hdc );
645 return ret;
648 case QUERYESCSUPPORT:
650 DWORD code;
652 if (in_count < sizeof(SHORT)) return 0;
653 code = (in_count < sizeof(DWORD)) ? *(const USHORT *)in_data : *(const DWORD *)in_data;
654 switch (code)
656 case ABORTDOC:
657 case ENDDOC:
658 case GETPHYSPAGESIZE:
659 case GETPRINTINGOFFSET:
660 case GETSCALINGFACTOR:
661 case NEWFRAME:
662 case QUERYESCSUPPORT:
663 case SETABORTPROC:
664 case STARTDOC:
665 return TRUE;
667 break;
670 case PASSTHROUGH:
671 case POSTSCRIPT_PASSTHROUGH:
672 in_count = *(const WORD *)in_data + sizeof(WORD);
673 out_data = NULL;
674 break;
677 /* if not handled internally, pass it to the driver */
678 return ExtEscape( hdc, escape, in_count, in_data, 0, out_data );
681 /***********************************************************************
682 * ExtEscape [GDI32.@]
684 INT WINAPI ExtEscape( HDC hdc, INT escape, INT input_size, const char *input,
685 INT output_size, char *output )
687 struct print *print;
688 DC_ATTR *dc_attr;
690 if (is_meta_dc( hdc ))
691 return METADC_ExtEscape( hdc, escape, input_size, input, output_size, output );
692 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
693 if ((print = get_dc_print( dc_attr )) && dc_attr->emf)
695 int ret = EMFDC_ExtEscape( dc_attr, escape, input_size, input, output_size, output );
696 if (ret) return ret;
698 return NtGdiExtEscape( hdc, NULL, 0, escape, input_size, input, output_size, output );
701 /***********************************************************************
702 * GetTextAlign (GDI32.@)
704 UINT WINAPI GetTextAlign( HDC hdc )
706 DC_ATTR *dc_attr = get_dc_attr( hdc );
707 return dc_attr ? dc_attr->text_align : 0;
710 /***********************************************************************
711 * SetTextAlign (GDI32.@)
713 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
715 DC_ATTR *dc_attr;
716 UINT ret;
718 TRACE("hdc=%p align=%d\n", hdc, align);
720 if (is_meta_dc( hdc )) return METADC_SetTextAlign( hdc, align );
721 if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
722 if (dc_attr->emf && !EMFDC_SetTextAlign( dc_attr, align )) return GDI_ERROR;
724 ret = dc_attr->text_align;
725 dc_attr->text_align = align;
726 return ret;
729 /***********************************************************************
730 * GetBkColor (GDI32.@)
732 COLORREF WINAPI GetBkColor( HDC hdc )
734 DC_ATTR *dc_attr = get_dc_attr( hdc );
735 return dc_attr ? dc_attr->background_color : CLR_INVALID;
738 /***********************************************************************
739 * SetBkColor (GDI32.@)
741 COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
743 DC_ATTR *dc_attr;
744 COLORREF ret;
746 if (is_meta_dc( hdc )) return METADC_SetBkColor( hdc, color );
747 if (!(dc_attr = get_dc_attr( hdc ))) return CLR_INVALID;
748 if (dc_attr->emf && !EMFDC_SetBkColor( dc_attr, color )) return CLR_INVALID;
749 return NtGdiGetAndSetDCDword( hdc, NtGdiSetBkColor, color, &ret ) ? ret : CLR_INVALID;
752 /***********************************************************************
753 * GetDCBrushColor (GDI32.@)
755 COLORREF WINAPI GetDCBrushColor( HDC hdc )
757 DC_ATTR *dc_attr = get_dc_attr( hdc );
758 return dc_attr ? dc_attr->brush_color : CLR_INVALID;
761 /***********************************************************************
762 * SetDCBrushColor (GDI32.@)
764 COLORREF WINAPI SetDCBrushColor( HDC hdc, COLORREF color )
766 DC_ATTR *dc_attr;
767 COLORREF ret;
769 if (!(dc_attr = get_dc_attr( hdc ))) return CLR_INVALID;
770 if (dc_attr->emf && !EMFDC_SetDCBrushColor( dc_attr, color )) return CLR_INVALID;
771 return NtGdiGetAndSetDCDword( hdc, NtGdiSetDCBrushColor, color, &ret ) ? ret : CLR_INVALID;
774 /***********************************************************************
775 * GetDCPenColor (GDI32.@)
777 COLORREF WINAPI GetDCPenColor(HDC hdc)
779 DC_ATTR *dc_attr = get_dc_attr( hdc );
780 return dc_attr ? dc_attr->pen_color : CLR_INVALID;
783 /***********************************************************************
784 * SetDCPenColor (GDI32.@)
786 COLORREF WINAPI SetDCPenColor( HDC hdc, COLORREF color )
788 DC_ATTR *dc_attr;
789 COLORREF ret;
791 if (!(dc_attr = get_dc_attr( hdc ))) return CLR_INVALID;
792 if (dc_attr->emf && !EMFDC_SetDCPenColor( dc_attr, color )) return CLR_INVALID;
793 return NtGdiGetAndSetDCDword( hdc, NtGdiSetDCPenColor, color, &ret ) ? ret : CLR_INVALID;
796 /***********************************************************************
797 * GetTextColor (GDI32.@)
799 COLORREF WINAPI GetTextColor( HDC hdc )
801 DC_ATTR *dc_attr = get_dc_attr( hdc );
802 return dc_attr ? dc_attr->text_color : 0;
805 /***********************************************************************
806 * SetTextColor (GDI32.@)
808 COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
810 DC_ATTR *dc_attr;
811 COLORREF ret;
813 if (is_meta_dc( hdc )) return METADC_SetTextColor( hdc, color );
814 if (!(dc_attr = get_dc_attr( hdc ))) return CLR_INVALID;
815 if (dc_attr->emf && !EMFDC_SetTextColor( dc_attr, color )) return CLR_INVALID;
816 return NtGdiGetAndSetDCDword( hdc, NtGdiSetTextColor, color, &ret ) ? ret : CLR_INVALID;
819 /***********************************************************************
820 * GetBkMode (GDI32.@)
822 INT WINAPI GetBkMode( HDC hdc )
824 DC_ATTR *dc_attr = get_dc_attr( hdc );
825 return dc_attr ? dc_attr->background_mode : 0;
828 /***********************************************************************
829 * SetBkMode (GDI32.@)
831 INT WINAPI SetBkMode( HDC hdc, INT mode )
833 DC_ATTR *dc_attr;
834 INT ret;
836 if (mode <= 0 || mode > BKMODE_LAST)
838 SetLastError(ERROR_INVALID_PARAMETER);
839 return 0;
842 if (is_meta_dc( hdc )) return METADC_SetBkMode( hdc, mode );
843 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
844 if (dc_attr->emf && !EMFDC_SetBkMode( dc_attr, mode )) return 0;
846 ret = dc_attr->background_mode;
847 dc_attr->background_mode = mode;
848 return ret;
851 /***********************************************************************
852 * GetGraphicsMode (GDI32.@)
854 INT WINAPI GetGraphicsMode( HDC hdc )
856 DC_ATTR *dc_attr = get_dc_attr( hdc );
857 return dc_attr ? dc_attr->graphics_mode : 0;
860 /***********************************************************************
861 * SetGraphicsMode (GDI32.@)
863 INT WINAPI SetGraphicsMode( HDC hdc, INT mode )
865 DWORD ret;
866 return NtGdiGetAndSetDCDword( hdc, NtGdiSetGraphicsMode, mode, &ret ) ? ret : 0;
869 /***********************************************************************
870 * GetArcDirection (GDI32.@)
872 INT WINAPI GetArcDirection( HDC hdc )
874 DC_ATTR *dc_attr = get_dc_attr( hdc );
875 return dc_attr ? dc_attr->arc_direction : 0;
878 /***********************************************************************
879 * SetArcDirection (GDI32.@)
881 INT WINAPI SetArcDirection( HDC hdc, INT dir )
883 DC_ATTR *dc_attr;
884 INT ret;
886 if (dir != AD_COUNTERCLOCKWISE && dir != AD_CLOCKWISE)
888 SetLastError(ERROR_INVALID_PARAMETER);
889 return 0;
892 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
893 if (dc_attr->emf && !EMFDC_SetArcDirection( dc_attr, dir )) return 0;
895 ret = dc_attr->arc_direction;
896 dc_attr->arc_direction = dir;
897 return ret;
900 /***********************************************************************
901 * GetLayout (GDI32.@)
903 DWORD WINAPI GetLayout( HDC hdc )
905 DC_ATTR *dc_attr = get_dc_attr( hdc );
906 return dc_attr ? dc_attr->layout : GDI_ERROR;
909 /***********************************************************************
910 * SetLayout (GDI32.@)
912 DWORD WINAPI SetLayout( HDC hdc, DWORD layout )
914 DC_ATTR *dc_attr;
916 if (is_meta_dc( hdc )) return METADC_SetLayout( hdc, layout );
917 if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
918 if (dc_attr->emf && !EMFDC_SetLayout( dc_attr, layout )) return GDI_ERROR;
919 return NtGdiSetLayout( hdc, -1, layout );
922 /***********************************************************************
923 * GetMapMode (GDI32.@)
925 INT WINAPI GetMapMode( HDC hdc )
927 DC_ATTR *dc_attr = get_dc_attr( hdc );
928 return dc_attr ? dc_attr->map_mode : 0;
931 /***********************************************************************
932 * SetMapMode (GDI32.@)
934 INT WINAPI SetMapMode( HDC hdc, INT mode )
936 DC_ATTR *dc_attr;
937 DWORD ret;
939 TRACE("%p %d\n", hdc, mode );
941 if (is_meta_dc( hdc )) return METADC_SetMapMode( hdc, mode );
942 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
943 if (dc_attr->emf && !EMFDC_SetMapMode( dc_attr, mode )) return 0;
944 return NtGdiGetAndSetDCDword( hdc, NtGdiSetMapMode, mode, &ret ) ? ret : 0;
947 /***********************************************************************
948 * GetTextCharacterExtra (GDI32.@)
950 INT WINAPI GetTextCharacterExtra( HDC hdc )
952 DC_ATTR *dc_attr = get_dc_attr( hdc );
953 return dc_attr ? dc_attr->char_extra : 0x80000000;
956 /***********************************************************************
957 * SetTextCharacterExtra (GDI32.@)
959 INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
961 DC_ATTR *dc_attr;
962 INT ret;
964 if (is_meta_dc( hdc )) return METADC_SetTextCharacterExtra( hdc, extra );
965 if (!(dc_attr = get_dc_attr( hdc ))) return 0x8000000;
966 ret = dc_attr->char_extra;
967 dc_attr->char_extra = extra;
968 return ret;
971 /***********************************************************************
972 * SetMapperFlags (GDI32.@)
974 DWORD WINAPI SetMapperFlags( HDC hdc, DWORD flags )
976 DC_ATTR *dc_attr;
977 DWORD ret;
979 if (is_meta_dc( hdc )) return METADC_SetMapperFlags( hdc, flags );
980 if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
981 if (dc_attr->emf && !EMFDC_SetMapperFlags( dc_attr, flags )) return GDI_ERROR;
982 ret = dc_attr->mapper_flags;
983 dc_attr->mapper_flags = flags;
984 return ret;
987 /***********************************************************************
988 * GetPolyFillMode (GDI32.@)
990 INT WINAPI GetPolyFillMode( HDC hdc )
992 DC_ATTR *dc_attr = get_dc_attr( hdc );
993 return dc_attr ? dc_attr->poly_fill_mode : 0;
996 /***********************************************************************
997 * SetPolyFillMode (GDI32.@)
999 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
1001 DC_ATTR *dc_attr;
1002 INT ret;
1004 if (mode <= 0 || mode > POLYFILL_LAST)
1006 SetLastError(ERROR_INVALID_PARAMETER);
1007 return 0;
1010 if (is_meta_dc( hdc )) return METADC_SetPolyFillMode( hdc, mode );
1011 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
1012 if (dc_attr->emf && !EMFDC_SetPolyFillMode( dc_attr, mode )) return 0;
1014 ret = dc_attr->poly_fill_mode;
1015 dc_attr->poly_fill_mode = mode;
1016 return ret;
1019 /***********************************************************************
1020 * GetStretchBltMode (GDI32.@)
1022 INT WINAPI GetStretchBltMode( HDC hdc )
1024 DC_ATTR *dc_attr = get_dc_attr( hdc );
1025 return dc_attr ? dc_attr->stretch_blt_mode : 0;
1028 /***********************************************************************
1029 * GetBrushOrgEx (GDI32.@)
1031 BOOL WINAPI GetBrushOrgEx( HDC hdc, POINT *point )
1033 DC_ATTR *dc_attr;
1034 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1035 *point = dc_attr->brush_org;
1036 return TRUE;
1039 /***********************************************************************
1040 * SetBrushOrgEx (GDI32.@)
1042 BOOL WINAPI SetBrushOrgEx( HDC hdc, INT x, INT y, POINT *oldorg )
1044 DC_ATTR *dc_attr;
1045 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1046 if (oldorg) *oldorg = dc_attr->brush_org;
1047 dc_attr->brush_org.x = x;
1048 dc_attr->brush_org.y = y;
1049 return TRUE;
1052 /***********************************************************************
1053 * FixBrushOrgEx (GDI32.@)
1055 BOOL WINAPI FixBrushOrgEx( HDC hdc, INT x, INT y, POINT *oldorg )
1057 return SetBrushOrgEx( hdc, x, y, oldorg );
1060 /***********************************************************************
1061 * GetDCOrgEx (GDI32.@)
1063 BOOL WINAPI GetDCOrgEx( HDC hdc, POINT *point )
1065 DC_ATTR *dc_attr;
1066 if (!point || !(dc_attr = get_dc_attr( hdc ))) return FALSE;
1067 point->x = dc_attr->vis_rect.left;
1068 point->y = dc_attr->vis_rect.top;
1069 return TRUE;
1072 /***********************************************************************
1073 * GetWindowExtEx (GDI32.@)
1075 BOOL WINAPI GetWindowExtEx( HDC hdc, SIZE *size )
1077 DC_ATTR *dc_attr;
1078 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1079 *size = dc_attr->wnd_ext;
1080 return TRUE;
1083 /***********************************************************************
1084 * SetWindowExtEx (GDI32.@)
1086 BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, SIZE *size )
1088 DC_ATTR *dc_attr;
1090 if (is_meta_dc( hdc )) return METADC_SetWindowExtEx( hdc, x, y );
1091 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1092 if (dc_attr->emf && !EMFDC_SetWindowExtEx( dc_attr, x, y )) return FALSE;
1094 if (size) *size = dc_attr->wnd_ext;
1095 if (dc_attr->map_mode != MM_ISOTROPIC && dc_attr->map_mode != MM_ANISOTROPIC) return TRUE;
1096 if (!x || !y) return FALSE;
1097 dc_attr->wnd_ext.cx = x;
1098 dc_attr->wnd_ext.cy = y;
1099 return NtGdiComputeXformCoefficients( hdc );
1102 /***********************************************************************
1103 * GetWindowOrgEx (GDI32.@)
1105 BOOL WINAPI GetWindowOrgEx( HDC hdc, POINT *point )
1107 DC_ATTR *dc_attr;
1108 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1109 *point = dc_attr->wnd_org;
1110 return TRUE;
1113 /***********************************************************************
1114 * SetWindowOrgEx (GDI32.@)
1116 BOOL WINAPI SetWindowOrgEx( HDC hdc, INT x, INT y, POINT *point )
1118 DC_ATTR *dc_attr;
1120 if (is_meta_dc( hdc )) return METADC_SetWindowOrgEx( hdc, x, y );
1121 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1122 if (dc_attr->emf && !EMFDC_SetWindowOrgEx( dc_attr, x, y )) return FALSE;
1124 if (point) *point = dc_attr->wnd_org;
1125 dc_attr->wnd_org.x = x;
1126 dc_attr->wnd_org.y = y;
1127 return NtGdiComputeXformCoefficients( hdc );
1130 /***********************************************************************
1131 * OffsetWindowOrgEx (GDI32.@)
1133 BOOL WINAPI OffsetWindowOrgEx( HDC hdc, INT x, INT y, POINT *point )
1135 DC_ATTR *dc_attr;
1137 if (is_meta_dc( hdc )) return METADC_OffsetWindowOrgEx( hdc, x, y );
1138 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1139 if (point) *point = dc_attr->wnd_org;
1140 dc_attr->wnd_org.x += x;
1141 dc_attr->wnd_org.y += y;
1142 if (dc_attr->emf && !EMFDC_SetWindowOrgEx( dc_attr, dc_attr->wnd_org.x,
1143 dc_attr->wnd_org.y )) return FALSE;
1144 return NtGdiComputeXformCoefficients( hdc );
1147 /***********************************************************************
1148 * GetViewportExtEx (GDI32.@)
1150 BOOL WINAPI GetViewportExtEx( HDC hdc, SIZE *size )
1152 DC_ATTR *dc_attr;
1153 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1154 *size = dc_attr->vport_ext;
1155 return TRUE;
1158 /***********************************************************************
1159 * SetViewportExtEx (GDI32.@)
1161 BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size )
1163 DC_ATTR *dc_attr;
1165 if (is_meta_dc( hdc )) return METADC_SetViewportExtEx( hdc, x, y );
1166 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1167 if (dc_attr->emf && !EMFDC_SetViewportExtEx( dc_attr, x, y )) return FALSE;
1169 if (size) *size = dc_attr->vport_ext;
1170 if (dc_attr->map_mode != MM_ISOTROPIC && dc_attr->map_mode != MM_ANISOTROPIC) return TRUE;
1171 if (!x || !y) return FALSE;
1172 dc_attr->vport_ext.cx = x;
1173 dc_attr->vport_ext.cy = y;
1174 return NtGdiComputeXformCoefficients( hdc );
1177 /***********************************************************************
1178 * GetViewportOrgEx (GDI32.@)
1180 BOOL WINAPI GetViewportOrgEx( HDC hdc, POINT *point )
1182 DC_ATTR *dc_attr;
1183 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1184 *point = dc_attr->vport_org;
1185 return TRUE;
1188 /***********************************************************************
1189 * SetViewportOrgEx (GDI32.@)
1191 BOOL WINAPI SetViewportOrgEx( HDC hdc, INT x, INT y, POINT *point )
1193 DC_ATTR *dc_attr;
1195 if (is_meta_dc( hdc )) return METADC_SetViewportOrgEx( hdc, x, y );
1196 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1197 if (dc_attr->emf && !EMFDC_SetViewportOrgEx( dc_attr, x, y )) return FALSE;
1199 if (point) *point = dc_attr->vport_org;
1200 dc_attr->vport_org.x = x;
1201 dc_attr->vport_org.y = y;
1202 return NtGdiComputeXformCoefficients( hdc );
1205 /***********************************************************************
1206 * OffsetViewportOrgEx (GDI32.@)
1208 BOOL WINAPI OffsetViewportOrgEx( HDC hdc, INT x, INT y, POINT *point )
1210 DC_ATTR *dc_attr;
1212 if (is_meta_dc( hdc )) return METADC_OffsetViewportOrgEx( hdc, x, y );
1213 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1214 if (point) *point = dc_attr->vport_org;
1215 dc_attr->vport_org.x += x;
1216 dc_attr->vport_org.y += y;
1217 if (dc_attr->emf && !EMFDC_SetViewportOrgEx( dc_attr, dc_attr->vport_org.x,
1218 dc_attr->vport_org.y )) return FALSE;
1219 return NtGdiComputeXformCoefficients( hdc );
1222 /***********************************************************************
1223 * GetWorldTransform (GDI32.@)
1225 BOOL WINAPI GetWorldTransform( HDC hdc, XFORM *xform )
1227 return NtGdiGetTransform( hdc, 0x203, xform );
1230 /****************************************************************************
1231 * ModifyWorldTransform (GDI32.@)
1233 BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform, DWORD mode )
1235 DC_ATTR *dc_attr;
1237 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1238 if (dc_attr->emf && !EMFDC_ModifyWorldTransform( dc_attr, xform, mode )) return FALSE;
1239 return NtGdiModifyWorldTransform( hdc, xform, mode );
1242 /***********************************************************************
1243 * SetWorldTransform (GDI32.@)
1245 BOOL WINAPI SetWorldTransform( HDC hdc, const XFORM *xform )
1247 DC_ATTR *dc_attr;
1249 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1250 if (dc_attr->emf && !EMFDC_SetWorldTransform( dc_attr, xform )) return FALSE;
1251 return NtGdiModifyWorldTransform( hdc, xform, MWT_SET );
1254 /***********************************************************************
1255 * SetStretchBltMode (GDI32.@)
1257 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
1259 DC_ATTR *dc_attr;
1260 INT ret;
1262 if (mode <= 0 || mode > MAXSTRETCHBLTMODE)
1264 SetLastError(ERROR_INVALID_PARAMETER);
1265 return 0;
1268 if (is_meta_dc( hdc )) return METADC_SetStretchBltMode( hdc, mode );
1269 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
1270 if (dc_attr->emf && !EMFDC_SetStretchBltMode( dc_attr, mode )) return 0;
1272 ret = dc_attr->stretch_blt_mode;
1273 dc_attr->stretch_blt_mode = mode;
1274 return ret;
1277 /***********************************************************************
1278 * GetCurrentPositionEx (GDI32.@)
1280 BOOL WINAPI GetCurrentPositionEx( HDC hdc, POINT *point )
1282 DC_ATTR *dc_attr;
1283 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1284 *point = dc_attr->cur_pos;
1285 return TRUE;
1288 /***********************************************************************
1289 * GetROP2 (GDI32.@)
1291 INT WINAPI GetROP2( HDC hdc )
1293 DC_ATTR *dc_attr = get_dc_attr( hdc );
1294 return dc_attr ? dc_attr->rop_mode : 0;
1297 /***********************************************************************
1298 * GetRelAbs (GDI32.@)
1300 INT WINAPI GetRelAbs( HDC hdc, DWORD ignore )
1302 DC_ATTR *dc_attr = get_dc_attr( hdc );
1303 return dc_attr ? dc_attr->rel_abs_mode : 0;
1306 /***********************************************************************
1307 * SetRelAbs (GDI32.@)
1309 INT WINAPI SetRelAbs( HDC hdc, INT mode )
1311 DC_ATTR *dc_attr;
1312 INT ret;
1314 if (mode != ABSOLUTE && mode != RELATIVE)
1316 SetLastError(ERROR_INVALID_PARAMETER);
1317 return 0;
1320 if (is_meta_dc( hdc )) return METADC_SetRelAbs( hdc, mode );
1321 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
1322 ret = dc_attr->rel_abs_mode;
1323 dc_attr->rel_abs_mode = mode;
1324 return ret;
1327 /***********************************************************************
1328 * SetROP2 (GDI32.@)
1330 INT WINAPI SetROP2( HDC hdc, INT mode )
1332 DC_ATTR *dc_attr;
1333 INT ret;
1335 if ((mode < R2_BLACK) || (mode > R2_WHITE))
1337 SetLastError(ERROR_INVALID_PARAMETER);
1338 return 0;
1341 if (is_meta_dc( hdc )) return METADC_SetROP2( hdc, mode );
1342 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
1343 if (dc_attr->emf && !EMFDC_SetROP2( dc_attr, mode )) return 0;
1345 ret = dc_attr->rop_mode;
1346 dc_attr->rop_mode = mode;
1347 return ret;
1350 /***********************************************************************
1351 * GetMiterLimit (GDI32.@)
1353 BOOL WINAPI GetMiterLimit( HDC hdc, FLOAT *limit )
1355 DC_ATTR *dc_attr;
1356 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1357 if (limit) *limit = dc_attr->miter_limit;
1358 return TRUE;
1361 /*******************************************************************
1362 * SetMiterLimit (GDI32.@)
1364 BOOL WINAPI SetMiterLimit( HDC hdc, FLOAT limit, FLOAT *old_limit )
1366 DC_ATTR *dc_attr;
1367 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1368 /* FIXME: record EMFs */
1369 if (old_limit) *old_limit = dc_attr->miter_limit;
1370 dc_attr->miter_limit = limit;
1371 return TRUE;
1374 /***********************************************************************
1375 * SetPixel (GDI32.@)
1377 COLORREF WINAPI SetPixel( HDC hdc, INT x, INT y, COLORREF color )
1379 DC_ATTR *dc_attr;
1381 if (is_meta_dc( hdc )) return METADC_SetPixel( hdc, x, y, color );
1382 if (!(dc_attr = get_dc_attr( hdc ))) return CLR_INVALID;
1383 if (dc_attr->print) print_call_start_page( dc_attr );
1384 if (dc_attr->emf && !EMFDC_SetPixel( dc_attr, x, y, color )) return CLR_INVALID;
1385 return NtGdiSetPixel( hdc, x, y, color );
1388 /***********************************************************************
1389 * SetPixelV (GDI32.@)
1391 BOOL WINAPI SetPixelV( HDC hdc, INT x, INT y, COLORREF color )
1393 return SetPixel( hdc, x, y, color ) != CLR_INVALID;
1396 /***********************************************************************
1397 * LineTo (GDI32.@)
1399 BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
1401 DC_ATTR *dc_attr;
1403 TRACE( "%p, (%d, %d)\n", hdc, x, y );
1405 if (is_meta_dc( hdc )) return METADC_LineTo( hdc, x, y );
1406 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1407 if (dc_attr->print) print_call_start_page( dc_attr );
1408 if (dc_attr->emf && !EMFDC_LineTo( dc_attr, x, y )) return FALSE;
1409 return NtGdiLineTo( hdc, x, y );
1412 /***********************************************************************
1413 * MoveToEx (GDI32.@)
1415 BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, POINT *pt )
1417 DC_ATTR *dc_attr;
1419 TRACE( "%p, (%d, %d), %p\n", hdc, x, y, pt );
1421 if (is_meta_dc( hdc )) return METADC_MoveTo( hdc, x, y );
1422 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1423 if (dc_attr->emf && !EMFDC_MoveTo( dc_attr, x, y )) return FALSE;
1424 return NtGdiMoveTo( hdc, x, y, pt );
1427 /***********************************************************************
1428 * Arc (GDI32.@)
1430 BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
1431 INT xstart, INT ystart, INT xend, INT yend )
1433 DC_ATTR *dc_attr;
1435 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
1436 right, bottom, xstart, ystart, xend, yend );
1438 if (is_meta_dc( hdc ))
1439 return METADC_Arc( hdc, left, top, right, bottom,
1440 xstart, ystart, xend, yend );
1442 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1443 if (dc_attr->print) print_call_start_page( dc_attr );
1444 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
1445 xstart, ystart, xend, yend, EMR_ARC ))
1446 return FALSE;
1448 return NtGdiArcInternal( NtGdiArc, hdc, left, top, right, bottom,
1449 xstart, ystart, xend, yend );
1452 /***********************************************************************
1453 * ArcTo (GDI32.@)
1455 BOOL WINAPI ArcTo( HDC hdc, INT left, INT top, INT right, INT bottom,
1456 INT xstart, INT ystart, INT xend, INT yend )
1458 DC_ATTR *dc_attr;
1460 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
1461 right, bottom, xstart, ystart, xend, yend );
1463 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1464 if (dc_attr->print) print_call_start_page( dc_attr );
1465 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
1466 xstart, ystart, xend, yend, EMR_ARCTO ))
1467 return FALSE;
1469 return NtGdiArcInternal( NtGdiArcTo, hdc, left, top, right, bottom,
1470 xstart, ystart, xend, yend );
1473 /***********************************************************************
1474 * Chord (GDI32.@)
1476 BOOL WINAPI Chord( HDC hdc, INT left, INT top, INT right, INT bottom,
1477 INT xstart, INT ystart, INT xend, INT yend )
1479 DC_ATTR *dc_attr;
1481 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
1482 right, bottom, xstart, ystart, xend, yend );
1484 if (is_meta_dc( hdc ))
1485 return METADC_Chord( hdc, left, top, right, bottom,
1486 xstart, ystart, xend, yend );
1488 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1489 if (dc_attr->print) print_call_start_page( dc_attr );
1490 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
1491 xstart, ystart, xend, yend, EMR_CHORD ))
1492 return FALSE;
1494 return NtGdiArcInternal( NtGdiChord, hdc, left, top, right, bottom,
1495 xstart, ystart, xend, yend );
1498 /***********************************************************************
1499 * Pie (GDI32.@)
1501 BOOL WINAPI Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
1502 INT xstart, INT ystart, INT xend, INT yend )
1504 DC_ATTR *dc_attr;
1506 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
1507 right, bottom, xstart, ystart, xend, yend );
1509 if (is_meta_dc( hdc ))
1510 return METADC_Pie( hdc, left, top, right, bottom,
1511 xstart, ystart, xend, yend );
1513 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1514 if (dc_attr->print) print_call_start_page( dc_attr );
1515 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
1516 xstart, ystart, xend, yend, EMR_PIE ))
1517 return FALSE;
1519 return NtGdiArcInternal( NtGdiPie, hdc, left, top, right, bottom,
1520 xstart, ystart, xend, yend );
1523 /***********************************************************************
1524 * AngleArc (GDI32.@)
1526 BOOL WINAPI AngleArc( HDC hdc, INT x, INT y, DWORD radius, FLOAT start_angle, FLOAT sweep_angle )
1528 DC_ATTR *dc_attr;
1530 TRACE( "%p, (%d, %d), %lu, %f, %f\n", hdc, x, y, radius, start_angle, sweep_angle );
1532 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1533 if (dc_attr->print) print_call_start_page( dc_attr );
1534 if (dc_attr->emf && !EMFDC_AngleArc( dc_attr, x, y, radius, start_angle, sweep_angle ))
1535 return FALSE;
1536 return NtGdiAngleArc( hdc, x, y, radius, *(DWORD *)&start_angle, *(DWORD *)&sweep_angle );
1539 /***********************************************************************
1540 * Ellipse (GDI32.@)
1542 BOOL WINAPI Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
1544 DC_ATTR *dc_attr;
1546 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc, left, top, right, bottom );
1548 if (is_meta_dc( hdc )) return METADC_Ellipse( hdc, left, top, right, bottom );
1549 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1550 if (dc_attr->print) print_call_start_page( dc_attr );
1551 if (dc_attr->emf && !EMFDC_Ellipse( dc_attr, left, top, right, bottom )) return FALSE;
1552 return NtGdiEllipse( hdc, left, top, right, bottom );
1555 /***********************************************************************
1556 * Rectangle (GDI32.@)
1558 BOOL WINAPI Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
1560 DC_ATTR *dc_attr;
1562 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc, left, top, right, bottom );
1564 if (is_meta_dc( hdc )) return METADC_Rectangle( hdc, left, top, right, bottom );
1565 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1566 if (dc_attr->print) print_call_start_page( dc_attr );
1567 if (dc_attr->emf && !EMFDC_Rectangle( dc_attr, left, top, right, bottom )) return FALSE;
1568 return NtGdiRectangle( hdc, left, top, right, bottom );
1571 /***********************************************************************
1572 * RoundRect (GDI32.@)
1574 BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
1575 INT bottom, INT ell_width, INT ell_height )
1577 DC_ATTR *dc_attr;
1579 TRACE( "%p, (%d, %d)-(%d, %d), %dx%d\n", hdc, left, top, right, bottom,
1580 ell_width, ell_height );
1582 if (is_meta_dc( hdc ))
1583 return METADC_RoundRect( hdc, left, top, right, bottom, ell_width, ell_height );
1585 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1586 if (dc_attr->print) print_call_start_page( dc_attr );
1587 if (dc_attr->emf && !EMFDC_RoundRect( dc_attr, left, top, right, bottom,
1588 ell_width, ell_height ))
1589 return FALSE;
1591 return NtGdiRoundRect( hdc, left, top, right, bottom, ell_width, ell_height );
1594 /**********************************************************************
1595 * Polygon (GDI32.@)
1597 BOOL WINAPI Polygon( HDC hdc, const POINT *points, INT count )
1599 DC_ATTR *dc_attr;
1601 TRACE( "%p, %p, %d\n", hdc, points, count );
1603 if (is_meta_dc( hdc )) return METADC_Polygon( hdc, points, count );
1604 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1605 if (dc_attr->print) print_call_start_page( dc_attr );
1606 if (dc_attr->emf && !EMFDC_Polygon( dc_attr, points, count )) return FALSE;
1607 return NtGdiPolyPolyDraw( hdc, points, (const ULONG *)&count, 1, NtGdiPolyPolygon );
1610 /**********************************************************************
1611 * PolyPolygon (GDI32.@)
1613 BOOL WINAPI PolyPolygon( HDC hdc, const POINT *points, const INT *counts, UINT polygons )
1615 DC_ATTR *dc_attr;
1617 TRACE( "%p, %p, %p, %u\n", hdc, points, counts, polygons );
1619 if (is_meta_dc( hdc )) return METADC_PolyPolygon( hdc, points, counts, polygons );
1620 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1621 if (dc_attr->print) print_call_start_page( dc_attr );
1622 if (dc_attr->emf && !EMFDC_PolyPolygon( dc_attr, points, counts, polygons )) return FALSE;
1623 return NtGdiPolyPolyDraw( hdc, points, (const ULONG *)counts, polygons, NtGdiPolyPolygon );
1626 /**********************************************************************
1627 * Polyline (GDI32.@)
1629 BOOL WINAPI Polyline( HDC hdc, const POINT *points, INT count )
1631 DC_ATTR *dc_attr;
1633 TRACE( "%p, %p, %d\n", hdc, points, count );
1635 if (is_meta_dc( hdc )) return METADC_Polyline( hdc, points, count );
1636 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1637 if (dc_attr->print) print_call_start_page( dc_attr );
1638 if (dc_attr->emf && !EMFDC_Polyline( dc_attr, points, count )) return FALSE;
1639 return NtGdiPolyPolyDraw( hdc, points, (const ULONG *)&count, 1, NtGdiPolyPolyline );
1642 /**********************************************************************
1643 * PolyPolyline (GDI32.@)
1645 BOOL WINAPI PolyPolyline( HDC hdc, const POINT *points, const DWORD *counts, DWORD polylines )
1647 DC_ATTR *dc_attr;
1649 TRACE( "%p, %p, %p, %lu\n", hdc, points, counts, polylines );
1651 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1652 if (dc_attr->print) print_call_start_page( dc_attr );
1653 if (dc_attr->emf && !EMFDC_PolyPolyline( dc_attr, points, counts, polylines )) return FALSE;
1654 return NtGdiPolyPolyDraw( hdc, points, counts, polylines, NtGdiPolyPolyline );
1657 /******************************************************************************
1658 * PolyBezier (GDI32.@)
1660 BOOL WINAPI PolyBezier( HDC hdc, const POINT *points, DWORD count )
1662 DC_ATTR *dc_attr;
1664 TRACE( "%p, %p, %lu\n", hdc, points, count );
1666 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1667 if (dc_attr->print) print_call_start_page( dc_attr );
1668 if (dc_attr->emf && !EMFDC_PolyBezier( dc_attr, points, count )) return FALSE;
1669 return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyBezier );
1672 /******************************************************************************
1673 * PolyBezierTo (GDI32.@)
1675 BOOL WINAPI PolyBezierTo( HDC hdc, const POINT *points, DWORD count )
1677 DC_ATTR *dc_attr;
1679 TRACE( "%p, %p, %lu\n", hdc, points, count );
1681 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1682 if (dc_attr->print) print_call_start_page( dc_attr );
1683 if (dc_attr->emf && !EMFDC_PolyBezierTo( dc_attr, points, count )) return FALSE;
1684 return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyBezierTo );
1687 /**********************************************************************
1688 * PolylineTo (GDI32.@)
1690 BOOL WINAPI PolylineTo( HDC hdc, const POINT *points, DWORD count )
1692 DC_ATTR *dc_attr;
1694 TRACE( "%p, %p, %lu\n", hdc, points, count );
1696 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1697 if (dc_attr->print) print_call_start_page( dc_attr );
1698 if (dc_attr->emf && !EMFDC_PolylineTo( dc_attr, points, count )) return FALSE;
1699 return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolylineTo );
1702 /***********************************************************************
1703 * PolyDraw (GDI32.@)
1705 BOOL WINAPI PolyDraw( HDC hdc, const POINT *points, const BYTE *types, DWORD count )
1707 DC_ATTR *dc_attr;
1709 TRACE( "%p, %p, %p, %lu\n", hdc, points, types, count );
1711 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1712 if (dc_attr->print) print_call_start_page( dc_attr );
1713 if (dc_attr->emf && !EMFDC_PolyDraw( dc_attr, points, types, count )) return FALSE;
1714 return NtGdiPolyDraw( hdc, points, types, count );
1717 /***********************************************************************
1718 * FillRgn (GDI32.@)
1720 BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
1722 DC_ATTR *dc_attr;
1724 TRACE( "%p, %p, %p\n", hdc, hrgn, hbrush );
1726 if (is_meta_dc( hdc )) return METADC_FillRgn( hdc, hrgn, hbrush );
1727 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1728 if (dc_attr->print) print_call_start_page( dc_attr );
1729 if (dc_attr->emf && !EMFDC_FillRgn( dc_attr, hrgn, hbrush )) return FALSE;
1730 return NtGdiFillRgn( hdc, hrgn, hbrush );
1733 /***********************************************************************
1734 * PaintRgn (GDI32.@)
1736 BOOL WINAPI PaintRgn( HDC hdc, HRGN hrgn )
1738 DC_ATTR *dc_attr;
1740 TRACE( "%p, %p\n", hdc, hrgn );
1742 if (is_meta_dc( hdc )) return METADC_PaintRgn( hdc, hrgn );
1743 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1744 if (dc_attr->print) print_call_start_page( dc_attr );
1745 if (dc_attr->emf && !EMFDC_PaintRgn( dc_attr, hrgn )) return FALSE;
1746 return NtGdiFillRgn( hdc, hrgn, GetCurrentObject( hdc, OBJ_BRUSH ));
1749 /***********************************************************************
1750 * FrameRgn (GDI32.@)
1752 BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
1754 DC_ATTR *dc_attr;
1756 TRACE( "%p, %p, %p, %dx%d\n", hdc, hrgn, hbrush, width, height );
1758 if (is_meta_dc( hdc )) return METADC_FrameRgn( hdc, hrgn, hbrush, width, height );
1759 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1760 if (dc_attr->print) print_call_start_page( dc_attr );
1761 if (dc_attr->emf && !EMFDC_FrameRgn( dc_attr, hrgn, hbrush, width, height ))
1762 return FALSE;
1763 return NtGdiFrameRgn( hdc, hrgn, hbrush, width, height );
1766 /***********************************************************************
1767 * InvertRgn (GDI32.@)
1769 BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
1771 DC_ATTR *dc_attr;
1773 TRACE( "%p, %p\n", hdc, hrgn );
1775 if (is_meta_dc( hdc )) return METADC_InvertRgn( hdc, hrgn );
1776 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1777 if (dc_attr->print) print_call_start_page( dc_attr );
1778 if (dc_attr->emf && !EMFDC_InvertRgn( dc_attr, hrgn )) return FALSE;
1779 return NtGdiInvertRgn( hdc, hrgn );
1782 /***********************************************************************
1783 * ExtFloodFill (GDI32.@)
1785 BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, UINT fill_type )
1787 DC_ATTR *dc_attr;
1789 TRACE( "%p, (%d, %d), %08lx, %x\n", hdc, x, y, color, fill_type );
1791 if (is_meta_dc( hdc )) return METADC_ExtFloodFill( hdc, x, y, color, fill_type );
1792 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1793 if (dc_attr->print) print_call_start_page( dc_attr );
1794 if (dc_attr->emf && !EMFDC_ExtFloodFill( dc_attr, x, y, color, fill_type )) return FALSE;
1795 return NtGdiExtFloodFill( hdc, x, y, color, fill_type );
1798 /***********************************************************************
1799 * FloodFill (GDI32.@)
1801 BOOL WINAPI FloodFill( HDC hdc, INT x, INT y, COLORREF color )
1803 return ExtFloodFill( hdc, x, y, color, FLOODFILLBORDER );
1806 /******************************************************************************
1807 * GdiGradientFill (GDI32.@)
1809 BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
1810 void *grad_array, ULONG ngrad, ULONG mode )
1812 DC_ATTR *dc_attr;
1814 TRACE( "%p vert_array:%p nvert:%ld grad_array:%p ngrad:%ld\n", hdc, vert_array,
1815 nvert, grad_array, ngrad );
1817 if (!(dc_attr = get_dc_attr( hdc )))
1819 SetLastError( ERROR_INVALID_PARAMETER );
1820 return FALSE;
1822 if (dc_attr->print) print_call_start_page( dc_attr );
1823 if (dc_attr->emf &&
1824 !EMFDC_GradientFill( dc_attr, vert_array, nvert, grad_array, ngrad, mode ))
1825 return FALSE;
1826 return NtGdiGradientFill( hdc, vert_array, nvert, grad_array, ngrad, mode );
1829 /***********************************************************************
1830 * SetTextJustification (GDI32.@)
1832 BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
1834 DC_ATTR *dc_attr;
1836 if (is_meta_dc( hdc )) return METADC_SetTextJustification( hdc, extra, breaks );
1837 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1838 if (dc_attr->emf && !EMFDC_SetTextJustification( dc_attr, extra, breaks ))
1839 return FALSE;
1840 return NtGdiSetTextJustification( hdc, extra, breaks );
1843 /***********************************************************************
1844 * PatBlt (GDI32.@)
1846 BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop )
1848 DC_ATTR *dc_attr;
1850 if (is_meta_dc( hdc )) return METADC_PatBlt( hdc, left, top, width, height, rop );
1851 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1852 if (dc_attr->print) print_call_start_page( dc_attr );
1853 if (dc_attr->emf && !EMFDC_PatBlt( dc_attr, left, top, width, height, rop ))
1854 return FALSE;
1855 return NtGdiPatBlt( hdc, left, top, width, height, rop );
1858 /***********************************************************************
1859 * BitBlt (GDI32.@)
1861 BOOL WINAPI DECLSPEC_HOTPATCH BitBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height,
1862 HDC hdc_src, INT x_src, INT y_src, DWORD rop )
1864 DC_ATTR *dc_attr;
1866 if (is_meta_dc( hdc_dst )) return METADC_BitBlt( hdc_dst, x_dst, y_dst, width, height,
1867 hdc_src, x_src, y_src, rop );
1868 if (!(dc_attr = get_dc_attr( hdc_dst ))) return FALSE;
1869 if (dc_attr->print) print_call_start_page( dc_attr );
1870 if (dc_attr->emf && !EMFDC_BitBlt( dc_attr, x_dst, y_dst, width, height,
1871 hdc_src, x_src, y_src, rop ))
1872 return FALSE;
1873 return NtGdiBitBlt( hdc_dst, x_dst, y_dst, width, height,
1874 hdc_src, x_src, y_src, rop, 0 /* FIXME */, 0 /* FIXME */ );
1877 /***********************************************************************
1878 * StretchBlt (GDI32.@)
1880 BOOL WINAPI StretchBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
1881 HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
1882 DWORD rop )
1884 DC_ATTR *dc_attr;
1886 if (is_meta_dc( hdc )) return METADC_StretchBlt( hdc, x_dst, y_dst, width_dst, height_dst,
1887 hdc_src, x_src, y_src, width_src,
1888 height_src, rop );
1889 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1890 if (dc_attr->print) print_call_start_page( dc_attr );
1891 if (dc_attr->emf && !EMFDC_StretchBlt( dc_attr, x_dst, y_dst, width_dst, height_dst,
1892 hdc_src, x_src, y_src, width_src,
1893 height_src, rop ))
1894 return FALSE;
1895 return NtGdiStretchBlt( hdc, x_dst, y_dst, width_dst, height_dst,
1896 hdc_src, x_src, y_src, width_src,
1897 height_src, rop, 0 /* FIXME */ );
1900 /***********************************************************************
1901 * MaskBlt [GDI32.@]
1903 BOOL WINAPI MaskBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
1904 HDC hdc_src, INT x_src, INT y_src, HBITMAP mask,
1905 INT x_mask, INT y_mask, DWORD rop )
1907 DC_ATTR *dc_attr;
1909 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1910 if (dc_attr->print) print_call_start_page( dc_attr );
1911 if (dc_attr->emf && !EMFDC_MaskBlt( dc_attr, x_dst, y_dst, width_dst, height_dst,
1912 hdc_src, x_src, y_src, mask, x_mask, y_mask, rop ))
1913 return FALSE;
1914 return NtGdiMaskBlt( hdc, x_dst, y_dst, width_dst, height_dst, hdc_src, x_src, y_src,
1915 mask, x_mask, y_mask, rop, 0 /* FIXME */ );
1918 /***********************************************************************
1919 * PlgBlt (GDI32.@)
1921 BOOL WINAPI PlgBlt( HDC hdc, const POINT *points, HDC hdc_src, INT x_src, INT y_src,
1922 INT width, INT height, HBITMAP mask, INT x_mask, INT y_mask )
1924 DC_ATTR *dc_attr;
1926 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1927 if (dc_attr->print) print_call_start_page( dc_attr );
1928 if (dc_attr->emf && !EMFDC_PlgBlt( dc_attr, points, hdc_src, x_src, y_src,
1929 width, height, mask, x_mask, y_mask ))
1930 return FALSE;
1931 return NtGdiPlgBlt( hdc, points, hdc_src, x_src, y_src, width, height,
1932 mask, x_mask, y_mask, 0 /* FIXME */ );
1935 /******************************************************************************
1936 * GdiTransparentBlt (GDI32.@)
1938 BOOL WINAPI GdiTransparentBlt( HDC hdc, int x_dst, int y_dst, int width_dst, int height_dst,
1939 HDC hdc_src, int x_src, int y_src, int width_src, int height_src,
1940 UINT color )
1942 DC_ATTR *dc_attr;
1944 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1945 if (dc_attr->print) print_call_start_page( dc_attr );
1946 if (dc_attr->emf && !EMFDC_TransparentBlt( dc_attr, x_dst, y_dst, width_dst, height_dst, hdc_src,
1947 x_src, y_src, width_src, height_src, color ))
1948 return FALSE;
1949 return NtGdiTransparentBlt( hdc, x_dst, y_dst, width_dst, height_dst, hdc_src, x_src, y_src,
1950 width_src, height_src, color );
1953 /******************************************************************************
1954 * GdiAlphaBlend (GDI32.@)
1956 BOOL WINAPI GdiAlphaBlend( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int height_dst,
1957 HDC hdc_src, int x_src, int y_src, int width_src, int height_src,
1958 BLENDFUNCTION blend_function)
1960 DC_ATTR *dc_attr;
1962 if (!(dc_attr = get_dc_attr( hdc_dst ))) return FALSE;
1963 if (dc_attr->print) print_call_start_page( dc_attr );
1964 if (dc_attr->emf && !EMFDC_AlphaBlend( dc_attr, x_dst, y_dst, width_dst, height_dst,
1965 hdc_src, x_src, y_src, width_src,
1966 height_src, blend_function ))
1967 return FALSE;
1968 return NtGdiAlphaBlend( hdc_dst, x_dst, y_dst, width_dst, height_dst,
1969 hdc_src, x_src, y_src, width_src, height_src,
1970 *(DWORD *)&blend_function, 0 /* FIXME */ );
1973 /******************************************************************************
1974 * SetDIBits (GDI32.@)
1976 * Sets pixels in a bitmap using colors from DIB.
1978 INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
1979 UINT lines, const void *bits, const BITMAPINFO *info,
1980 UINT coloruse )
1982 /* Wine-specific: pass hbitmap to NtGdiSetDIBitsToDeviceInternal */
1983 return NtGdiSetDIBitsToDeviceInternal( hdc, 0, 0, 0, 0, 0, 0,
1984 startscan, lines, bits, info, coloruse,
1985 0, 0, FALSE, hbitmap );
1988 /***********************************************************************
1989 * SetDIBitsToDevice (GDI32.@)
1991 INT WINAPI SetDIBitsToDevice( HDC hdc, INT x_dst, INT y_dst, DWORD cx,
1992 DWORD cy, INT x_src, INT y_src, UINT startscan,
1993 UINT lines, const void *bits, const BITMAPINFO *bmi,
1994 UINT coloruse )
1996 DC_ATTR *dc_attr;
1998 if (is_meta_dc( hdc ))
1999 return METADC_SetDIBitsToDevice( hdc, x_dst, y_dst, cx, cy, x_src, y_src, startscan,
2000 lines, bits, bmi, coloruse );
2001 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2002 if (dc_attr->print) print_call_start_page( dc_attr );
2003 if (dc_attr->emf && !EMFDC_SetDIBitsToDevice( dc_attr, x_dst, y_dst, cx, cy, x_src, y_src,
2004 startscan, lines, bits, bmi, coloruse ))
2005 return 0;
2006 return NtGdiSetDIBitsToDeviceInternal( hdc, x_dst, y_dst, cx, cy, x_src, y_src,
2007 startscan, lines, bits, bmi, coloruse,
2008 0, 0, FALSE, NULL );
2011 /***********************************************************************
2012 * StretchDIBits (GDI32.@)
2014 INT WINAPI DECLSPEC_HOTPATCH StretchDIBits( HDC hdc, INT x_dst, INT y_dst, INT width_dst,
2015 INT height_dst, INT x_src, INT y_src, INT width_src,
2016 INT height_src, const void *bits, const BITMAPINFO *bmi,
2017 UINT coloruse, DWORD rop )
2019 DC_ATTR *dc_attr;
2021 if (is_meta_dc( hdc ))
2022 return METADC_StretchDIBits( hdc, x_dst, y_dst, width_dst, height_dst, x_src, y_src,
2023 width_src, height_src, bits, bmi, coloruse, rop );
2024 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2025 if (dc_attr->print) print_call_start_page( dc_attr );
2026 if (dc_attr->emf && !EMFDC_StretchDIBits( dc_attr, x_dst, y_dst, width_dst, height_dst,
2027 x_src, y_src, width_src, height_src, bits,
2028 bmi, coloruse, rop ))
2029 return FALSE;
2030 return NtGdiStretchDIBitsInternal( hdc, x_dst, y_dst, width_dst, height_dst, x_src, y_src,
2031 width_src, height_src, bits, bmi, coloruse, rop,
2032 0, 0, NULL );
2035 /***********************************************************************
2036 * BeginPath (GDI32.@)
2038 BOOL WINAPI BeginPath(HDC hdc)
2040 DC_ATTR *dc_attr;
2042 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2043 if (dc_attr->emf && !EMFDC_BeginPath( dc_attr )) return FALSE;
2044 return NtGdiBeginPath( hdc );
2047 /***********************************************************************
2048 * EndPath (GDI32.@)
2050 BOOL WINAPI EndPath(HDC hdc)
2052 DC_ATTR *dc_attr;
2054 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2055 if (dc_attr->emf && !EMFDC_EndPath( dc_attr )) return FALSE;
2056 return NtGdiEndPath( hdc );
2059 /***********************************************************************
2060 * AbortPath (GDI32.@)
2062 BOOL WINAPI AbortPath( HDC hdc )
2064 DC_ATTR *dc_attr;
2066 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2067 if (dc_attr->emf && !EMFDC_AbortPath( dc_attr )) return FALSE;
2068 return NtGdiAbortPath( hdc );
2071 /***********************************************************************
2072 * CloseFigure (GDI32.@)
2074 BOOL WINAPI CloseFigure( HDC hdc )
2076 DC_ATTR *dc_attr;
2078 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2079 if (dc_attr->emf && !EMFDC_CloseFigure( dc_attr )) return FALSE;
2080 return NtGdiCloseFigure( hdc );
2083 /***********************************************************************
2084 * FillPath (GDI32.@)
2086 BOOL WINAPI FillPath( HDC hdc )
2088 DC_ATTR *dc_attr;
2090 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2091 if (dc_attr->print) print_call_start_page( dc_attr );
2092 if (dc_attr->emf && !EMFDC_FillPath( dc_attr )) return FALSE;
2093 return NtGdiFillPath( hdc );
2096 /*******************************************************************
2097 * StrokeAndFillPath (GDI32.@)
2099 BOOL WINAPI StrokeAndFillPath( HDC hdc )
2101 DC_ATTR *dc_attr;
2103 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2104 if (dc_attr->print) print_call_start_page( dc_attr );
2105 if (dc_attr->emf && !EMFDC_StrokeAndFillPath( dc_attr )) return FALSE;
2106 return NtGdiStrokeAndFillPath( hdc );
2109 /*******************************************************************
2110 * StrokePath (GDI32.@)
2112 BOOL WINAPI StrokePath( HDC hdc )
2114 DC_ATTR *dc_attr;
2116 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2117 if (dc_attr->print) print_call_start_page( dc_attr );
2118 if (dc_attr->emf && !EMFDC_StrokePath( dc_attr )) return FALSE;
2119 return NtGdiStrokePath( hdc );
2122 /***********************************************************************
2123 * FlattenPath (GDI32.@)
2125 BOOL WINAPI FlattenPath( HDC hdc )
2127 DC_ATTR *dc_attr;
2129 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2130 if (dc_attr->emf && !EMFDC_FlattenPath( dc_attr )) return FALSE;
2131 return NtGdiFlattenPath( hdc );
2134 /***********************************************************************
2135 * WidenPath (GDI32.@)
2137 BOOL WINAPI WidenPath( HDC hdc )
2139 DC_ATTR *dc_attr;
2141 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2142 if (dc_attr->emf && !EMFDC_WidenPath( dc_attr )) return FALSE;
2143 return NtGdiWidenPath( hdc );
2146 /***********************************************************************
2147 * SelectClipPath (GDI32.@)
2149 BOOL WINAPI SelectClipPath( HDC hdc, INT mode )
2151 DC_ATTR *dc_attr;
2153 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2154 if (dc_attr->emf && !EMFDC_SelectClipPath( dc_attr, mode )) return FALSE;
2155 return NtGdiSelectClipPath( hdc, mode );
2158 /***********************************************************************
2159 * GetClipRgn (GDI32.@)
2161 INT WINAPI GetClipRgn( HDC hdc, HRGN rgn )
2163 return NtGdiGetRandomRgn( hdc, rgn, NTGDI_RGN_MIRROR_RTL | 1 );
2166 /***********************************************************************
2167 * GetMetaRgn (GDI32.@)
2169 INT WINAPI GetMetaRgn( HDC hdc, HRGN rgn )
2171 return NtGdiGetRandomRgn( hdc, rgn, NTGDI_RGN_MIRROR_RTL | 2 );
2174 /***********************************************************************
2175 * IntersectClipRect (GDI32.@)
2177 INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
2179 DC_ATTR *dc_attr;
2181 TRACE("%p %d,%d - %d,%d\n", hdc, left, top, right, bottom );
2183 if (is_meta_dc( hdc )) return METADC_IntersectClipRect( hdc, left, top, right, bottom );
2184 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2185 if (dc_attr->emf && !EMFDC_IntersectClipRect( dc_attr, left, top, right, bottom ))
2186 return FALSE;
2187 return NtGdiIntersectClipRect( hdc, left, top, right, bottom );
2190 /***********************************************************************
2191 * OffsetClipRgn (GDI32.@)
2193 INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
2195 DC_ATTR *dc_attr;
2197 if (is_meta_dc( hdc )) return METADC_OffsetClipRgn( hdc, x, y );
2198 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2199 if (dc_attr->emf && !EMFDC_OffsetClipRgn( dc_attr, x, y )) return FALSE;
2200 return NtGdiOffsetClipRgn( hdc, x, y );
2203 /***********************************************************************
2204 * ExcludeClipRect (GDI32.@)
2206 INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
2208 DC_ATTR *dc_attr;
2210 if (is_meta_dc( hdc )) return METADC_ExcludeClipRect( hdc, left, top, right, bottom );
2211 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2212 if (dc_attr->emf && !EMFDC_ExcludeClipRect( dc_attr, left, top, right, bottom ))
2213 return FALSE;
2214 return NtGdiExcludeClipRect( hdc, left, top, right, bottom );
2217 /******************************************************************************
2218 * ExtSelectClipRgn (GDI32.@)
2220 INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT mode )
2222 DC_ATTR *dc_attr;
2224 TRACE("%p %p %d\n", hdc, hrgn, mode );
2226 if (is_meta_dc( hdc )) return METADC_ExtSelectClipRgn( hdc, hrgn, mode );
2227 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2228 if (dc_attr->emf && !EMFDC_ExtSelectClipRgn( dc_attr, hrgn, mode ))
2229 return FALSE;
2230 return NtGdiExtSelectClipRgn( hdc, hrgn, mode );
2233 /***********************************************************************
2234 * SelectClipRgn (GDI32.@)
2236 INT WINAPI SelectClipRgn( HDC hdc, HRGN hrgn )
2238 return ExtSelectClipRgn( hdc, hrgn, RGN_COPY );
2241 /***********************************************************************
2242 * SetMetaRgn (GDI32.@)
2244 INT WINAPI SetMetaRgn( HDC hdc )
2246 DC_ATTR *dc_attr;
2248 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2249 if (dc_attr->emf) FIXME( "EMFs are not yet supported\n" );
2250 return NtGdiSetMetaRgn( hdc );
2253 /***********************************************************************
2254 * DPtoLP (GDI32.@)
2256 BOOL WINAPI DPtoLP( HDC hdc, POINT *points, INT count )
2258 return NtGdiTransformPoints( hdc, points, points, count, NtGdiDPtoLP );
2261 /***********************************************************************
2262 * LPtoDP (GDI32.@)
2264 BOOL WINAPI LPtoDP( HDC hdc, POINT *points, INT count )
2266 return NtGdiTransformPoints( hdc, points, points, count, NtGdiLPtoDP );
2269 /***********************************************************************
2270 * ScaleViewportExtEx (GDI32.@)
2272 BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom,
2273 INT y_num, INT y_denom, SIZE *size )
2275 DC_ATTR *dc_attr;
2277 if (is_meta_dc( hdc )) return METADC_ScaleViewportExtEx( hdc, x_num, x_denom, y_num, y_denom );
2278 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2279 if (dc_attr->emf && !EMFDC_ScaleViewportExtEx( dc_attr, x_num, x_denom, y_num, y_denom ))
2280 return FALSE;
2281 return NtGdiScaleViewportExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
2284 /***********************************************************************
2285 * ScaleWindowExtEx (GDI32.@)
2287 BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
2288 INT y_num, INT y_denom, SIZE *size )
2290 DC_ATTR *dc_attr;
2292 if (is_meta_dc( hdc )) return METADC_ScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom );
2293 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2294 if (dc_attr->emf && !EMFDC_ScaleWindowExtEx( dc_attr, x_num, x_denom, y_num, y_denom ))
2295 return FALSE;
2296 return NtGdiScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
2299 static UINT WINAPI realize_palette( HDC hdc )
2301 return NtUserRealizePalette( hdc );
2304 /* Pointers to USER implementation of SelectPalette/RealizePalette */
2305 /* they will be patched by USER on startup */
2306 HPALETTE (WINAPI *pfnSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgnd ) = NtUserSelectPalette;
2307 UINT (WINAPI *pfnRealizePalette)( HDC hdc ) = realize_palette;
2309 /***********************************************************************
2310 * SelectPalette (GDI32.@)
2312 HPALETTE WINAPI SelectPalette( HDC hdc, HPALETTE palette, BOOL force_background )
2314 DC_ATTR *dc_attr;
2316 palette = get_full_gdi_handle( palette );
2317 if (is_meta_dc( hdc )) return ULongToHandle( METADC_SelectPalette( hdc, palette ) );
2318 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2319 if (dc_attr->emf && !EMFDC_SelectPalette( dc_attr, palette )) return 0;
2320 return pfnSelectPalette( hdc, palette, force_background );
2323 /***********************************************************************
2324 * RealizePalette (GDI32.@)
2326 UINT WINAPI RealizePalette( HDC hdc )
2328 DC_ATTR *dc_attr;
2330 if (is_meta_dc( hdc )) return METADC_RealizePalette( hdc );
2331 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2332 if (dc_attr->emf && !EMFDC_RealizePalette( dc_attr )) return 0;
2333 return pfnRealizePalette( hdc );
2336 /***********************************************************************
2337 * GdiSetPixelFormat (GDI32.@)
2339 BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR *descr )
2341 TRACE( "(%p,%d,%p)\n", hdc, format, descr );
2342 return NtGdiSetPixelFormat( hdc, format );
2345 /***********************************************************************
2346 * CancelDC (GDI32.@)
2348 BOOL WINAPI CancelDC(HDC hdc)
2350 FIXME( "stub\n" );
2351 return TRUE;
2354 /***********************************************************************
2355 * StartDocW [GDI32.@]
2357 * StartDoc calls the STARTDOC Escape with the input data pointing to DocName
2358 * and the output data (which is used as a second input parameter).pointing at
2359 * the whole docinfo structure. This seems to be an undocumented feature of
2360 * the STARTDOC Escape.
2362 * Note: we now do it the other way, with the STARTDOC Escape calling StartDoc.
2364 INT WINAPI StartDocW( HDC hdc, const DOCINFOW *doc )
2366 DOC_INFO_1W spool_info;
2367 WCHAR *output = NULL;
2368 struct print *print;
2369 DC_ATTR *dc_attr;
2370 ABORTPROC proc;
2371 DOCINFOW info;
2372 INT ret;
2374 TRACE("%p %p\n", hdc, doc);
2376 if (doc)
2378 info = *doc;
2380 else
2382 memset( &info, 0, sizeof(info) );
2383 info.cbSize = sizeof(info);
2386 TRACE("DocName %s, Output %s, Datatype %s, fwType %#lx\n",
2387 debugstr_w(info.lpszDocName), debugstr_w(info.lpszOutput),
2388 debugstr_w(info.lpszDatatype), info.fwType);
2390 if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
2391 if (dc_attr->print && dc_attr->emf) return SP_ERROR;
2393 proc = (ABORTPROC)(UINT_PTR)dc_attr->abort_proc;
2394 if (proc && !proc( hdc, 0 )) return 0;
2396 print = get_dc_print( dc_attr );
2397 if (print)
2399 if (!info.lpszOutput) info.lpszOutput = print->output;
2400 output = StartDocDlgW( print->printer, &info );
2401 if (output) info.lpszOutput = output;
2403 if (!info.lpszDatatype || !wcsicmp(info.lpszDatatype, L"EMF"))
2405 spool_info.pDocName = (WCHAR *)info.lpszDocName;
2406 spool_info.pOutputFile = (WCHAR *)info.lpszOutput;
2407 spool_info.pDatatype = (WCHAR *)L"NT EMF 1.003";
2408 if ((ret = StartDocPrinterW( print->printer, 1, (BYTE *)&spool_info )))
2410 if (!spool_start_doc( dc_attr, print->printer, &info ))
2412 AbortDoc( hdc );
2413 ret = 0;
2415 HeapFree( GetProcessHeap(), 0, output );
2416 print->flags |= CALL_START_PAGE;
2417 return ret;
2422 ret = NtGdiStartDoc( hdc, &info, NULL, 0 );
2423 HeapFree( GetProcessHeap(), 0, output );
2424 if (ret && print) print->flags |= CALL_START_PAGE;
2425 return ret;
2428 /***********************************************************************
2429 * StartDocA [GDI32.@]
2431 INT WINAPI StartDocA( HDC hdc, const DOCINFOA *doc )
2433 WCHAR *doc_name = NULL, *output = NULL, *data_type = NULL;
2434 DOCINFOW docW;
2435 INT ret, len;
2437 if (!doc) return StartDocW(hdc, NULL);
2439 docW.cbSize = doc->cbSize;
2440 if (doc->lpszDocName)
2442 len = MultiByteToWideChar( CP_ACP, 0, doc->lpszDocName, -1, NULL, 0 );
2443 doc_name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
2444 MultiByteToWideChar( CP_ACP, 0, doc->lpszDocName, -1, doc_name, len );
2446 if (doc->lpszOutput)
2448 len = MultiByteToWideChar( CP_ACP, 0, doc->lpszOutput, -1, NULL, 0 );
2449 output = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
2450 MultiByteToWideChar( CP_ACP, 0, doc->lpszOutput, -1, output, len );
2452 if (doc->lpszDatatype)
2454 len = MultiByteToWideChar( CP_ACP, 0, doc->lpszDatatype, -1, NULL, 0);
2455 data_type = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
2456 MultiByteToWideChar( CP_ACP, 0, doc->lpszDatatype, -1, data_type, len );
2459 docW.lpszDocName = doc_name;
2460 docW.lpszOutput = output;
2461 docW.lpszDatatype = data_type;
2462 docW.fwType = doc->fwType;
2464 ret = StartDocW(hdc, &docW);
2466 HeapFree( GetProcessHeap(), 0, doc_name );
2467 HeapFree( GetProcessHeap(), 0, output );
2468 HeapFree( GetProcessHeap(), 0, data_type );
2469 return ret;
2472 /***********************************************************************
2473 * StartPage (GDI32.@)
2475 INT WINAPI StartPage( HDC hdc )
2477 struct print *print;
2478 DC_ATTR *dc_attr;
2480 if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
2481 print = get_dc_print( dc_attr );
2482 if (print)
2484 print->flags = (print->flags & ~CALL_START_PAGE) | CALL_END_PAGE;
2485 if (dc_attr->emf)
2486 return spool_start_page( dc_attr, print->printer );
2488 return NtGdiStartPage( hdc );
2491 /***********************************************************************
2492 * EndPage (GDI32.@)
2494 INT WINAPI EndPage( HDC hdc )
2496 struct print *print;
2497 DC_ATTR *dc_attr;
2499 if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
2500 print = get_dc_print( dc_attr );
2501 if (print)
2503 BOOL write = print->flags & WRITE_DEVMODE;
2505 if (!(print->flags & CALL_END_PAGE)) return SP_ERROR;
2506 print->flags = (print->flags & ~(CALL_END_PAGE | WRITE_DEVMODE)) | CALL_START_PAGE;
2507 if (dc_attr->emf)
2508 return spool_end_page( dc_attr, print->printer, print->devmode, write );
2510 return NtGdiEndPage( hdc );
2513 /***********************************************************************
2514 * EndDoc (GDI32.@)
2516 INT WINAPI EndDoc( HDC hdc )
2518 struct print *print;
2519 DC_ATTR *dc_attr;
2521 if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
2522 print = get_dc_print( dc_attr );
2523 if (print)
2525 if (print->flags & CALL_END_PAGE) EndPage( hdc );
2526 print->flags &= ~CALL_START_PAGE;
2527 if (dc_attr->emf)
2528 return spool_end_doc( dc_attr, print->printer );
2530 return NtGdiEndDoc( hdc );
2533 /***********************************************************************
2534 * AbortDoc (GDI32.@)
2536 INT WINAPI AbortDoc( HDC hdc )
2538 struct print *print;
2539 DC_ATTR *dc_attr;
2541 if (!(dc_attr = get_dc_attr( hdc ))) return SP_ERROR;
2542 print = get_dc_print( dc_attr );
2543 if (print)
2545 print->flags &= ~(CALL_START_PAGE | CALL_END_PAGE);
2546 if (dc_attr->emf)
2547 return spool_abort_doc( dc_attr, print->printer );
2549 return NtGdiAbortDoc( hdc );
2552 /**********************************************************************
2553 * SetAbortProc (GDI32.@)
2555 INT WINAPI SetAbortProc( HDC hdc, ABORTPROC abrtprc )
2557 DC_ATTR *dc_attr;
2559 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2560 dc_attr->abort_proc = (UINT_PTR)abrtprc;
2561 return TRUE;
2564 /***********************************************************************
2565 * SetICMMode (GDI32.@)
2567 INT WINAPI SetICMMode( HDC hdc, INT mode )
2569 /* FIXME: Assume that ICM is always off, and cannot be turned on */
2570 switch (mode)
2572 case ICM_OFF: return ICM_OFF;
2573 case ICM_ON: return 0;
2574 case ICM_QUERY: return ICM_OFF;
2576 return 0;
2579 /***********************************************************************
2580 * GdiIsMetaPrintDC (GDI32.@)
2582 BOOL WINAPI GdiIsMetaPrintDC( HDC hdc )
2584 DC_ATTR *dc_attr;
2586 TRACE( "%p\n", hdc );
2588 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
2589 return dc_attr->print && dc_attr->emf;
2592 /***********************************************************************
2593 * GdiIsMetaFileDC (GDI32.@)
2595 BOOL WINAPI GdiIsMetaFileDC( HDC hdc )
2597 TRACE( "%p\n", hdc );
2599 switch (GetObjectType( hdc ))
2601 case OBJ_METADC:
2602 case OBJ_ENHMETADC:
2603 return TRUE;
2605 return FALSE;
2608 /***********************************************************************
2609 * GdiIsPlayMetafileDC (GDI32.@)
2611 BOOL WINAPI GdiIsPlayMetafileDC( HDC hdc )
2613 FIXME( "%p\n", hdc );
2614 return FALSE;
2617 /*******************************************************************
2618 * DrawEscape (GDI32.@)
2620 INT WINAPI DrawEscape( HDC hdc, INT escape, INT input_size, const char *input )
2622 FIXME( "stub\n" );
2623 return 0;
2626 /*******************************************************************
2627 * NamedEscape (GDI32.@)
2629 INT WINAPI NamedEscape( HDC hdc, const WCHAR *driver, INT escape, INT input_size,
2630 const char *input, INT output_size, char *output )
2632 FIXME( "(%p %s %d, %d %p %d %p)\n", hdc, wine_dbgstr_w(driver), escape, input_size,
2633 input, output_size, output );
2634 return 0;
2637 /*******************************************************************
2638 * DdQueryDisplaySettingsUniqueness (GDI32.@)
2639 * GdiEntry13
2641 ULONG WINAPI DdQueryDisplaySettingsUniqueness(void)
2643 static int warn_once;
2644 if (!warn_once++) FIXME( "stub\n" );
2645 return 0;