2 * GDI Device Context functions
4 * Copyright 1993, 1994 Alexandre Julliard
5 * Copyright 1997 Bertho A. Stultiens
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"
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
);
34 if ((type
& 0x1f) != NTGDI_OBJ_DC
|| !(dc_attr
= get_gdi_client_ptr( hdc
, 0 )))
36 SetLastError( ERROR_INVALID_HANDLE
);
39 return dc_attr
->disabled
? NULL
: dc_attr
;
42 /***********************************************************************
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
;
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
;
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
);
77 /***********************************************************************
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 /***********************************************************************
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 /***********************************************************************
101 HDC WINAPI
ResetDCA( HDC hdc
, const DEVMODEA
*devmode
)
106 if (devmode
) devmodeW
= GdiConvertToDevmodeW( devmode
);
107 else devmodeW
= NULL
;
109 ret
= ResetDCW( hdc
, devmodeW
);
111 HeapFree( GetProcessHeap(), 0, devmodeW
);
115 /***********************************************************************
118 INT WINAPI
SaveDC( HDC hdc
)
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
)
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
;
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
)
219 if (mode
<= 0 || mode
> BKMODE_LAST
)
221 SetLastError(ERROR_INVALID_PARAMETER
);
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
;
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
)
260 if (dir
!= AD_COUNTERCLOCKWISE
&& dir
!= AD_CLOCKWISE
)
262 SetLastError(ERROR_INVALID_PARAMETER
);
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
;
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
)
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
)
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
)
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
;
345 /***********************************************************************
346 * SetMapperFlags (GDI32.@)
348 DWORD WINAPI
SetMapperFlags( HDC hdc
, DWORD flags
)
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
;
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
)
378 if (mode
<= 0 || mode
> POLYFILL_LAST
)
380 SetLastError(ERROR_INVALID_PARAMETER
);
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
;
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
)
408 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
409 *point
= dc_attr
->brush_org
;
413 /***********************************************************************
414 * SetBrushOrgEx (GDI32.@)
416 BOOL WINAPI
SetBrushOrgEx( HDC hdc
, INT x
, INT y
, POINT
*oldorg
)
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
;
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
)
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
;
446 /***********************************************************************
447 * GetWindowExtEx (GDI32.@)
449 BOOL WINAPI
GetWindowExtEx( HDC hdc
, SIZE
*size
)
452 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
453 *size
= dc_attr
->wnd_ext
;
457 /***********************************************************************
458 * SetWindowExtEx (GDI32.@)
460 BOOL WINAPI
SetWindowExtEx( HDC hdc
, INT x
, INT y
, SIZE
*size
)
464 if (is_meta_dc( hdc
)) return METADC_SetWindowExtEx( hdc
, x
, y
);
465 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
466 if (dc_attr
->emf
&& !EMFDC_SetWindowExtEx( dc_attr
, x
, y
)) return FALSE
;
468 if (size
) *size
= dc_attr
->wnd_ext
;
469 if (dc_attr
->map_mode
!= MM_ISOTROPIC
&& dc_attr
->map_mode
!= MM_ANISOTROPIC
) return TRUE
;
470 if (!x
|| !y
) return FALSE
;
471 dc_attr
->wnd_ext
.cx
= x
;
472 dc_attr
->wnd_ext
.cy
= y
;
473 return NtGdiComputeXformCoefficients( hdc
);
476 /***********************************************************************
477 * GetWindowOrgEx (GDI32.@)
479 BOOL WINAPI
GetWindowOrgEx( HDC hdc
, POINT
*point
)
482 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
483 *point
= dc_attr
->wnd_org
;
487 /***********************************************************************
488 * SetWindowOrgEx (GDI32.@)
490 BOOL WINAPI
SetWindowOrgEx( HDC hdc
, INT x
, INT y
, POINT
*point
)
494 if (is_meta_dc( hdc
)) return METADC_SetWindowOrgEx( hdc
, x
, y
);
495 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
496 if (dc_attr
->emf
&& !EMFDC_SetWindowOrgEx( dc_attr
, x
, y
)) return FALSE
;
498 if (point
) *point
= dc_attr
->wnd_org
;
499 dc_attr
->wnd_org
.x
= x
;
500 dc_attr
->wnd_org
.y
= y
;
501 return NtGdiComputeXformCoefficients( hdc
);
504 /***********************************************************************
505 * OffsetWindowOrgEx (GDI32.@)
507 BOOL WINAPI
OffsetWindowOrgEx( HDC hdc
, INT x
, INT y
, POINT
*point
)
511 if (is_meta_dc( hdc
)) return METADC_OffsetWindowOrgEx( hdc
, x
, y
);
512 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
513 if (point
) *point
= dc_attr
->wnd_org
;
514 dc_attr
->wnd_org
.x
+= x
;
515 dc_attr
->wnd_org
.y
+= y
;
516 if (dc_attr
->emf
&& !EMFDC_SetWindowOrgEx( dc_attr
, dc_attr
->wnd_org
.x
,
517 dc_attr
->wnd_org
.y
)) return FALSE
;
518 return NtGdiComputeXformCoefficients( hdc
);
521 /***********************************************************************
522 * GetViewportExtEx (GDI32.@)
524 BOOL WINAPI
GetViewportExtEx( HDC hdc
, SIZE
*size
)
527 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
528 *size
= dc_attr
->vport_ext
;
532 /***********************************************************************
533 * SetViewportExtEx (GDI32.@)
535 BOOL WINAPI
SetViewportExtEx( HDC hdc
, INT x
, INT y
, LPSIZE size
)
539 if (is_meta_dc( hdc
)) return METADC_SetViewportExtEx( hdc
, x
, y
);
540 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
541 if (dc_attr
->emf
&& !EMFDC_SetViewportExtEx( dc_attr
, x
, y
)) return FALSE
;
543 if (size
) *size
= dc_attr
->vport_ext
;
544 if (dc_attr
->map_mode
!= MM_ISOTROPIC
&& dc_attr
->map_mode
!= MM_ANISOTROPIC
) return TRUE
;
545 if (!x
|| !y
) return FALSE
;
546 dc_attr
->vport_ext
.cx
= x
;
547 dc_attr
->vport_ext
.cy
= y
;
548 return NtGdiComputeXformCoefficients( hdc
);
551 /***********************************************************************
552 * GetViewportOrgEx (GDI32.@)
554 BOOL WINAPI
GetViewportOrgEx( HDC hdc
, POINT
*point
)
557 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
558 *point
= dc_attr
->vport_org
;
562 /***********************************************************************
563 * SetViewportOrgEx (GDI32.@)
565 BOOL WINAPI
SetViewportOrgEx( HDC hdc
, INT x
, INT y
, POINT
*point
)
569 if (is_meta_dc( hdc
)) return METADC_SetViewportOrgEx( hdc
, x
, y
);
570 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
571 if (dc_attr
->emf
&& !EMFDC_SetViewportOrgEx( dc_attr
, x
, y
)) return FALSE
;
573 if (point
) *point
= dc_attr
->vport_org
;
574 dc_attr
->vport_org
.x
= x
;
575 dc_attr
->vport_org
.y
= y
;
576 return NtGdiComputeXformCoefficients( hdc
);
579 /***********************************************************************
580 * OffsetViewportOrgEx (GDI32.@)
582 BOOL WINAPI
OffsetViewportOrgEx( HDC hdc
, INT x
, INT y
, POINT
*point
)
586 if (is_meta_dc( hdc
)) return METADC_OffsetViewportOrgEx( hdc
, x
, y
);
587 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
588 if (point
) *point
= dc_attr
->vport_org
;
589 dc_attr
->vport_org
.x
+= x
;
590 dc_attr
->vport_org
.y
+= y
;
591 if (dc_attr
->emf
&& !EMFDC_SetViewportOrgEx( dc_attr
, dc_attr
->vport_org
.x
,
592 dc_attr
->vport_org
.y
)) return FALSE
;
593 return NtGdiComputeXformCoefficients( hdc
);
596 /***********************************************************************
597 * GetWorldTransform (GDI32.@)
599 BOOL WINAPI
GetWorldTransform( HDC hdc
, XFORM
*xform
)
601 return NtGdiGetTransform( hdc
, 0x203, xform
);
604 /***********************************************************************
605 * SetStretchBltMode (GDI32.@)
607 INT WINAPI
SetStretchBltMode( HDC hdc
, INT mode
)
612 if (mode
<= 0 || mode
> MAXSTRETCHBLTMODE
)
614 SetLastError(ERROR_INVALID_PARAMETER
);
618 if (is_meta_dc( hdc
)) return METADC_SetStretchBltMode( hdc
, mode
);
619 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
620 if (dc_attr
->emf
&& !EMFDC_SetStretchBltMode( dc_attr
, mode
)) return 0;
622 ret
= dc_attr
->stretch_blt_mode
;
623 dc_attr
->stretch_blt_mode
= mode
;
627 /***********************************************************************
628 * GetCurrentPositionEx (GDI32.@)
630 BOOL WINAPI
GetCurrentPositionEx( HDC hdc
, POINT
*point
)
633 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
634 *point
= dc_attr
->cur_pos
;
638 /***********************************************************************
641 INT WINAPI
GetROP2( HDC hdc
)
643 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
644 return dc_attr
? dc_attr
->rop_mode
: 0;
647 /***********************************************************************
648 * GetRelAbs (GDI32.@)
650 INT WINAPI
GetRelAbs( HDC hdc
, DWORD ignore
)
652 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
653 return dc_attr
? dc_attr
->rel_abs_mode
: 0;
656 /***********************************************************************
657 * SetRelAbs (GDI32.@)
659 INT WINAPI
SetRelAbs( HDC hdc
, INT mode
)
664 if (mode
!= ABSOLUTE
&& mode
!= RELATIVE
)
666 SetLastError(ERROR_INVALID_PARAMETER
);
670 if (is_meta_dc( hdc
)) return METADC_SetRelAbs( hdc
, mode
);
671 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
672 ret
= dc_attr
->rel_abs_mode
;
673 dc_attr
->rel_abs_mode
= mode
;
677 /***********************************************************************
680 INT WINAPI
SetROP2( HDC hdc
, INT mode
)
685 if ((mode
< R2_BLACK
) || (mode
> R2_WHITE
))
687 SetLastError(ERROR_INVALID_PARAMETER
);
691 if (is_meta_dc( hdc
)) return METADC_SetROP2( hdc
, mode
);
692 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
693 if (dc_attr
->emf
&& !EMFDC_SetROP2( dc_attr
, mode
)) return 0;
695 ret
= dc_attr
->rop_mode
;
696 dc_attr
->rop_mode
= mode
;
700 /***********************************************************************
701 * GetMiterLimit (GDI32.@)
703 BOOL WINAPI
GetMiterLimit( HDC hdc
, FLOAT
*limit
)
706 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
707 if (limit
) *limit
= dc_attr
->miter_limit
;
711 /*******************************************************************
712 * SetMiterLimit (GDI32.@)
714 BOOL WINAPI
SetMiterLimit( HDC hdc
, FLOAT limit
, FLOAT
*old_limit
)
717 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
718 /* FIXME: record EMFs */
719 if (old_limit
) *old_limit
= dc_attr
->miter_limit
;
720 dc_attr
->miter_limit
= limit
;
724 /***********************************************************************
727 COLORREF WINAPI
SetPixel( HDC hdc
, INT x
, INT y
, COLORREF color
)
731 if (is_meta_dc( hdc
)) return METADC_SetPixel( hdc
, x
, y
, color
);
732 if (!(dc_attr
= get_dc_attr( hdc
))) return CLR_INVALID
;
733 if (dc_attr
->emf
&& !EMFDC_SetPixel( dc_attr
, x
, y
, color
)) return CLR_INVALID
;
734 return NtGdiSetPixel( hdc
, x
, y
, color
);
737 /***********************************************************************
738 * SetPixelV (GDI32.@)
740 BOOL WINAPI
SetPixelV( HDC hdc
, INT x
, INT y
, COLORREF color
)
742 return SetPixel( hdc
, x
, y
, color
) != CLR_INVALID
;
745 /***********************************************************************
748 BOOL WINAPI
LineTo( HDC hdc
, INT x
, INT y
)
752 TRACE( "%p, (%d, %d)\n", hdc
, x
, y
);
754 if (is_meta_dc( hdc
)) return METADC_LineTo( hdc
, x
, y
);
755 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
756 if (dc_attr
->emf
&& !EMFDC_LineTo( dc_attr
, x
, y
)) return FALSE
;
757 return NtGdiLineTo( hdc
, x
, y
);
760 /***********************************************************************
763 BOOL WINAPI
MoveToEx( HDC hdc
, INT x
, INT y
, POINT
*pt
)
767 TRACE( "%p, (%d, %d), %p\n", hdc
, x
, y
, pt
);
769 if (is_meta_dc( hdc
)) return METADC_MoveTo( hdc
, x
, y
);
770 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
771 if (dc_attr
->emf
&& !EMFDC_MoveTo( dc_attr
, x
, y
)) return FALSE
;
772 return NtGdiMoveTo( hdc
, x
, y
, pt
);
775 /***********************************************************************
778 BOOL WINAPI
Arc( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
779 INT xstart
, INT ystart
, INT xend
, INT yend
)
783 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
784 right
, bottom
, xstart
, ystart
, xend
, yend
);
786 if (is_meta_dc( hdc
))
787 return METADC_Arc( hdc
, left
, top
, right
, bottom
,
788 xstart
, ystart
, xend
, yend
);
790 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
791 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
792 xstart
, ystart
, xend
, yend
, EMR_ARC
))
795 return NtGdiArcInternal( NtGdiArc
, hdc
, left
, top
, right
, bottom
,
796 xstart
, ystart
, xend
, yend
);
799 /***********************************************************************
802 BOOL WINAPI
ArcTo( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
803 INT xstart
, INT ystart
, INT xend
, INT yend
)
807 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
808 right
, bottom
, xstart
, ystart
, xend
, yend
);
810 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
811 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
812 xstart
, ystart
, xend
, yend
, EMR_ARCTO
))
815 return NtGdiArcInternal( NtGdiArcTo
, hdc
, left
, top
, right
, bottom
,
816 xstart
, ystart
, xend
, yend
);
819 /***********************************************************************
822 BOOL WINAPI
Chord( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
823 INT xstart
, INT ystart
, INT xend
, INT yend
)
827 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
828 right
, bottom
, xstart
, ystart
, xend
, yend
);
830 if (is_meta_dc( hdc
))
831 return METADC_Chord( hdc
, left
, top
, right
, bottom
,
832 xstart
, ystart
, xend
, yend
);
834 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
835 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
836 xstart
, ystart
, xend
, yend
, EMR_CHORD
))
839 return NtGdiArcInternal( NtGdiChord
, hdc
, left
, top
, right
, bottom
,
840 xstart
, ystart
, xend
, yend
);
843 /***********************************************************************
846 BOOL WINAPI
Pie( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
847 INT xstart
, INT ystart
, INT xend
, INT yend
)
851 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
852 right
, bottom
, xstart
, ystart
, xend
, yend
);
854 if (is_meta_dc( hdc
))
855 return METADC_Pie( hdc
, left
, top
, right
, bottom
,
856 xstart
, ystart
, xend
, yend
);
858 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
859 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
860 xstart
, ystart
, xend
, yend
, EMR_PIE
))
863 return NtGdiArcInternal( NtGdiPie
, hdc
, left
, top
, right
, bottom
,
864 xstart
, ystart
, xend
, yend
);
867 /***********************************************************************
870 BOOL WINAPI
AngleArc( HDC hdc
, INT x
, INT y
, DWORD radius
, FLOAT start_angle
, FLOAT sweep_angle
)
874 TRACE( "%p, (%d, %d), %u, %f, %f\n", hdc
, x
, y
, radius
, start_angle
, sweep_angle
);
876 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
877 if (dc_attr
->emf
&& !EMFDC_AngleArc( dc_attr
, x
, y
, radius
, start_angle
, sweep_angle
))
879 return NtGdiAngleArc( hdc
, x
, y
, radius
, start_angle
, sweep_angle
);
882 /***********************************************************************
885 BOOL WINAPI
Ellipse( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
889 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc
, left
, top
, right
, bottom
);
891 if (is_meta_dc( hdc
)) return METADC_Ellipse( hdc
, left
, top
, right
, bottom
);
892 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
893 if (dc_attr
->emf
&& !EMFDC_Ellipse( dc_attr
, left
, top
, right
, bottom
)) return FALSE
;
894 return NtGdiEllipse( hdc
, left
, top
, right
, bottom
);
897 /***********************************************************************
898 * Rectangle (GDI32.@)
900 BOOL WINAPI
Rectangle( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
904 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc
, left
, top
, right
, bottom
);
906 if (is_meta_dc( hdc
)) return METADC_Rectangle( hdc
, left
, top
, right
, bottom
);
907 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
908 if (dc_attr
->emf
&& !EMFDC_Rectangle( dc_attr
, left
, top
, right
, bottom
)) return FALSE
;
909 return NtGdiRectangle( hdc
, left
, top
, right
, bottom
);
912 /***********************************************************************
913 * RoundRect (GDI32.@)
915 BOOL WINAPI
RoundRect( HDC hdc
, INT left
, INT top
, INT right
,
916 INT bottom
, INT ell_width
, INT ell_height
)
920 TRACE( "%p, (%d, %d)-(%d, %d), %dx%d\n", hdc
, left
, top
, right
, bottom
,
921 ell_width
, ell_height
);
923 if (is_meta_dc( hdc
))
924 return METADC_RoundRect( hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
926 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
927 if (dc_attr
->emf
&& !EMFDC_RoundRect( dc_attr
, left
, top
, right
, bottom
,
928 ell_width
, ell_height
))
931 return NtGdiRoundRect( hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
934 /**********************************************************************
937 BOOL WINAPI
Polygon( HDC hdc
, const POINT
*points
, INT count
)
941 TRACE( "%p, %p, %d\n", hdc
, points
, count
);
943 if (is_meta_dc( hdc
)) return METADC_Polygon( hdc
, points
, count
);
944 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
945 if (dc_attr
->emf
&& !EMFDC_Polygon( dc_attr
, points
, count
)) return FALSE
;
946 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)&count
, 1, NtGdiPolyPolygon
);
949 /**********************************************************************
950 * PolyPolygon (GDI32.@)
952 BOOL WINAPI
PolyPolygon( HDC hdc
, const POINT
*points
, const INT
*counts
, UINT polygons
)
956 TRACE( "%p, %p, %p, %u\n", hdc
, points
, counts
, polygons
);
958 if (is_meta_dc( hdc
)) return METADC_PolyPolygon( hdc
, points
, counts
, polygons
);
959 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
960 if (dc_attr
->emf
&& !EMFDC_PolyPolygon( dc_attr
, points
, counts
, polygons
)) return FALSE
;
961 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)counts
, polygons
, NtGdiPolyPolygon
);
964 /**********************************************************************
967 BOOL WINAPI
Polyline( HDC hdc
, const POINT
*points
, INT count
)
971 TRACE( "%p, %p, %d\n", hdc
, points
, count
);
973 if (is_meta_dc( hdc
)) return METADC_Polyline( hdc
, points
, count
);
974 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
975 if (dc_attr
->emf
&& !EMFDC_Polyline( dc_attr
, points
, count
)) return FALSE
;
976 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)&count
, 1, NtGdiPolyPolyline
);
979 /**********************************************************************
980 * PolyPolyline (GDI32.@)
982 BOOL WINAPI
PolyPolyline( HDC hdc
, const POINT
*points
, const DWORD
*counts
, DWORD polylines
)
986 TRACE( "%p, %p, %p, %u\n", hdc
, points
, counts
, polylines
);
988 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
989 if (dc_attr
->emf
&& !EMFDC_PolyPolyline( dc_attr
, points
, counts
, polylines
)) return FALSE
;
990 return NtGdiPolyPolyDraw( hdc
, points
, counts
, polylines
, NtGdiPolyPolyline
);
993 /******************************************************************************
994 * PolyBezier (GDI32.@)
996 BOOL WINAPI
PolyBezier( HDC hdc
, const POINT
*points
, DWORD count
)
1000 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
1002 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1003 if (dc_attr
->emf
&& !EMFDC_PolyBezier( dc_attr
, points
, count
)) return FALSE
;
1004 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolyBezier
);
1007 /******************************************************************************
1008 * PolyBezierTo (GDI32.@)
1010 BOOL WINAPI
PolyBezierTo( HDC hdc
, const POINT
*points
, DWORD count
)
1014 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
1016 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1017 if (dc_attr
->emf
&& !EMFDC_PolyBezierTo( dc_attr
, points
, count
)) return FALSE
;
1018 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolyBezierTo
);
1021 /**********************************************************************
1022 * PolylineTo (GDI32.@)
1024 BOOL WINAPI
PolylineTo( HDC hdc
, const POINT
*points
, DWORD count
)
1028 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
1030 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1031 if (dc_attr
->emf
&& !EMFDC_PolylineTo( dc_attr
, points
, count
)) return FALSE
;
1032 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolylineTo
);
1035 /***********************************************************************
1036 * PolyDraw (GDI32.@)
1038 BOOL WINAPI
PolyDraw( HDC hdc
, const POINT
*points
, const BYTE
*types
, DWORD count
)
1042 TRACE( "%p, %p, %p, %u\n", hdc
, points
, types
, count
);
1044 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1045 if (dc_attr
->emf
&& !EMFDC_PolyDraw( dc_attr
, points
, types
, count
)) return FALSE
;
1046 return NtGdiPolyDraw( hdc
, points
, types
, count
);
1049 /***********************************************************************
1052 BOOL WINAPI
FillRgn( HDC hdc
, HRGN hrgn
, HBRUSH hbrush
)
1056 TRACE( "%p, %p, %p\n", hdc
, hrgn
, hbrush
);
1058 if (is_meta_dc( hdc
)) return METADC_FillRgn( hdc
, hrgn
, hbrush
);
1059 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1060 if (dc_attr
->emf
&& !EMFDC_FillRgn( dc_attr
, hrgn
, hbrush
)) return FALSE
;
1061 return NtGdiFillRgn( hdc
, hrgn
, hbrush
);
1064 /***********************************************************************
1065 * PaintRgn (GDI32.@)
1067 BOOL WINAPI
PaintRgn( HDC hdc
, HRGN hrgn
)
1071 TRACE( "%p, %p\n", hdc
, hrgn
);
1073 if (is_meta_dc( hdc
)) return METADC_PaintRgn( hdc
, hrgn
);
1074 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1075 if (dc_attr
->emf
&& !EMFDC_PaintRgn( dc_attr
, hrgn
)) return FALSE
;
1076 return NtGdiFillRgn( hdc
, hrgn
, GetCurrentObject( hdc
, OBJ_BRUSH
));
1079 /***********************************************************************
1080 * FrameRgn (GDI32.@)
1082 BOOL WINAPI
FrameRgn( HDC hdc
, HRGN hrgn
, HBRUSH hbrush
, INT width
, INT height
)
1086 TRACE( "%p, %p, %p, %dx%d\n", hdc
, hrgn
, hbrush
, width
, height
);
1088 if (is_meta_dc( hdc
)) return METADC_FrameRgn( hdc
, hrgn
, hbrush
, width
, height
);
1089 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1090 if (dc_attr
->emf
&& !EMFDC_FrameRgn( dc_attr
, hrgn
, hbrush
, width
, height
))
1092 return NtGdiFrameRgn( hdc
, hrgn
, hbrush
, width
, height
);
1095 /***********************************************************************
1096 * InvertRgn (GDI32.@)
1098 BOOL WINAPI
InvertRgn( HDC hdc
, HRGN hrgn
)
1102 TRACE( "%p, %p\n", hdc
, hrgn
);
1104 if (is_meta_dc( hdc
)) return METADC_InvertRgn( hdc
, hrgn
);
1105 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1106 if (dc_attr
->emf
&& !EMFDC_InvertRgn( dc_attr
, hrgn
)) return FALSE
;
1107 return NtGdiInvertRgn( hdc
, hrgn
);
1110 /***********************************************************************
1111 * ExtFloodFill (GDI32.@)
1113 BOOL WINAPI
ExtFloodFill( HDC hdc
, INT x
, INT y
, COLORREF color
, UINT fill_type
)
1117 TRACE( "%p, (%d, %d), %08x, %x\n", hdc
, x
, y
, color
, fill_type
);
1119 if (is_meta_dc( hdc
)) return METADC_ExtFloodFill( hdc
, x
, y
, color
, fill_type
);
1120 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1121 if (dc_attr
->emf
&& !EMFDC_ExtFloodFill( dc_attr
, x
, y
, color
, fill_type
)) return FALSE
;
1122 return NtGdiExtFloodFill( hdc
, x
, y
, color
, fill_type
);
1125 /***********************************************************************
1126 * FloodFill (GDI32.@)
1128 BOOL WINAPI
FloodFill( HDC hdc
, INT x
, INT y
, COLORREF color
)
1130 return ExtFloodFill( hdc
, x
, y
, color
, FLOODFILLBORDER
);
1133 /******************************************************************************
1134 * GdiGradientFill (GDI32.@)
1136 BOOL WINAPI
GdiGradientFill( HDC hdc
, TRIVERTEX
*vert_array
, ULONG nvert
,
1137 void *grad_array
, ULONG ngrad
, ULONG mode
)
1141 TRACE( "%p vert_array:%p nvert:%d grad_array:%p ngrad:%d\n", hdc
, vert_array
,
1142 nvert
, grad_array
, ngrad
);
1144 if (!(dc_attr
= get_dc_attr( hdc
)))
1146 SetLastError( ERROR_INVALID_PARAMETER
);
1150 !EMFDC_GradientFill( dc_attr
, vert_array
, nvert
, grad_array
, ngrad
, mode
))
1152 return NtGdiGradientFill( hdc
, vert_array
, nvert
, grad_array
, ngrad
, mode
);
1155 /***********************************************************************
1156 * ExtTextOutW (GDI32.@)
1158 BOOL WINAPI
ExtTextOutW( HDC hdc
, INT x
, INT y
, UINT flags
, const RECT
*rect
,
1159 const WCHAR
*str
, UINT count
, const INT
*dx
)
1163 if (is_meta_dc( hdc
)) return METADC_ExtTextOut( hdc
, x
, y
, flags
, rect
, str
, count
, dx
);
1164 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1165 if (dc_attr
->emf
&& !EMFDC_ExtTextOut( dc_attr
, x
, y
, flags
, rect
, str
, count
, dx
))
1167 return NtGdiExtTextOutW( hdc
, x
, y
, flags
, rect
, str
, count
, dx
, 0 );
1170 /***********************************************************************
1171 * SetTextJustification (GDI32.@)
1173 BOOL WINAPI
SetTextJustification( HDC hdc
, INT extra
, INT breaks
)
1177 if (is_meta_dc( hdc
)) return METADC_SetTextJustification( hdc
, extra
, breaks
);
1178 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1179 if (dc_attr
->emf
&& !EMFDC_SetTextJustification( dc_attr
, extra
, breaks
))
1181 return NtGdiSetTextJustification( hdc
, extra
, breaks
);
1184 /***********************************************************************
1187 BOOL WINAPI
PatBlt( HDC hdc
, INT left
, INT top
, INT width
, INT height
, DWORD rop
)
1191 if (is_meta_dc( hdc
)) return METADC_PatBlt( hdc
, left
, top
, width
, height
, rop
);
1192 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1193 if (dc_attr
->emf
&& !EMFDC_PatBlt( dc_attr
, left
, top
, width
, height
, rop
))
1195 return NtGdiPatBlt( hdc
, left
, top
, width
, height
, rop
);
1198 /***********************************************************************
1201 BOOL WINAPI DECLSPEC_HOTPATCH
BitBlt( HDC hdc_dst
, INT x_dst
, INT y_dst
, INT width
, INT height
,
1202 HDC hdc_src
, INT x_src
, INT y_src
, DWORD rop
)
1206 if (is_meta_dc( hdc_dst
)) return METADC_BitBlt( hdc_dst
, x_dst
, y_dst
, width
, height
,
1207 hdc_src
, x_src
, y_src
, rop
);
1208 if (!(dc_attr
= get_dc_attr( hdc_dst
))) return FALSE
;
1209 if (dc_attr
->emf
&& !EMFDC_BitBlt( dc_attr
, x_dst
, y_dst
, width
, height
,
1210 hdc_src
, x_src
, y_src
, rop
))
1212 return NtGdiBitBlt( hdc_dst
, x_dst
, y_dst
, width
, height
,
1213 hdc_src
, x_src
, y_src
, rop
, 0 /* FIXME */, 0 /* FIXME */ );
1216 /***********************************************************************
1217 * StretchBlt (GDI32.@)
1219 BOOL WINAPI
StretchBlt( HDC hdc
, INT x_dst
, INT y_dst
, INT width_dst
, INT height_dst
,
1220 HDC hdc_src
, INT x_src
, INT y_src
, INT width_src
, INT height_src
,
1225 if (is_meta_dc( hdc
)) return METADC_StretchBlt( hdc
, x_dst
, y_dst
, width_dst
, height_dst
,
1226 hdc_src
, x_src
, y_src
, width_src
,
1228 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1229 if (dc_attr
->emf
&& !EMFDC_StretchBlt( dc_attr
, x_dst
, y_dst
, width_dst
, height_dst
,
1230 hdc_src
, x_src
, y_src
, width_src
,
1233 return NtGdiStretchBlt( hdc
, x_dst
, y_dst
, width_dst
, height_dst
,
1234 hdc_src
, x_src
, y_src
, width_src
,
1235 height_src
, rop
, 0 /* FIXME */ );
1238 /******************************************************************************
1239 * GdiAlphaBlend (GDI32.@)
1241 BOOL WINAPI
GdiAlphaBlend( HDC hdc_dst
, int x_dst
, int y_dst
, int width_dst
, int height_dst
,
1242 HDC hdc_src
, int x_src
, int y_src
, int width_src
, int height_src
,
1243 BLENDFUNCTION blend_function
)
1247 if (!(dc_attr
= get_dc_attr( hdc_dst
))) return FALSE
;
1248 if (dc_attr
->emf
&& !EMFDC_AlphaBlend( dc_attr
, x_dst
, y_dst
, width_dst
, height_dst
,
1249 hdc_src
, x_src
, y_src
, width_src
,
1250 height_src
, blend_function
))
1252 return NtGdiAlphaBlend( hdc_dst
, x_dst
, y_dst
, width_dst
, height_dst
,
1253 hdc_src
, x_src
, y_src
, width_src
, height_src
,
1254 blend_function
, 0 /* FIXME */ );
1257 /***********************************************************************
1258 * BeginPath (GDI32.@)
1260 BOOL WINAPI
BeginPath(HDC hdc
)
1264 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1265 if (dc_attr
->emf
&& !EMFDC_BeginPath( dc_attr
)) return FALSE
;
1266 return NtGdiBeginPath( hdc
);
1269 /***********************************************************************
1272 BOOL WINAPI
EndPath(HDC hdc
)
1276 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1277 if (dc_attr
->emf
&& !EMFDC_EndPath( dc_attr
)) return FALSE
;
1278 return NtGdiEndPath( hdc
);
1281 /***********************************************************************
1282 * AbortPath (GDI32.@)
1284 BOOL WINAPI
AbortPath( HDC hdc
)
1288 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1289 if (dc_attr
->emf
&& !EMFDC_AbortPath( dc_attr
)) return FALSE
;
1290 return NtGdiAbortPath( hdc
);
1293 /***********************************************************************
1294 * CloseFigure (GDI32.@)
1296 BOOL WINAPI
CloseFigure( HDC hdc
)
1300 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1301 if (dc_attr
->emf
&& !EMFDC_CloseFigure( dc_attr
)) return FALSE
;
1302 return NtGdiCloseFigure( hdc
);
1305 /***********************************************************************
1306 * IntersectClipRect (GDI32.@)
1308 INT WINAPI
IntersectClipRect( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
1312 TRACE("%p %d,%d - %d,%d\n", hdc
, left
, top
, right
, bottom
);
1314 if (is_meta_dc( hdc
)) return METADC_IntersectClipRect( hdc
, left
, top
, right
, bottom
);
1315 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1316 if (dc_attr
->emf
&& !EMFDC_IntersectClipRect( dc_attr
, left
, top
, right
, bottom
))
1318 return NtGdiIntersectClipRect( hdc
, left
, top
, right
, bottom
);
1321 /***********************************************************************
1322 * OffsetClipRgn (GDI32.@)
1324 INT WINAPI
OffsetClipRgn( HDC hdc
, INT x
, INT y
)
1328 if (is_meta_dc( hdc
)) return METADC_OffsetClipRgn( hdc
, x
, y
);
1329 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1330 if (dc_attr
->emf
&& !EMFDC_OffsetClipRgn( dc_attr
, x
, y
)) return FALSE
;
1331 return NtGdiOffsetClipRgn( hdc
, x
, y
);
1334 /***********************************************************************
1335 * ExcludeClipRect (GDI32.@)
1337 INT WINAPI
ExcludeClipRect( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
1341 if (is_meta_dc( hdc
)) return METADC_ExcludeClipRect( hdc
, left
, top
, right
, bottom
);
1342 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1343 if (dc_attr
->emf
&& !EMFDC_ExcludeClipRect( dc_attr
, left
, top
, right
, bottom
))
1345 return NtGdiExcludeClipRect( hdc
, left
, top
, right
, bottom
);
1348 /******************************************************************************
1349 * ExtSelectClipRgn (GDI32.@)
1351 INT WINAPI
ExtSelectClipRgn( HDC hdc
, HRGN hrgn
, INT mode
)
1355 TRACE("%p %p %d\n", hdc
, hrgn
, mode
);
1357 if (is_meta_dc( hdc
)) return METADC_ExtSelectClipRgn( hdc
, hrgn
, mode
);
1358 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1359 if (dc_attr
->emf
&& !EMFDC_ExtSelectClipRgn( dc_attr
, hrgn
, mode
))
1361 return NtGdiExtSelectClipRgn( hdc
, hrgn
, mode
);
1364 /***********************************************************************
1365 * SelectClipRgn (GDI32.@)
1367 INT WINAPI
SelectClipRgn( HDC hdc
, HRGN hrgn
)
1369 return ExtSelectClipRgn( hdc
, hrgn
, RGN_COPY
);
1372 /***********************************************************************
1373 * SetMetaRgn (GDI32.@)
1375 INT WINAPI
SetMetaRgn( HDC hdc
)
1379 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1380 if (dc_attr
->emf
) FIXME( "EMFs are not yet supported\n" );
1381 return NtGdiSetMetaRgn( hdc
);
1384 /***********************************************************************
1387 BOOL WINAPI
DPtoLP( HDC hdc
, POINT
*points
, INT count
)
1389 return NtGdiTransformPoints( hdc
, points
, points
, count
, NtGdiDPtoLP
);
1392 /***********************************************************************
1395 BOOL WINAPI
LPtoDP( HDC hdc
, POINT
*points
, INT count
)
1397 return NtGdiTransformPoints( hdc
, points
, points
, count
, NtGdiLPtoDP
);
1400 /***********************************************************************
1401 * ScaleViewportExtEx (GDI32.@)
1403 BOOL WINAPI
ScaleViewportExtEx( HDC hdc
, INT x_num
, INT x_denom
,
1404 INT y_num
, INT y_denom
, SIZE
*size
)
1408 if (is_meta_dc( hdc
)) return METADC_ScaleViewportExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
);
1409 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1410 if (dc_attr
->emf
&& !EMFDC_ScaleViewportExtEx( dc_attr
, x_num
, x_denom
, y_num
, y_denom
))
1412 return NtGdiScaleViewportExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
, size
);
1415 /***********************************************************************
1416 * ScaleWindowExtEx (GDI32.@)
1418 BOOL WINAPI
ScaleWindowExtEx( HDC hdc
, INT x_num
, INT x_denom
,
1419 INT y_num
, INT y_denom
, SIZE
*size
)
1423 if (is_meta_dc( hdc
)) return METADC_ScaleWindowExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
);
1424 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1425 if (dc_attr
->emf
&& !EMFDC_ScaleWindowExtEx( dc_attr
, x_num
, x_denom
, y_num
, y_denom
))
1427 return NtGdiScaleWindowExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
, size
);
1430 /* Pointers to USER implementation of SelectPalette/RealizePalette */
1431 /* they will be patched by USER on startup */
1432 extern HPALETTE WINAPI
GDISelectPalette( HDC hdc
, HPALETTE hpal
, WORD wBkg
);
1433 extern UINT WINAPI
GDIRealizePalette( HDC hdc
);
1434 HPALETTE (WINAPI
*pfnSelectPalette
)( HDC hdc
, HPALETTE hpal
, WORD bkgnd
) = GDISelectPalette
;
1435 UINT (WINAPI
*pfnRealizePalette
)( HDC hdc
) = GDIRealizePalette
;
1437 /***********************************************************************
1438 * SelectPalette (GDI32.@)
1440 HPALETTE WINAPI
SelectPalette( HDC hdc
, HPALETTE palette
, BOOL force_background
)
1444 if (is_meta_dc( hdc
)) return ULongToHandle( METADC_SelectPalette( hdc
, palette
) );
1445 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1446 if (dc_attr
->emf
&& !EMFDC_SelectPalette( dc_attr
, palette
)) return 0;
1447 return pfnSelectPalette( hdc
, palette
, force_background
);
1450 /***********************************************************************
1451 * RealizePalette (GDI32.@)
1453 UINT WINAPI
RealizePalette( HDC hdc
)
1455 if (is_meta_dc( hdc
)) return METADC_RealizePalette( hdc
);
1456 return pfnRealizePalette( hdc
);
1459 /***********************************************************************
1460 * GdiSetPixelFormat (GDI32.@)
1462 BOOL WINAPI
GdiSetPixelFormat( HDC hdc
, INT format
, const PIXELFORMATDESCRIPTOR
*descr
)
1464 TRACE( "(%p,%d,%p)\n", hdc
, format
, descr
);
1465 return NtGdiSetPixelFormat( hdc
, format
);
1468 /***********************************************************************
1469 * CancelDC (GDI32.@)
1471 BOOL WINAPI
CancelDC(HDC hdc
)
1477 /***********************************************************************
1478 * SetICMMode (GDI32.@)
1480 INT WINAPI
SetICMMode( HDC hdc
, INT mode
)
1482 /* FIXME: Assume that ICM is always off, and cannot be turned on */
1485 case ICM_OFF
: return ICM_OFF
;
1486 case ICM_ON
: return 0;
1487 case ICM_QUERY
: return ICM_OFF
;
1492 /***********************************************************************
1493 * GdiIsMetaPrintDC (GDI32.@)
1495 BOOL WINAPI
GdiIsMetaPrintDC( HDC hdc
)
1497 FIXME( "%p\n", hdc
);
1501 /***********************************************************************
1502 * GdiIsMetaFileDC (GDI32.@)
1504 BOOL WINAPI
GdiIsMetaFileDC( HDC hdc
)
1506 TRACE( "%p\n", hdc
);
1508 switch (GetObjectType( hdc
))
1517 /***********************************************************************
1518 * GdiIsPlayMetafileDC (GDI32.@)
1520 BOOL WINAPI
GdiIsPlayMetafileDC( HDC hdc
)
1522 FIXME( "%p\n", hdc
);