gdi32: Handle metafiles directly in SetViewportOrgEx.
[wine.git] / dlls / gdi32 / gdidc.c
blob026fde6a0281d2d9a552c3a7a9896fe479e3118c
1 /*
2 * GDI Device Context functions
4 * Copyright 1993, 1994 Alexandre Julliard
5 * Copyright 1997 Bertho A. Stultiens
6 * 1999 Huw D M Davies
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "gdi_private.h"
24 #include "winternl.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(gdi);
30 DC_ATTR *get_dc_attr( HDC hdc )
32 WORD type = gdi_handle_type( hdc );
33 DC_ATTR *dc_attr;
34 if ((type & 0x1f) != NTGDI_OBJ_DC || !(dc_attr = get_gdi_client_ptr( hdc, 0 )))
36 SetLastError( ERROR_INVALID_HANDLE );
37 return NULL;
39 return dc_attr->disabled ? NULL : dc_attr;
42 /***********************************************************************
43 * CreateDCA (GDI32.@)
45 HDC WINAPI CreateDCA( const char *driver, const char *device, const char *output,
46 const DEVMODEA *init_data )
48 UNICODE_STRING driverW, deviceW, outputW;
49 DEVMODEW *init_dataW = NULL;
50 HDC ret;
52 if (driver) RtlCreateUnicodeStringFromAsciiz( &driverW, driver );
53 else driverW.Buffer = NULL;
55 if (device) RtlCreateUnicodeStringFromAsciiz( &deviceW, device );
56 else deviceW.Buffer = NULL;
58 if (output) RtlCreateUnicodeStringFromAsciiz( &outputW, output );
59 else outputW.Buffer = NULL;
61 if (init_data)
63 /* don't convert init_data for DISPLAY driver, it's not used */
64 if (!driverW.Buffer || wcsicmp( driverW.Buffer, L"display" ))
65 init_dataW = GdiConvertToDevmodeW( init_data );
68 ret = CreateDCW( driverW.Buffer, deviceW.Buffer, outputW.Buffer, init_dataW );
70 RtlFreeUnicodeString( &driverW );
71 RtlFreeUnicodeString( &deviceW );
72 RtlFreeUnicodeString( &outputW );
73 HeapFree( GetProcessHeap(), 0, init_dataW );
74 return ret;
77 /***********************************************************************
78 * CreateICA (GDI32.@)
80 HDC WINAPI CreateICA( const char *driver, const char *device, const char *output,
81 const DEVMODEA *init_data )
83 /* Nothing special yet for ICs */
84 return CreateDCA( driver, device, output, init_data );
88 /***********************************************************************
89 * CreateICW (GDI32.@)
91 HDC WINAPI CreateICW( const WCHAR *driver, const WCHAR *device, const WCHAR *output,
92 const DEVMODEW *init_data )
94 /* Nothing special yet for ICs */
95 return CreateDCW( driver, device, output, init_data );
98 /***********************************************************************
99 * ResetDCA (GDI32.@)
101 HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
103 DEVMODEW *devmodeW;
104 HDC ret;
106 if (devmode) devmodeW = GdiConvertToDevmodeW( devmode );
107 else devmodeW = NULL;
109 ret = ResetDCW( hdc, devmodeW );
111 HeapFree( GetProcessHeap(), 0, devmodeW );
112 return ret;
115 /***********************************************************************
116 * SaveDC (GDI32.@)
118 INT WINAPI SaveDC( HDC hdc )
120 DC_ATTR *dc_attr;
122 if (is_meta_dc( hdc )) return METADC_SaveDC( hdc );
123 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
124 if (dc_attr->emf && !EMFDC_SaveDC( dc_attr )) return FALSE;
125 return NtGdiSaveDC( hdc );
128 /***********************************************************************
129 * GetDeviceCaps (GDI32.@)
131 INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
133 if (is_meta_dc( hdc )) return METADC_GetDeviceCaps( hdc, cap );
134 if (!get_dc_attr( hdc )) return FALSE;
135 return NtGdiGetDeviceCaps( hdc, cap );
138 /***********************************************************************
139 * GetTextAlign (GDI32.@)
141 UINT WINAPI GetTextAlign( HDC hdc )
143 DC_ATTR *dc_attr = get_dc_attr( hdc );
144 return dc_attr ? dc_attr->text_align : 0;
147 /***********************************************************************
148 * SetTextAlign (GDI32.@)
150 UINT WINAPI SetTextAlign( HDC hdc, UINT align )
152 DC_ATTR *dc_attr;
153 UINT ret;
155 TRACE("hdc=%p align=%d\n", hdc, align);
157 if (is_meta_dc( hdc )) return METADC_SetTextAlign( hdc, align );
158 if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
159 if (dc_attr->emf && !EMFDC_SetTextAlign( dc_attr, align )) return GDI_ERROR;
161 ret = dc_attr->text_align;
162 dc_attr->text_align = align;
163 return ret;
166 /***********************************************************************
167 * GetBkColor (GDI32.@)
169 COLORREF WINAPI GetBkColor( HDC hdc )
171 DC_ATTR *dc_attr = get_dc_attr( hdc );
172 return dc_attr ? dc_attr->background_color : CLR_INVALID;
175 /***********************************************************************
176 * GetDCBrushColor (GDI32.@)
178 COLORREF WINAPI GetDCBrushColor( HDC hdc )
180 DC_ATTR *dc_attr = get_dc_attr( hdc );
181 return dc_attr ? dc_attr->brush_color : CLR_INVALID;
184 /***********************************************************************
185 * GetDCPenColor (GDI32.@)
187 COLORREF WINAPI GetDCPenColor(HDC hdc)
189 DC_ATTR *dc_attr = get_dc_attr( hdc );
190 return dc_attr ? dc_attr->pen_color : CLR_INVALID;
193 /***********************************************************************
194 * GetTextColor (GDI32.@)
196 COLORREF WINAPI GetTextColor( HDC hdc )
198 DC_ATTR *dc_attr = get_dc_attr( hdc );
199 return dc_attr ? dc_attr->text_color : 0;
202 /***********************************************************************
203 * GetBkMode (GDI32.@)
205 INT WINAPI GetBkMode( HDC hdc )
207 DC_ATTR *dc_attr = get_dc_attr( hdc );
208 return dc_attr ? dc_attr->background_mode : 0;
211 /***********************************************************************
212 * SetBkMode (GDI32.@)
214 INT WINAPI SetBkMode( HDC hdc, INT mode )
216 DC_ATTR *dc_attr;
217 INT ret;
219 if (mode <= 0 || mode > BKMODE_LAST)
221 SetLastError(ERROR_INVALID_PARAMETER);
222 return 0;
225 if (is_meta_dc( hdc )) return METADC_SetBkMode( hdc, mode );
226 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
227 if (dc_attr->emf && !EMFDC_SetBkMode( dc_attr, mode )) return 0;
229 ret = dc_attr->background_mode;
230 dc_attr->background_mode = mode;
231 return ret;
234 /***********************************************************************
235 * GetGraphicsMode (GDI32.@)
237 INT WINAPI GetGraphicsMode( HDC hdc )
239 DC_ATTR *dc_attr = get_dc_attr( hdc );
240 return dc_attr ? dc_attr->graphics_mode : 0;
243 /***********************************************************************
244 * GetArcDirection (GDI32.@)
246 INT WINAPI GetArcDirection( HDC hdc )
248 DC_ATTR *dc_attr = get_dc_attr( hdc );
249 return dc_attr ? dc_attr->arc_direction : 0;
252 /***********************************************************************
253 * SetArcDirection (GDI32.@)
255 INT WINAPI SetArcDirection( HDC hdc, INT dir )
257 DC_ATTR *dc_attr;
258 INT ret;
260 if (dir != AD_COUNTERCLOCKWISE && dir != AD_CLOCKWISE)
262 SetLastError(ERROR_INVALID_PARAMETER);
263 return 0;
266 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
267 if (dc_attr->emf && !EMFDC_SetArcDirection( dc_attr, dir )) return 0;
269 ret = dc_attr->arc_direction;
270 dc_attr->arc_direction = dir;
271 return ret;
274 /***********************************************************************
275 * GetLayout (GDI32.@)
277 DWORD WINAPI GetLayout( HDC hdc )
279 DC_ATTR *dc_attr = get_dc_attr( hdc );
280 return dc_attr ? dc_attr->layout : GDI_ERROR;
283 /***********************************************************************
284 * SetLayout (GDI32.@)
286 DWORD WINAPI SetLayout( HDC hdc, DWORD layout )
288 DC_ATTR *dc_attr;
290 if (is_meta_dc( hdc )) return METADC_SetLayout( hdc, layout );
291 if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
292 if (dc_attr->emf && !EMFDC_SetLayout( dc_attr, layout )) return GDI_ERROR;
293 return NtGdiSetLayout( hdc, -1, layout );
296 /***********************************************************************
297 * GetMapMode (GDI32.@)
299 INT WINAPI GetMapMode( HDC hdc )
301 DC_ATTR *dc_attr = get_dc_attr( hdc );
302 return dc_attr ? dc_attr->map_mode : 0;
305 /***********************************************************************
306 * SetMapMode (GDI32.@)
308 INT WINAPI SetMapMode( HDC hdc, INT mode )
310 DC_ATTR *dc_attr;
311 DWORD ret;
313 TRACE("%p %d\n", hdc, mode );
315 if (is_meta_dc( hdc )) return METADC_SetMapMode( hdc, mode );
316 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
317 if (dc_attr->emf && !EMFDC_SetMapMode( dc_attr, mode )) return 0;
318 return NtGdiGetAndSetDCDword( hdc, NtGdiSetMapMode, mode, &ret ) ? ret : 0;
321 /***********************************************************************
322 * GetTextCharacterExtra (GDI32.@)
324 INT WINAPI GetTextCharacterExtra( HDC hdc )
326 DC_ATTR *dc_attr = get_dc_attr( hdc );
327 return dc_attr ? dc_attr->char_extra : 0x80000000;
330 /***********************************************************************
331 * SetTextCharacterExtra (GDI32.@)
333 INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
335 DC_ATTR *dc_attr;
336 INT ret;
338 if (is_meta_dc( hdc )) return METADC_SetTextCharacterExtra( hdc, extra );
339 if (!(dc_attr = get_dc_attr( hdc ))) return 0x8000000;
340 ret = dc_attr->char_extra;
341 dc_attr->char_extra = extra;
342 return ret;
345 /***********************************************************************
346 * SetMapperFlags (GDI32.@)
348 DWORD WINAPI SetMapperFlags( HDC hdc, DWORD flags )
350 DC_ATTR *dc_attr;
351 DWORD ret;
353 if (is_meta_dc( hdc )) return METADC_SetMapperFlags( hdc, flags );
354 if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
355 if (dc_attr->emf && !EMFDC_SetMapperFlags( dc_attr, flags )) return GDI_ERROR;
356 ret = dc_attr->mapper_flags;
357 dc_attr->mapper_flags = flags;
358 return ret;
361 /***********************************************************************
362 * GetPolyFillMode (GDI32.@)
364 INT WINAPI GetPolyFillMode( HDC hdc )
366 DC_ATTR *dc_attr = get_dc_attr( hdc );
367 return dc_attr ? dc_attr->poly_fill_mode : 0;
370 /***********************************************************************
371 * SetPolyFillMode (GDI32.@)
373 INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
375 DC_ATTR *dc_attr;
376 INT ret;
378 if (mode <= 0 || mode > POLYFILL_LAST)
380 SetLastError(ERROR_INVALID_PARAMETER);
381 return 0;
384 if (is_meta_dc( hdc )) return METADC_SetPolyFillMode( hdc, mode );
385 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
386 if (dc_attr->emf && !EMFDC_SetPolyFillMode( dc_attr, mode )) return 0;
388 ret = dc_attr->poly_fill_mode;
389 dc_attr->poly_fill_mode = mode;
390 return ret;
393 /***********************************************************************
394 * GetStretchBltMode (GDI32.@)
396 INT WINAPI GetStretchBltMode( HDC hdc )
398 DC_ATTR *dc_attr = get_dc_attr( hdc );
399 return dc_attr ? dc_attr->stretch_blt_mode : 0;
402 /***********************************************************************
403 * GetBrushOrgEx (GDI32.@)
405 BOOL WINAPI GetBrushOrgEx( HDC hdc, POINT *point )
407 DC_ATTR *dc_attr;
408 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
409 *point = dc_attr->brush_org;
410 return TRUE;
413 /***********************************************************************
414 * SetBrushOrgEx (GDI32.@)
416 BOOL WINAPI SetBrushOrgEx( HDC hdc, INT x, INT y, POINT *oldorg )
418 DC_ATTR *dc_attr;
419 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
420 if (oldorg) *oldorg = dc_attr->brush_org;
421 dc_attr->brush_org.x = x;
422 dc_attr->brush_org.y = y;
423 return TRUE;
426 /***********************************************************************
427 * FixBrushOrgEx (GDI32.@)
429 BOOL WINAPI FixBrushOrgEx( HDC hdc, INT x, INT y, POINT *oldorg )
431 return SetBrushOrgEx( hdc, x, y, oldorg );
434 /***********************************************************************
435 * GetDCOrgEx (GDI32.@)
437 BOOL WINAPI GetDCOrgEx( HDC hdc, POINT *point )
439 DC_ATTR *dc_attr;
440 if (!point || !(dc_attr = get_dc_attr( hdc ))) return FALSE;
441 point->x = dc_attr->vis_rect.left;
442 point->y = dc_attr->vis_rect.top;
443 return TRUE;
446 /***********************************************************************
447 * GetWindowExtEx (GDI32.@)
449 BOOL WINAPI GetWindowExtEx( HDC hdc, SIZE *size )
451 DC_ATTR *dc_attr;
452 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
453 *size = dc_attr->wnd_ext;
454 return TRUE;
457 /***********************************************************************
458 * GetWindowOrgEx (GDI32.@)
460 BOOL WINAPI GetWindowOrgEx( HDC hdc, POINT *point )
462 DC_ATTR *dc_attr;
463 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
464 *point = dc_attr->wnd_org;
465 return TRUE;
468 /***********************************************************************
469 * GetViewportExtEx (GDI32.@)
471 BOOL WINAPI GetViewportExtEx( HDC hdc, SIZE *size )
473 DC_ATTR *dc_attr;
474 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
475 *size = dc_attr->vport_ext;
476 return TRUE;
479 /***********************************************************************
480 * SetViewportExtEx (GDI32.@)
482 BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size )
484 DC_ATTR *dc_attr;
486 if (is_meta_dc( hdc )) return METADC_SetViewportExtEx( hdc, x, y );
487 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
488 if (dc_attr->emf && !EMFDC_SetViewportExtEx( dc_attr, x, y )) return FALSE;
490 if (size) *size = dc_attr->vport_ext;
491 if (dc_attr->map_mode != MM_ISOTROPIC && dc_attr->map_mode != MM_ANISOTROPIC) return TRUE;
492 if (!x || !y) return FALSE;
493 dc_attr->vport_ext.cx = x;
494 dc_attr->vport_ext.cy = y;
495 return NtGdiComputeXformCoefficients( hdc );
498 /***********************************************************************
499 * GetViewportOrgEx (GDI32.@)
501 BOOL WINAPI GetViewportOrgEx( HDC hdc, POINT *point )
503 DC_ATTR *dc_attr;
504 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
505 *point = dc_attr->vport_org;
506 return TRUE;
509 /***********************************************************************
510 * SetViewportOrgEx (GDI32.@)
512 BOOL WINAPI SetViewportOrgEx( HDC hdc, INT x, INT y, POINT *point )
514 DC_ATTR *dc_attr;
516 if (is_meta_dc( hdc )) return METADC_SetViewportOrgEx( hdc, x, y );
517 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
518 if (dc_attr->emf && !EMFDC_SetViewportOrgEx( dc_attr, x, y )) return FALSE;
520 if (point) *point = dc_attr->vport_org;
521 dc_attr->vport_org.x = x;
522 dc_attr->vport_org.y = y;
523 return NtGdiComputeXformCoefficients( hdc );
526 /***********************************************************************
527 * GetWorldTransform (GDI32.@)
529 BOOL WINAPI GetWorldTransform( HDC hdc, XFORM *xform )
531 return NtGdiGetTransform( hdc, 0x203, xform );
534 /***********************************************************************
535 * SetStretchBltMode (GDI32.@)
537 INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
539 DC_ATTR *dc_attr;
540 INT ret;
542 if (mode <= 0 || mode > MAXSTRETCHBLTMODE)
544 SetLastError(ERROR_INVALID_PARAMETER);
545 return 0;
548 if (is_meta_dc( hdc )) return METADC_SetStretchBltMode( hdc, mode );
549 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
550 if (dc_attr->emf && !EMFDC_SetStretchBltMode( dc_attr, mode )) return 0;
552 ret = dc_attr->stretch_blt_mode;
553 dc_attr->stretch_blt_mode = mode;
554 return ret;
557 /***********************************************************************
558 * GetCurrentPositionEx (GDI32.@)
560 BOOL WINAPI GetCurrentPositionEx( HDC hdc, POINT *point )
562 DC_ATTR *dc_attr;
563 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
564 *point = dc_attr->cur_pos;
565 return TRUE;
568 /***********************************************************************
569 * GetROP2 (GDI32.@)
571 INT WINAPI GetROP2( HDC hdc )
573 DC_ATTR *dc_attr = get_dc_attr( hdc );
574 return dc_attr ? dc_attr->rop_mode : 0;
577 /***********************************************************************
578 * GetRelAbs (GDI32.@)
580 INT WINAPI GetRelAbs( HDC hdc, DWORD ignore )
582 DC_ATTR *dc_attr = get_dc_attr( hdc );
583 return dc_attr ? dc_attr->rel_abs_mode : 0;
586 /***********************************************************************
587 * SetRelAbs (GDI32.@)
589 INT WINAPI SetRelAbs( HDC hdc, INT mode )
591 DC_ATTR *dc_attr;
592 INT ret;
594 if (mode != ABSOLUTE && mode != RELATIVE)
596 SetLastError(ERROR_INVALID_PARAMETER);
597 return 0;
600 if (is_meta_dc( hdc )) return METADC_SetRelAbs( hdc, mode );
601 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
602 ret = dc_attr->rel_abs_mode;
603 dc_attr->rel_abs_mode = mode;
604 return ret;
607 /***********************************************************************
608 * SetROP2 (GDI32.@)
610 INT WINAPI SetROP2( HDC hdc, INT mode )
612 DC_ATTR *dc_attr;
613 INT ret;
615 if ((mode < R2_BLACK) || (mode > R2_WHITE))
617 SetLastError(ERROR_INVALID_PARAMETER);
618 return 0;
621 if (is_meta_dc( hdc )) return METADC_SetROP2( hdc, mode );
622 if (!(dc_attr = get_dc_attr( hdc ))) return 0;
623 if (dc_attr->emf && !EMFDC_SetROP2( dc_attr, mode )) return 0;
625 ret = dc_attr->rop_mode;
626 dc_attr->rop_mode = mode;
627 return ret;
630 /***********************************************************************
631 * GetMiterLimit (GDI32.@)
633 BOOL WINAPI GetMiterLimit( HDC hdc, FLOAT *limit )
635 DC_ATTR *dc_attr;
636 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
637 if (limit) *limit = dc_attr->miter_limit;
638 return TRUE;
641 /*******************************************************************
642 * SetMiterLimit (GDI32.@)
644 BOOL WINAPI SetMiterLimit( HDC hdc, FLOAT limit, FLOAT *old_limit )
646 DC_ATTR *dc_attr;
647 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
648 /* FIXME: record EMFs */
649 if (old_limit) *old_limit = dc_attr->miter_limit;
650 dc_attr->miter_limit = limit;
651 return TRUE;
654 /***********************************************************************
655 * SetPixel (GDI32.@)
657 COLORREF WINAPI SetPixel( HDC hdc, INT x, INT y, COLORREF color )
659 DC_ATTR *dc_attr;
661 if (is_meta_dc( hdc )) return METADC_SetPixel( hdc, x, y, color );
662 if (!(dc_attr = get_dc_attr( hdc ))) return CLR_INVALID;
663 if (dc_attr->emf && !EMFDC_SetPixel( dc_attr, x, y, color )) return CLR_INVALID;
664 return NtGdiSetPixel( hdc, x, y, color );
667 /***********************************************************************
668 * SetPixelV (GDI32.@)
670 BOOL WINAPI SetPixelV( HDC hdc, INT x, INT y, COLORREF color )
672 return SetPixel( hdc, x, y, color ) != CLR_INVALID;
675 /***********************************************************************
676 * LineTo (GDI32.@)
678 BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
680 DC_ATTR *dc_attr;
682 TRACE( "%p, (%d, %d)\n", hdc, x, y );
684 if (is_meta_dc( hdc )) return METADC_LineTo( hdc, x, y );
685 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
686 if (dc_attr->emf && !EMFDC_LineTo( dc_attr, x, y )) return FALSE;
687 return NtGdiLineTo( hdc, x, y );
690 /***********************************************************************
691 * MoveToEx (GDI32.@)
693 BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, POINT *pt )
695 DC_ATTR *dc_attr;
697 TRACE( "%p, (%d, %d), %p\n", hdc, x, y, pt );
699 if (is_meta_dc( hdc )) return METADC_MoveTo( hdc, x, y );
700 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
701 if (dc_attr->emf && !EMFDC_MoveTo( dc_attr, x, y )) return FALSE;
702 return NtGdiMoveTo( hdc, x, y, pt );
705 /***********************************************************************
706 * Arc (GDI32.@)
708 BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, INT bottom,
709 INT xstart, INT ystart, INT xend, INT yend )
711 DC_ATTR *dc_attr;
713 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
714 right, bottom, xstart, ystart, xend, yend );
716 if (is_meta_dc( hdc ))
717 return METADC_Arc( hdc, left, top, right, bottom,
718 xstart, ystart, xend, yend );
720 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
721 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
722 xstart, ystart, xend, yend, EMR_ARC ))
723 return FALSE;
725 return NtGdiArcInternal( NtGdiArc, hdc, left, top, right, bottom,
726 xstart, ystart, xend, yend );
729 /***********************************************************************
730 * ArcTo (GDI32.@)
732 BOOL WINAPI ArcTo( HDC hdc, INT left, INT top, INT right, INT bottom,
733 INT xstart, INT ystart, INT xend, INT yend )
735 DC_ATTR *dc_attr;
737 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
738 right, bottom, xstart, ystart, xend, yend );
740 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
741 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
742 xstart, ystart, xend, yend, EMR_ARCTO ))
743 return FALSE;
745 return NtGdiArcInternal( NtGdiArcTo, hdc, left, top, right, bottom,
746 xstart, ystart, xend, yend );
749 /***********************************************************************
750 * Chord (GDI32.@)
752 BOOL WINAPI Chord( HDC hdc, INT left, INT top, INT right, INT bottom,
753 INT xstart, INT ystart, INT xend, INT yend )
755 DC_ATTR *dc_attr;
757 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
758 right, bottom, xstart, ystart, xend, yend );
760 if (is_meta_dc( hdc ))
761 return METADC_Chord( hdc, left, top, right, bottom,
762 xstart, ystart, xend, yend );
764 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
765 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
766 xstart, ystart, xend, yend, EMR_CHORD ))
767 return FALSE;
769 return NtGdiArcInternal( NtGdiChord, hdc, left, top, right, bottom,
770 xstart, ystart, xend, yend );
773 /***********************************************************************
774 * Pie (GDI32.@)
776 BOOL WINAPI Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
777 INT xstart, INT ystart, INT xend, INT yend )
779 DC_ATTR *dc_attr;
781 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc, left, top,
782 right, bottom, xstart, ystart, xend, yend );
784 if (is_meta_dc( hdc ))
785 return METADC_Pie( hdc, left, top, right, bottom,
786 xstart, ystart, xend, yend );
788 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
789 if (dc_attr->emf && !EMFDC_ArcChordPie( dc_attr, left, top, right, bottom,
790 xstart, ystart, xend, yend, EMR_PIE ))
791 return FALSE;
793 return NtGdiArcInternal( NtGdiPie, hdc, left, top, right, bottom,
794 xstart, ystart, xend, yend );
797 /***********************************************************************
798 * AngleArc (GDI32.@)
800 BOOL WINAPI AngleArc( HDC hdc, INT x, INT y, DWORD radius, FLOAT start_angle, FLOAT sweep_angle )
802 DC_ATTR *dc_attr;
804 TRACE( "%p, (%d, %d), %u, %f, %f\n", hdc, x, y, radius, start_angle, sweep_angle );
806 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
807 if (dc_attr->emf && !EMFDC_AngleArc( dc_attr, x, y, radius, start_angle, sweep_angle ))
808 return FALSE;
809 return NtGdiAngleArc( hdc, x, y, radius, start_angle, sweep_angle );
812 /***********************************************************************
813 * Ellipse (GDI32.@)
815 BOOL WINAPI Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
817 DC_ATTR *dc_attr;
819 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc, left, top, right, bottom );
821 if (is_meta_dc( hdc )) return METADC_Ellipse( hdc, left, top, right, bottom );
822 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
823 if (dc_attr->emf && !EMFDC_Ellipse( dc_attr, left, top, right, bottom )) return FALSE;
824 return NtGdiEllipse( hdc, left, top, right, bottom );
827 /***********************************************************************
828 * Rectangle (GDI32.@)
830 BOOL WINAPI Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
832 DC_ATTR *dc_attr;
834 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc, left, top, right, bottom );
836 if (is_meta_dc( hdc )) return METADC_Rectangle( hdc, left, top, right, bottom );
837 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
838 if (dc_attr->emf && !EMFDC_Rectangle( dc_attr, left, top, right, bottom )) return FALSE;
839 return NtGdiRectangle( hdc, left, top, right, bottom );
842 /***********************************************************************
843 * RoundRect (GDI32.@)
845 BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
846 INT bottom, INT ell_width, INT ell_height )
848 DC_ATTR *dc_attr;
850 TRACE( "%p, (%d, %d)-(%d, %d), %dx%d\n", hdc, left, top, right, bottom,
851 ell_width, ell_height );
853 if (is_meta_dc( hdc ))
854 return METADC_RoundRect( hdc, left, top, right, bottom, ell_width, ell_height );
856 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
857 if (dc_attr->emf && !EMFDC_RoundRect( dc_attr, left, top, right, bottom,
858 ell_width, ell_height ))
859 return FALSE;
861 return NtGdiRoundRect( hdc, left, top, right, bottom, ell_width, ell_height );
864 /**********************************************************************
865 * Polygon (GDI32.@)
867 BOOL WINAPI Polygon( HDC hdc, const POINT *points, INT count )
869 DC_ATTR *dc_attr;
871 TRACE( "%p, %p, %d\n", hdc, points, count );
873 if (is_meta_dc( hdc )) return METADC_Polygon( hdc, points, count );
874 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
875 if (dc_attr->emf && !EMFDC_Polygon( dc_attr, points, count )) return FALSE;
876 return NtGdiPolyPolyDraw( hdc, points, (const UINT *)&count, 1, NtGdiPolyPolygon );
879 /**********************************************************************
880 * PolyPolygon (GDI32.@)
882 BOOL WINAPI PolyPolygon( HDC hdc, const POINT *points, const INT *counts, UINT polygons )
884 DC_ATTR *dc_attr;
886 TRACE( "%p, %p, %p, %u\n", hdc, points, counts, polygons );
888 if (is_meta_dc( hdc )) return METADC_PolyPolygon( hdc, points, counts, polygons );
889 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
890 if (dc_attr->emf && !EMFDC_PolyPolygon( dc_attr, points, counts, polygons )) return FALSE;
891 return NtGdiPolyPolyDraw( hdc, points, (const UINT *)counts, polygons, NtGdiPolyPolygon );
894 /**********************************************************************
895 * Polyline (GDI32.@)
897 BOOL WINAPI Polyline( HDC hdc, const POINT *points, INT count )
899 DC_ATTR *dc_attr;
901 TRACE( "%p, %p, %d\n", hdc, points, count );
903 if (is_meta_dc( hdc )) return METADC_Polyline( hdc, points, count );
904 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
905 if (dc_attr->emf && !EMFDC_Polyline( dc_attr, points, count )) return FALSE;
906 return NtGdiPolyPolyDraw( hdc, points, (const UINT *)&count, 1, NtGdiPolyPolyline );
909 /**********************************************************************
910 * PolyPolyline (GDI32.@)
912 BOOL WINAPI PolyPolyline( HDC hdc, const POINT *points, const DWORD *counts, DWORD polylines )
914 DC_ATTR *dc_attr;
916 TRACE( "%p, %p, %p, %u\n", hdc, points, counts, polylines );
918 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
919 if (dc_attr->emf && !EMFDC_PolyPolyline( dc_attr, points, counts, polylines )) return FALSE;
920 return NtGdiPolyPolyDraw( hdc, points, counts, polylines, NtGdiPolyPolyline );
923 /******************************************************************************
924 * PolyBezier (GDI32.@)
926 BOOL WINAPI PolyBezier( HDC hdc, const POINT *points, DWORD count )
928 DC_ATTR *dc_attr;
930 TRACE( "%p, %p, %u\n", hdc, points, count );
932 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
933 if (dc_attr->emf && !EMFDC_PolyBezier( dc_attr, points, count )) return FALSE;
934 return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyBezier );
937 /******************************************************************************
938 * PolyBezierTo (GDI32.@)
940 BOOL WINAPI PolyBezierTo( HDC hdc, const POINT *points, DWORD count )
942 DC_ATTR *dc_attr;
944 TRACE( "%p, %p, %u\n", hdc, points, count );
946 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
947 if (dc_attr->emf && !EMFDC_PolyBezierTo( dc_attr, points, count )) return FALSE;
948 return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolyBezierTo );
951 /**********************************************************************
952 * PolylineTo (GDI32.@)
954 BOOL WINAPI PolylineTo( HDC hdc, const POINT *points, DWORD count )
956 DC_ATTR *dc_attr;
958 TRACE( "%p, %p, %u\n", hdc, points, count );
960 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
961 if (dc_attr->emf && !EMFDC_PolylineTo( dc_attr, points, count )) return FALSE;
962 return NtGdiPolyPolyDraw( hdc, points, &count, 1, NtGdiPolylineTo );
965 /***********************************************************************
966 * PolyDraw (GDI32.@)
968 BOOL WINAPI PolyDraw( HDC hdc, const POINT *points, const BYTE *types, DWORD count )
970 DC_ATTR *dc_attr;
972 TRACE( "%p, %p, %p, %u\n", hdc, points, types, count );
974 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
975 if (dc_attr->emf && !EMFDC_PolyDraw( dc_attr, points, types, count )) return FALSE;
976 return NtGdiPolyDraw( hdc, points, types, count );
979 /***********************************************************************
980 * FillRgn (GDI32.@)
982 BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
984 DC_ATTR *dc_attr;
986 TRACE( "%p, %p, %p\n", hdc, hrgn, hbrush );
988 if (is_meta_dc( hdc )) return METADC_FillRgn( hdc, hrgn, hbrush );
989 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
990 if (dc_attr->emf && !EMFDC_FillRgn( dc_attr, hrgn, hbrush )) return FALSE;
991 return NtGdiFillRgn( hdc, hrgn, hbrush );
994 /***********************************************************************
995 * PaintRgn (GDI32.@)
997 BOOL WINAPI PaintRgn( HDC hdc, HRGN hrgn )
999 DC_ATTR *dc_attr;
1001 TRACE( "%p, %p\n", hdc, hrgn );
1003 if (is_meta_dc( hdc )) return METADC_PaintRgn( hdc, hrgn );
1004 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1005 if (dc_attr->emf && !EMFDC_PaintRgn( dc_attr, hrgn )) return FALSE;
1006 return NtGdiFillRgn( hdc, hrgn, GetCurrentObject( hdc, OBJ_BRUSH ));
1009 /***********************************************************************
1010 * FrameRgn (GDI32.@)
1012 BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
1014 DC_ATTR *dc_attr;
1016 TRACE( "%p, %p, %p, %dx%d\n", hdc, hrgn, hbrush, width, height );
1018 if (is_meta_dc( hdc )) return METADC_FrameRgn( hdc, hrgn, hbrush, width, height );
1019 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1020 if (dc_attr->emf && !EMFDC_FrameRgn( dc_attr, hrgn, hbrush, width, height ))
1021 return FALSE;
1022 return NtGdiFrameRgn( hdc, hrgn, hbrush, width, height );
1025 /***********************************************************************
1026 * InvertRgn (GDI32.@)
1028 BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
1030 DC_ATTR *dc_attr;
1032 TRACE( "%p, %p\n", hdc, hrgn );
1034 if (is_meta_dc( hdc )) return METADC_InvertRgn( hdc, hrgn );
1035 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1036 if (dc_attr->emf && !EMFDC_InvertRgn( dc_attr, hrgn )) return FALSE;
1037 return NtGdiInvertRgn( hdc, hrgn );
1040 /***********************************************************************
1041 * ExtFloodFill (GDI32.@)
1043 BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, UINT fill_type )
1045 DC_ATTR *dc_attr;
1047 TRACE( "%p, (%d, %d), %08x, %x\n", hdc, x, y, color, fill_type );
1049 if (is_meta_dc( hdc )) return METADC_ExtFloodFill( hdc, x, y, color, fill_type );
1050 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1051 if (dc_attr->emf && !EMFDC_ExtFloodFill( dc_attr, x, y, color, fill_type )) return FALSE;
1052 return NtGdiExtFloodFill( hdc, x, y, color, fill_type );
1055 /***********************************************************************
1056 * FloodFill (GDI32.@)
1058 BOOL WINAPI FloodFill( HDC hdc, INT x, INT y, COLORREF color )
1060 return ExtFloodFill( hdc, x, y, color, FLOODFILLBORDER );
1063 /******************************************************************************
1064 * GdiGradientFill (GDI32.@)
1066 BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
1067 void *grad_array, ULONG ngrad, ULONG mode )
1069 DC_ATTR *dc_attr;
1071 TRACE( "%p vert_array:%p nvert:%d grad_array:%p ngrad:%d\n", hdc, vert_array,
1072 nvert, grad_array, ngrad );
1074 if (!(dc_attr = get_dc_attr( hdc )))
1076 SetLastError( ERROR_INVALID_PARAMETER );
1077 return FALSE;
1079 if (dc_attr->emf &&
1080 !EMFDC_GradientFill( dc_attr, vert_array, nvert, grad_array, ngrad, mode ))
1081 return FALSE;
1082 return NtGdiGradientFill( hdc, vert_array, nvert, grad_array, ngrad, mode );
1085 /***********************************************************************
1086 * ExtTextOutW (GDI32.@)
1088 BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *rect,
1089 const WCHAR *str, UINT count, const INT *dx )
1091 DC_ATTR *dc_attr;
1093 if (is_meta_dc( hdc )) return METADC_ExtTextOut( hdc, x, y, flags, rect, str, count, dx );
1094 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1095 if (dc_attr->emf && !EMFDC_ExtTextOut( dc_attr, x, y, flags, rect, str, count, dx ))
1096 return FALSE;
1097 return NtGdiExtTextOutW( hdc, x, y, flags, rect, str, count, dx, 0 );
1100 /***********************************************************************
1101 * SetTextJustification (GDI32.@)
1103 BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
1105 DC_ATTR *dc_attr;
1107 if (is_meta_dc( hdc )) return METADC_SetTextJustification( hdc, extra, breaks );
1108 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1109 if (dc_attr->emf && !EMFDC_SetTextJustification( dc_attr, extra, breaks ))
1110 return FALSE;
1111 return NtGdiSetTextJustification( hdc, extra, breaks );
1114 /***********************************************************************
1115 * PatBlt (GDI32.@)
1117 BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop )
1119 DC_ATTR *dc_attr;
1121 if (is_meta_dc( hdc )) return METADC_PatBlt( hdc, left, top, width, height, rop );
1122 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1123 if (dc_attr->emf && !EMFDC_PatBlt( dc_attr, left, top, width, height, rop ))
1124 return FALSE;
1125 return NtGdiPatBlt( hdc, left, top, width, height, rop );
1128 /***********************************************************************
1129 * BeginPath (GDI32.@)
1131 BOOL WINAPI BeginPath(HDC hdc)
1133 DC_ATTR *dc_attr;
1135 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1136 if (dc_attr->emf && !EMFDC_BeginPath( dc_attr )) return FALSE;
1137 return NtGdiBeginPath( hdc );
1140 /***********************************************************************
1141 * EndPath (GDI32.@)
1143 BOOL WINAPI EndPath(HDC hdc)
1145 DC_ATTR *dc_attr;
1147 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1148 if (dc_attr->emf && !EMFDC_EndPath( dc_attr )) return FALSE;
1149 return NtGdiEndPath( hdc );
1152 /***********************************************************************
1153 * AbortPath (GDI32.@)
1155 BOOL WINAPI AbortPath( HDC hdc )
1157 DC_ATTR *dc_attr;
1159 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1160 if (dc_attr->emf && !EMFDC_AbortPath( dc_attr )) return FALSE;
1161 return NtGdiAbortPath( hdc );
1164 /***********************************************************************
1165 * CloseFigure (GDI32.@)
1167 BOOL WINAPI CloseFigure( HDC hdc )
1169 DC_ATTR *dc_attr;
1171 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1172 if (dc_attr->emf && !EMFDC_CloseFigure( dc_attr )) return FALSE;
1173 return NtGdiCloseFigure( hdc );
1176 /***********************************************************************
1177 * IntersectClipRect (GDI32.@)
1179 INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
1181 DC_ATTR *dc_attr;
1183 TRACE("%p %d,%d - %d,%d\n", hdc, left, top, right, bottom );
1185 if (is_meta_dc( hdc )) return METADC_IntersectClipRect( hdc, left, top, right, bottom );
1186 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1187 if (dc_attr->emf && !EMFDC_IntersectClipRect( dc_attr, left, top, right, bottom ))
1188 return FALSE;
1189 return NtGdiIntersectClipRect( hdc, left, top, right, bottom );
1192 /***********************************************************************
1193 * OffsetClipRgn (GDI32.@)
1195 INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
1197 DC_ATTR *dc_attr;
1199 if (is_meta_dc( hdc )) return METADC_OffsetClipRgn( hdc, x, y );
1200 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1201 if (dc_attr->emf && !EMFDC_OffsetClipRgn( dc_attr, x, y )) return FALSE;
1202 return NtGdiOffsetClipRgn( hdc, x, y );
1205 /***********************************************************************
1206 * ExcludeClipRect (GDI32.@)
1208 INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
1210 DC_ATTR *dc_attr;
1212 if (is_meta_dc( hdc )) return METADC_ExcludeClipRect( hdc, left, top, right, bottom );
1213 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1214 if (dc_attr->emf && !EMFDC_ExcludeClipRect( dc_attr, left, top, right, bottom ))
1215 return FALSE;
1216 return NtGdiExcludeClipRect( hdc, left, top, right, bottom );
1219 /******************************************************************************
1220 * ExtSelectClipRgn (GDI32.@)
1222 INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT mode )
1224 DC_ATTR *dc_attr;
1226 TRACE("%p %p %d\n", hdc, hrgn, mode );
1228 if (is_meta_dc( hdc )) return METADC_ExtSelectClipRgn( hdc, hrgn, mode );
1229 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1230 if (dc_attr->emf && !EMFDC_ExtSelectClipRgn( dc_attr, hrgn, mode ))
1231 return FALSE;
1232 return NtGdiExtSelectClipRgn( hdc, hrgn, mode );
1235 /***********************************************************************
1236 * SelectClipRgn (GDI32.@)
1238 INT WINAPI SelectClipRgn( HDC hdc, HRGN hrgn )
1240 return ExtSelectClipRgn( hdc, hrgn, RGN_COPY );
1243 /***********************************************************************
1244 * SetMetaRgn (GDI32.@)
1246 INT WINAPI SetMetaRgn( HDC hdc )
1248 DC_ATTR *dc_attr;
1250 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1251 if (dc_attr->emf) FIXME( "EMFs are not yet supported\n" );
1252 return NtGdiSetMetaRgn( hdc );
1255 /***********************************************************************
1256 * DPtoLP (GDI32.@)
1258 BOOL WINAPI DPtoLP( HDC hdc, POINT *points, INT count )
1260 return NtGdiTransformPoints( hdc, points, points, count, NtGdiDPtoLP );
1263 /***********************************************************************
1264 * LPtoDP (GDI32.@)
1266 BOOL WINAPI LPtoDP( HDC hdc, POINT *points, INT count )
1268 return NtGdiTransformPoints( hdc, points, points, count, NtGdiLPtoDP );
1271 /***********************************************************************
1272 * ScaleViewportExtEx (GDI32.@)
1274 BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom,
1275 INT y_num, INT y_denom, SIZE *size )
1277 DC_ATTR *dc_attr;
1279 if (is_meta_dc( hdc )) return METADC_ScaleViewportExtEx( hdc, x_num, x_denom, y_num, y_denom );
1280 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1281 if (dc_attr->emf && !EMFDC_ScaleViewportExtEx( dc_attr, x_num, x_denom, y_num, y_denom ))
1282 return FALSE;
1283 return NtGdiScaleViewportExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
1286 /***********************************************************************
1287 * ScaleWindowExtEx (GDI32.@)
1289 BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
1290 INT y_num, INT y_denom, SIZE *size )
1292 DC_ATTR *dc_attr;
1294 if (is_meta_dc( hdc )) return METADC_ScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom );
1295 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1296 if (dc_attr->emf && !EMFDC_ScaleWindowExtEx( dc_attr, x_num, x_denom, y_num, y_denom ))
1297 return FALSE;
1298 return NtGdiScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
1301 /* Pointers to USER implementation of SelectPalette/RealizePalette */
1302 /* they will be patched by USER on startup */
1303 extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg );
1304 extern UINT WINAPI GDIRealizePalette( HDC hdc );
1305 HPALETTE (WINAPI *pfnSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgnd ) = GDISelectPalette;
1306 UINT (WINAPI *pfnRealizePalette)( HDC hdc ) = GDIRealizePalette;
1308 /***********************************************************************
1309 * SelectPalette (GDI32.@)
1311 HPALETTE WINAPI SelectPalette( HDC hdc, HPALETTE palette, BOOL force_background )
1313 DC_ATTR *dc_attr;
1315 if (is_meta_dc( hdc )) return ULongToHandle( METADC_SelectPalette( hdc, palette ) );
1316 if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
1317 if (dc_attr->emf && !EMFDC_SelectPalette( dc_attr, palette )) return 0;
1318 return pfnSelectPalette( hdc, palette, force_background );
1321 /***********************************************************************
1322 * RealizePalette (GDI32.@)
1324 UINT WINAPI RealizePalette( HDC hdc )
1326 if (is_meta_dc( hdc )) return METADC_RealizePalette( hdc );
1327 return pfnRealizePalette( hdc );
1330 /***********************************************************************
1331 * GdiSetPixelFormat (GDI32.@)
1333 BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR *descr )
1335 TRACE( "(%p,%d,%p)\n", hdc, format, descr );
1336 return NtGdiSetPixelFormat( hdc, format );
1339 /***********************************************************************
1340 * CancelDC (GDI32.@)
1342 BOOL WINAPI CancelDC(HDC hdc)
1344 FIXME( "stub\n" );
1345 return TRUE;
1348 /***********************************************************************
1349 * SetICMMode (GDI32.@)
1351 INT WINAPI SetICMMode( HDC hdc, INT mode )
1353 /* FIXME: Assume that ICM is always off, and cannot be turned on */
1354 switch (mode)
1356 case ICM_OFF: return ICM_OFF;
1357 case ICM_ON: return 0;
1358 case ICM_QUERY: return ICM_OFF;
1360 return 0;
1363 /***********************************************************************
1364 * GdiIsMetaPrintDC (GDI32.@)
1366 BOOL WINAPI GdiIsMetaPrintDC( HDC hdc )
1368 FIXME( "%p\n", hdc );
1369 return FALSE;
1372 /***********************************************************************
1373 * GdiIsMetaFileDC (GDI32.@)
1375 BOOL WINAPI GdiIsMetaFileDC( HDC hdc )
1377 TRACE( "%p\n", hdc );
1379 switch (GetObjectType( hdc ))
1381 case OBJ_METADC:
1382 case OBJ_ENHMETADC:
1383 return TRUE;
1385 return FALSE;
1388 /***********************************************************************
1389 * GdiIsPlayMetafileDC (GDI32.@)
1391 BOOL WINAPI GdiIsPlayMetafileDC( HDC hdc )
1393 FIXME( "%p\n", hdc );
1394 return FALSE;