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 * ModifyWorldTransform (GDI32.@)
607 BOOL WINAPI
ModifyWorldTransform( HDC hdc
, const XFORM
*xform
, DWORD mode
)
611 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
612 if (dc_attr
->emf
&& !EMFDC_ModifyWorldTransform( dc_attr
, xform
, mode
)) return FALSE
;
613 return NtGdiModifyWorldTransform( hdc
, xform
, mode
);
616 /***********************************************************************
617 * SetStretchBltMode (GDI32.@)
619 INT WINAPI
SetStretchBltMode( HDC hdc
, INT mode
)
624 if (mode
<= 0 || mode
> MAXSTRETCHBLTMODE
)
626 SetLastError(ERROR_INVALID_PARAMETER
);
630 if (is_meta_dc( hdc
)) return METADC_SetStretchBltMode( hdc
, mode
);
631 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
632 if (dc_attr
->emf
&& !EMFDC_SetStretchBltMode( dc_attr
, mode
)) return 0;
634 ret
= dc_attr
->stretch_blt_mode
;
635 dc_attr
->stretch_blt_mode
= mode
;
639 /***********************************************************************
640 * GetCurrentPositionEx (GDI32.@)
642 BOOL WINAPI
GetCurrentPositionEx( HDC hdc
, POINT
*point
)
645 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
646 *point
= dc_attr
->cur_pos
;
650 /***********************************************************************
653 INT WINAPI
GetROP2( HDC hdc
)
655 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
656 return dc_attr
? dc_attr
->rop_mode
: 0;
659 /***********************************************************************
660 * GetRelAbs (GDI32.@)
662 INT WINAPI
GetRelAbs( HDC hdc
, DWORD ignore
)
664 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
665 return dc_attr
? dc_attr
->rel_abs_mode
: 0;
668 /***********************************************************************
669 * SetRelAbs (GDI32.@)
671 INT WINAPI
SetRelAbs( HDC hdc
, INT mode
)
676 if (mode
!= ABSOLUTE
&& mode
!= RELATIVE
)
678 SetLastError(ERROR_INVALID_PARAMETER
);
682 if (is_meta_dc( hdc
)) return METADC_SetRelAbs( hdc
, mode
);
683 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
684 ret
= dc_attr
->rel_abs_mode
;
685 dc_attr
->rel_abs_mode
= mode
;
689 /***********************************************************************
692 INT WINAPI
SetROP2( HDC hdc
, INT mode
)
697 if ((mode
< R2_BLACK
) || (mode
> R2_WHITE
))
699 SetLastError(ERROR_INVALID_PARAMETER
);
703 if (is_meta_dc( hdc
)) return METADC_SetROP2( hdc
, mode
);
704 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
705 if (dc_attr
->emf
&& !EMFDC_SetROP2( dc_attr
, mode
)) return 0;
707 ret
= dc_attr
->rop_mode
;
708 dc_attr
->rop_mode
= mode
;
712 /***********************************************************************
713 * GetMiterLimit (GDI32.@)
715 BOOL WINAPI
GetMiterLimit( HDC hdc
, FLOAT
*limit
)
718 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
719 if (limit
) *limit
= dc_attr
->miter_limit
;
723 /*******************************************************************
724 * SetMiterLimit (GDI32.@)
726 BOOL WINAPI
SetMiterLimit( HDC hdc
, FLOAT limit
, FLOAT
*old_limit
)
729 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
730 /* FIXME: record EMFs */
731 if (old_limit
) *old_limit
= dc_attr
->miter_limit
;
732 dc_attr
->miter_limit
= limit
;
736 /***********************************************************************
739 COLORREF WINAPI
SetPixel( HDC hdc
, INT x
, INT y
, COLORREF color
)
743 if (is_meta_dc( hdc
)) return METADC_SetPixel( hdc
, x
, y
, color
);
744 if (!(dc_attr
= get_dc_attr( hdc
))) return CLR_INVALID
;
745 if (dc_attr
->emf
&& !EMFDC_SetPixel( dc_attr
, x
, y
, color
)) return CLR_INVALID
;
746 return NtGdiSetPixel( hdc
, x
, y
, color
);
749 /***********************************************************************
750 * SetPixelV (GDI32.@)
752 BOOL WINAPI
SetPixelV( HDC hdc
, INT x
, INT y
, COLORREF color
)
754 return SetPixel( hdc
, x
, y
, color
) != CLR_INVALID
;
757 /***********************************************************************
760 BOOL WINAPI
LineTo( HDC hdc
, INT x
, INT y
)
764 TRACE( "%p, (%d, %d)\n", hdc
, x
, y
);
766 if (is_meta_dc( hdc
)) return METADC_LineTo( hdc
, x
, y
);
767 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
768 if (dc_attr
->emf
&& !EMFDC_LineTo( dc_attr
, x
, y
)) return FALSE
;
769 return NtGdiLineTo( hdc
, x
, y
);
772 /***********************************************************************
775 BOOL WINAPI
MoveToEx( HDC hdc
, INT x
, INT y
, POINT
*pt
)
779 TRACE( "%p, (%d, %d), %p\n", hdc
, x
, y
, pt
);
781 if (is_meta_dc( hdc
)) return METADC_MoveTo( hdc
, x
, y
);
782 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
783 if (dc_attr
->emf
&& !EMFDC_MoveTo( dc_attr
, x
, y
)) return FALSE
;
784 return NtGdiMoveTo( hdc
, x
, y
, pt
);
787 /***********************************************************************
790 BOOL WINAPI
Arc( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
791 INT xstart
, INT ystart
, INT xend
, INT yend
)
795 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
796 right
, bottom
, xstart
, ystart
, xend
, yend
);
798 if (is_meta_dc( hdc
))
799 return METADC_Arc( hdc
, left
, top
, right
, bottom
,
800 xstart
, ystart
, xend
, yend
);
802 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
803 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
804 xstart
, ystart
, xend
, yend
, EMR_ARC
))
807 return NtGdiArcInternal( NtGdiArc
, hdc
, left
, top
, right
, bottom
,
808 xstart
, ystart
, xend
, yend
);
811 /***********************************************************************
814 BOOL WINAPI
ArcTo( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
815 INT xstart
, INT ystart
, INT xend
, INT yend
)
819 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
820 right
, bottom
, xstart
, ystart
, xend
, yend
);
822 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
823 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
824 xstart
, ystart
, xend
, yend
, EMR_ARCTO
))
827 return NtGdiArcInternal( NtGdiArcTo
, hdc
, left
, top
, right
, bottom
,
828 xstart
, ystart
, xend
, yend
);
831 /***********************************************************************
834 BOOL WINAPI
Chord( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
835 INT xstart
, INT ystart
, INT xend
, INT yend
)
839 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
840 right
, bottom
, xstart
, ystart
, xend
, yend
);
842 if (is_meta_dc( hdc
))
843 return METADC_Chord( hdc
, left
, top
, right
, bottom
,
844 xstart
, ystart
, xend
, yend
);
846 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
847 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
848 xstart
, ystart
, xend
, yend
, EMR_CHORD
))
851 return NtGdiArcInternal( NtGdiChord
, hdc
, left
, top
, right
, bottom
,
852 xstart
, ystart
, xend
, yend
);
855 /***********************************************************************
858 BOOL WINAPI
Pie( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
859 INT xstart
, INT ystart
, INT xend
, INT yend
)
863 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
864 right
, bottom
, xstart
, ystart
, xend
, yend
);
866 if (is_meta_dc( hdc
))
867 return METADC_Pie( hdc
, left
, top
, right
, bottom
,
868 xstart
, ystart
, xend
, yend
);
870 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
871 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
872 xstart
, ystart
, xend
, yend
, EMR_PIE
))
875 return NtGdiArcInternal( NtGdiPie
, hdc
, left
, top
, right
, bottom
,
876 xstart
, ystart
, xend
, yend
);
879 /***********************************************************************
882 BOOL WINAPI
AngleArc( HDC hdc
, INT x
, INT y
, DWORD radius
, FLOAT start_angle
, FLOAT sweep_angle
)
886 TRACE( "%p, (%d, %d), %u, %f, %f\n", hdc
, x
, y
, radius
, start_angle
, sweep_angle
);
888 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
889 if (dc_attr
->emf
&& !EMFDC_AngleArc( dc_attr
, x
, y
, radius
, start_angle
, sweep_angle
))
891 return NtGdiAngleArc( hdc
, x
, y
, radius
, start_angle
, sweep_angle
);
894 /***********************************************************************
897 BOOL WINAPI
Ellipse( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
901 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc
, left
, top
, right
, bottom
);
903 if (is_meta_dc( hdc
)) return METADC_Ellipse( hdc
, left
, top
, right
, bottom
);
904 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
905 if (dc_attr
->emf
&& !EMFDC_Ellipse( dc_attr
, left
, top
, right
, bottom
)) return FALSE
;
906 return NtGdiEllipse( hdc
, left
, top
, right
, bottom
);
909 /***********************************************************************
910 * Rectangle (GDI32.@)
912 BOOL WINAPI
Rectangle( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
916 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc
, left
, top
, right
, bottom
);
918 if (is_meta_dc( hdc
)) return METADC_Rectangle( hdc
, left
, top
, right
, bottom
);
919 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
920 if (dc_attr
->emf
&& !EMFDC_Rectangle( dc_attr
, left
, top
, right
, bottom
)) return FALSE
;
921 return NtGdiRectangle( hdc
, left
, top
, right
, bottom
);
924 /***********************************************************************
925 * RoundRect (GDI32.@)
927 BOOL WINAPI
RoundRect( HDC hdc
, INT left
, INT top
, INT right
,
928 INT bottom
, INT ell_width
, INT ell_height
)
932 TRACE( "%p, (%d, %d)-(%d, %d), %dx%d\n", hdc
, left
, top
, right
, bottom
,
933 ell_width
, ell_height
);
935 if (is_meta_dc( hdc
))
936 return METADC_RoundRect( hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
938 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
939 if (dc_attr
->emf
&& !EMFDC_RoundRect( dc_attr
, left
, top
, right
, bottom
,
940 ell_width
, ell_height
))
943 return NtGdiRoundRect( hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
946 /**********************************************************************
949 BOOL WINAPI
Polygon( HDC hdc
, const POINT
*points
, INT count
)
953 TRACE( "%p, %p, %d\n", hdc
, points
, count
);
955 if (is_meta_dc( hdc
)) return METADC_Polygon( hdc
, points
, count
);
956 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
957 if (dc_attr
->emf
&& !EMFDC_Polygon( dc_attr
, points
, count
)) return FALSE
;
958 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)&count
, 1, NtGdiPolyPolygon
);
961 /**********************************************************************
962 * PolyPolygon (GDI32.@)
964 BOOL WINAPI
PolyPolygon( HDC hdc
, const POINT
*points
, const INT
*counts
, UINT polygons
)
968 TRACE( "%p, %p, %p, %u\n", hdc
, points
, counts
, polygons
);
970 if (is_meta_dc( hdc
)) return METADC_PolyPolygon( hdc
, points
, counts
, polygons
);
971 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
972 if (dc_attr
->emf
&& !EMFDC_PolyPolygon( dc_attr
, points
, counts
, polygons
)) return FALSE
;
973 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)counts
, polygons
, NtGdiPolyPolygon
);
976 /**********************************************************************
979 BOOL WINAPI
Polyline( HDC hdc
, const POINT
*points
, INT count
)
983 TRACE( "%p, %p, %d\n", hdc
, points
, count
);
985 if (is_meta_dc( hdc
)) return METADC_Polyline( hdc
, points
, count
);
986 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
987 if (dc_attr
->emf
&& !EMFDC_Polyline( dc_attr
, points
, count
)) return FALSE
;
988 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)&count
, 1, NtGdiPolyPolyline
);
991 /**********************************************************************
992 * PolyPolyline (GDI32.@)
994 BOOL WINAPI
PolyPolyline( HDC hdc
, const POINT
*points
, const DWORD
*counts
, DWORD polylines
)
998 TRACE( "%p, %p, %p, %u\n", hdc
, points
, counts
, polylines
);
1000 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1001 if (dc_attr
->emf
&& !EMFDC_PolyPolyline( dc_attr
, points
, counts
, polylines
)) return FALSE
;
1002 return NtGdiPolyPolyDraw( hdc
, points
, counts
, polylines
, NtGdiPolyPolyline
);
1005 /******************************************************************************
1006 * PolyBezier (GDI32.@)
1008 BOOL WINAPI
PolyBezier( HDC hdc
, const POINT
*points
, DWORD count
)
1012 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
1014 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1015 if (dc_attr
->emf
&& !EMFDC_PolyBezier( dc_attr
, points
, count
)) return FALSE
;
1016 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolyBezier
);
1019 /******************************************************************************
1020 * PolyBezierTo (GDI32.@)
1022 BOOL WINAPI
PolyBezierTo( HDC hdc
, const POINT
*points
, DWORD count
)
1026 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
1028 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1029 if (dc_attr
->emf
&& !EMFDC_PolyBezierTo( dc_attr
, points
, count
)) return FALSE
;
1030 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolyBezierTo
);
1033 /**********************************************************************
1034 * PolylineTo (GDI32.@)
1036 BOOL WINAPI
PolylineTo( HDC hdc
, const POINT
*points
, DWORD count
)
1040 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
1042 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1043 if (dc_attr
->emf
&& !EMFDC_PolylineTo( dc_attr
, points
, count
)) return FALSE
;
1044 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolylineTo
);
1047 /***********************************************************************
1048 * PolyDraw (GDI32.@)
1050 BOOL WINAPI
PolyDraw( HDC hdc
, const POINT
*points
, const BYTE
*types
, DWORD count
)
1054 TRACE( "%p, %p, %p, %u\n", hdc
, points
, types
, count
);
1056 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1057 if (dc_attr
->emf
&& !EMFDC_PolyDraw( dc_attr
, points
, types
, count
)) return FALSE
;
1058 return NtGdiPolyDraw( hdc
, points
, types
, count
);
1061 /***********************************************************************
1064 BOOL WINAPI
FillRgn( HDC hdc
, HRGN hrgn
, HBRUSH hbrush
)
1068 TRACE( "%p, %p, %p\n", hdc
, hrgn
, hbrush
);
1070 if (is_meta_dc( hdc
)) return METADC_FillRgn( hdc
, hrgn
, hbrush
);
1071 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1072 if (dc_attr
->emf
&& !EMFDC_FillRgn( dc_attr
, hrgn
, hbrush
)) return FALSE
;
1073 return NtGdiFillRgn( hdc
, hrgn
, hbrush
);
1076 /***********************************************************************
1077 * PaintRgn (GDI32.@)
1079 BOOL WINAPI
PaintRgn( HDC hdc
, HRGN hrgn
)
1083 TRACE( "%p, %p\n", hdc
, hrgn
);
1085 if (is_meta_dc( hdc
)) return METADC_PaintRgn( hdc
, hrgn
);
1086 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1087 if (dc_attr
->emf
&& !EMFDC_PaintRgn( dc_attr
, hrgn
)) return FALSE
;
1088 return NtGdiFillRgn( hdc
, hrgn
, GetCurrentObject( hdc
, OBJ_BRUSH
));
1091 /***********************************************************************
1092 * FrameRgn (GDI32.@)
1094 BOOL WINAPI
FrameRgn( HDC hdc
, HRGN hrgn
, HBRUSH hbrush
, INT width
, INT height
)
1098 TRACE( "%p, %p, %p, %dx%d\n", hdc
, hrgn
, hbrush
, width
, height
);
1100 if (is_meta_dc( hdc
)) return METADC_FrameRgn( hdc
, hrgn
, hbrush
, width
, height
);
1101 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1102 if (dc_attr
->emf
&& !EMFDC_FrameRgn( dc_attr
, hrgn
, hbrush
, width
, height
))
1104 return NtGdiFrameRgn( hdc
, hrgn
, hbrush
, width
, height
);
1107 /***********************************************************************
1108 * InvertRgn (GDI32.@)
1110 BOOL WINAPI
InvertRgn( HDC hdc
, HRGN hrgn
)
1114 TRACE( "%p, %p\n", hdc
, hrgn
);
1116 if (is_meta_dc( hdc
)) return METADC_InvertRgn( hdc
, hrgn
);
1117 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1118 if (dc_attr
->emf
&& !EMFDC_InvertRgn( dc_attr
, hrgn
)) return FALSE
;
1119 return NtGdiInvertRgn( hdc
, hrgn
);
1122 /***********************************************************************
1123 * ExtFloodFill (GDI32.@)
1125 BOOL WINAPI
ExtFloodFill( HDC hdc
, INT x
, INT y
, COLORREF color
, UINT fill_type
)
1129 TRACE( "%p, (%d, %d), %08x, %x\n", hdc
, x
, y
, color
, fill_type
);
1131 if (is_meta_dc( hdc
)) return METADC_ExtFloodFill( hdc
, x
, y
, color
, fill_type
);
1132 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1133 if (dc_attr
->emf
&& !EMFDC_ExtFloodFill( dc_attr
, x
, y
, color
, fill_type
)) return FALSE
;
1134 return NtGdiExtFloodFill( hdc
, x
, y
, color
, fill_type
);
1137 /***********************************************************************
1138 * FloodFill (GDI32.@)
1140 BOOL WINAPI
FloodFill( HDC hdc
, INT x
, INT y
, COLORREF color
)
1142 return ExtFloodFill( hdc
, x
, y
, color
, FLOODFILLBORDER
);
1145 /******************************************************************************
1146 * GdiGradientFill (GDI32.@)
1148 BOOL WINAPI
GdiGradientFill( HDC hdc
, TRIVERTEX
*vert_array
, ULONG nvert
,
1149 void *grad_array
, ULONG ngrad
, ULONG mode
)
1153 TRACE( "%p vert_array:%p nvert:%d grad_array:%p ngrad:%d\n", hdc
, vert_array
,
1154 nvert
, grad_array
, ngrad
);
1156 if (!(dc_attr
= get_dc_attr( hdc
)))
1158 SetLastError( ERROR_INVALID_PARAMETER
);
1162 !EMFDC_GradientFill( dc_attr
, vert_array
, nvert
, grad_array
, ngrad
, mode
))
1164 return NtGdiGradientFill( hdc
, vert_array
, nvert
, grad_array
, ngrad
, mode
);
1167 /***********************************************************************
1168 * ExtTextOutW (GDI32.@)
1170 BOOL WINAPI
ExtTextOutW( HDC hdc
, INT x
, INT y
, UINT flags
, const RECT
*rect
,
1171 const WCHAR
*str
, UINT count
, const INT
*dx
)
1175 if (is_meta_dc( hdc
)) return METADC_ExtTextOut( hdc
, x
, y
, flags
, rect
, str
, count
, dx
);
1176 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1177 if (dc_attr
->emf
&& !EMFDC_ExtTextOut( dc_attr
, x
, y
, flags
, rect
, str
, count
, dx
))
1179 return NtGdiExtTextOutW( hdc
, x
, y
, flags
, rect
, str
, count
, dx
, 0 );
1182 /***********************************************************************
1183 * SetTextJustification (GDI32.@)
1185 BOOL WINAPI
SetTextJustification( HDC hdc
, INT extra
, INT breaks
)
1189 if (is_meta_dc( hdc
)) return METADC_SetTextJustification( hdc
, extra
, breaks
);
1190 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1191 if (dc_attr
->emf
&& !EMFDC_SetTextJustification( dc_attr
, extra
, breaks
))
1193 return NtGdiSetTextJustification( hdc
, extra
, breaks
);
1196 /***********************************************************************
1199 BOOL WINAPI
PatBlt( HDC hdc
, INT left
, INT top
, INT width
, INT height
, DWORD rop
)
1203 if (is_meta_dc( hdc
)) return METADC_PatBlt( hdc
, left
, top
, width
, height
, rop
);
1204 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1205 if (dc_attr
->emf
&& !EMFDC_PatBlt( dc_attr
, left
, top
, width
, height
, rop
))
1207 return NtGdiPatBlt( hdc
, left
, top
, width
, height
, rop
);
1210 /***********************************************************************
1213 BOOL WINAPI DECLSPEC_HOTPATCH
BitBlt( HDC hdc_dst
, INT x_dst
, INT y_dst
, INT width
, INT height
,
1214 HDC hdc_src
, INT x_src
, INT y_src
, DWORD rop
)
1218 if (is_meta_dc( hdc_dst
)) return METADC_BitBlt( hdc_dst
, x_dst
, y_dst
, width
, height
,
1219 hdc_src
, x_src
, y_src
, rop
);
1220 if (!(dc_attr
= get_dc_attr( hdc_dst
))) return FALSE
;
1221 if (dc_attr
->emf
&& !EMFDC_BitBlt( dc_attr
, x_dst
, y_dst
, width
, height
,
1222 hdc_src
, x_src
, y_src
, rop
))
1224 return NtGdiBitBlt( hdc_dst
, x_dst
, y_dst
, width
, height
,
1225 hdc_src
, x_src
, y_src
, rop
, 0 /* FIXME */, 0 /* FIXME */ );
1228 /***********************************************************************
1229 * StretchBlt (GDI32.@)
1231 BOOL WINAPI
StretchBlt( HDC hdc
, INT x_dst
, INT y_dst
, INT width_dst
, INT height_dst
,
1232 HDC hdc_src
, INT x_src
, INT y_src
, INT width_src
, INT height_src
,
1237 if (is_meta_dc( hdc
)) return METADC_StretchBlt( hdc
, x_dst
, y_dst
, width_dst
, height_dst
,
1238 hdc_src
, x_src
, y_src
, width_src
,
1240 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1241 if (dc_attr
->emf
&& !EMFDC_StretchBlt( dc_attr
, x_dst
, y_dst
, width_dst
, height_dst
,
1242 hdc_src
, x_src
, y_src
, width_src
,
1245 return NtGdiStretchBlt( hdc
, x_dst
, y_dst
, width_dst
, height_dst
,
1246 hdc_src
, x_src
, y_src
, width_src
,
1247 height_src
, rop
, 0 /* FIXME */ );
1250 /******************************************************************************
1251 * GdiAlphaBlend (GDI32.@)
1253 BOOL WINAPI
GdiAlphaBlend( HDC hdc_dst
, int x_dst
, int y_dst
, int width_dst
, int height_dst
,
1254 HDC hdc_src
, int x_src
, int y_src
, int width_src
, int height_src
,
1255 BLENDFUNCTION blend_function
)
1259 if (!(dc_attr
= get_dc_attr( hdc_dst
))) return FALSE
;
1260 if (dc_attr
->emf
&& !EMFDC_AlphaBlend( dc_attr
, x_dst
, y_dst
, width_dst
, height_dst
,
1261 hdc_src
, x_src
, y_src
, width_src
,
1262 height_src
, blend_function
))
1264 return NtGdiAlphaBlend( hdc_dst
, x_dst
, y_dst
, width_dst
, height_dst
,
1265 hdc_src
, x_src
, y_src
, width_src
, height_src
,
1266 blend_function
, 0 /* FIXME */ );
1269 /***********************************************************************
1270 * BeginPath (GDI32.@)
1272 BOOL WINAPI
BeginPath(HDC hdc
)
1276 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1277 if (dc_attr
->emf
&& !EMFDC_BeginPath( dc_attr
)) return FALSE
;
1278 return NtGdiBeginPath( hdc
);
1281 /***********************************************************************
1284 BOOL WINAPI
EndPath(HDC hdc
)
1288 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1289 if (dc_attr
->emf
&& !EMFDC_EndPath( dc_attr
)) return FALSE
;
1290 return NtGdiEndPath( hdc
);
1293 /***********************************************************************
1294 * AbortPath (GDI32.@)
1296 BOOL WINAPI
AbortPath( HDC hdc
)
1300 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1301 if (dc_attr
->emf
&& !EMFDC_AbortPath( dc_attr
)) return FALSE
;
1302 return NtGdiAbortPath( hdc
);
1305 /***********************************************************************
1306 * CloseFigure (GDI32.@)
1308 BOOL WINAPI
CloseFigure( HDC hdc
)
1312 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1313 if (dc_attr
->emf
&& !EMFDC_CloseFigure( dc_attr
)) return FALSE
;
1314 return NtGdiCloseFigure( hdc
);
1317 /***********************************************************************
1318 * IntersectClipRect (GDI32.@)
1320 INT WINAPI
IntersectClipRect( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
1324 TRACE("%p %d,%d - %d,%d\n", hdc
, left
, top
, right
, bottom
);
1326 if (is_meta_dc( hdc
)) return METADC_IntersectClipRect( hdc
, left
, top
, right
, bottom
);
1327 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1328 if (dc_attr
->emf
&& !EMFDC_IntersectClipRect( dc_attr
, left
, top
, right
, bottom
))
1330 return NtGdiIntersectClipRect( hdc
, left
, top
, right
, bottom
);
1333 /***********************************************************************
1334 * OffsetClipRgn (GDI32.@)
1336 INT WINAPI
OffsetClipRgn( HDC hdc
, INT x
, INT y
)
1340 if (is_meta_dc( hdc
)) return METADC_OffsetClipRgn( hdc
, x
, y
);
1341 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1342 if (dc_attr
->emf
&& !EMFDC_OffsetClipRgn( dc_attr
, x
, y
)) return FALSE
;
1343 return NtGdiOffsetClipRgn( hdc
, x
, y
);
1346 /***********************************************************************
1347 * ExcludeClipRect (GDI32.@)
1349 INT WINAPI
ExcludeClipRect( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
1353 if (is_meta_dc( hdc
)) return METADC_ExcludeClipRect( hdc
, left
, top
, right
, bottom
);
1354 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1355 if (dc_attr
->emf
&& !EMFDC_ExcludeClipRect( dc_attr
, left
, top
, right
, bottom
))
1357 return NtGdiExcludeClipRect( hdc
, left
, top
, right
, bottom
);
1360 /******************************************************************************
1361 * ExtSelectClipRgn (GDI32.@)
1363 INT WINAPI
ExtSelectClipRgn( HDC hdc
, HRGN hrgn
, INT mode
)
1367 TRACE("%p %p %d\n", hdc
, hrgn
, mode
);
1369 if (is_meta_dc( hdc
)) return METADC_ExtSelectClipRgn( hdc
, hrgn
, mode
);
1370 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1371 if (dc_attr
->emf
&& !EMFDC_ExtSelectClipRgn( dc_attr
, hrgn
, mode
))
1373 return NtGdiExtSelectClipRgn( hdc
, hrgn
, mode
);
1376 /***********************************************************************
1377 * SelectClipRgn (GDI32.@)
1379 INT WINAPI
SelectClipRgn( HDC hdc
, HRGN hrgn
)
1381 return ExtSelectClipRgn( hdc
, hrgn
, RGN_COPY
);
1384 /***********************************************************************
1385 * SetMetaRgn (GDI32.@)
1387 INT WINAPI
SetMetaRgn( HDC hdc
)
1391 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1392 if (dc_attr
->emf
) FIXME( "EMFs are not yet supported\n" );
1393 return NtGdiSetMetaRgn( hdc
);
1396 /***********************************************************************
1399 BOOL WINAPI
DPtoLP( HDC hdc
, POINT
*points
, INT count
)
1401 return NtGdiTransformPoints( hdc
, points
, points
, count
, NtGdiDPtoLP
);
1404 /***********************************************************************
1407 BOOL WINAPI
LPtoDP( HDC hdc
, POINT
*points
, INT count
)
1409 return NtGdiTransformPoints( hdc
, points
, points
, count
, NtGdiLPtoDP
);
1412 /***********************************************************************
1413 * ScaleViewportExtEx (GDI32.@)
1415 BOOL WINAPI
ScaleViewportExtEx( HDC hdc
, INT x_num
, INT x_denom
,
1416 INT y_num
, INT y_denom
, SIZE
*size
)
1420 if (is_meta_dc( hdc
)) return METADC_ScaleViewportExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
);
1421 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1422 if (dc_attr
->emf
&& !EMFDC_ScaleViewportExtEx( dc_attr
, x_num
, x_denom
, y_num
, y_denom
))
1424 return NtGdiScaleViewportExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
, size
);
1427 /***********************************************************************
1428 * ScaleWindowExtEx (GDI32.@)
1430 BOOL WINAPI
ScaleWindowExtEx( HDC hdc
, INT x_num
, INT x_denom
,
1431 INT y_num
, INT y_denom
, SIZE
*size
)
1435 if (is_meta_dc( hdc
)) return METADC_ScaleWindowExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
);
1436 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1437 if (dc_attr
->emf
&& !EMFDC_ScaleWindowExtEx( dc_attr
, x_num
, x_denom
, y_num
, y_denom
))
1439 return NtGdiScaleWindowExtEx( hdc
, x_num
, x_denom
, y_num
, y_denom
, size
);
1442 /* Pointers to USER implementation of SelectPalette/RealizePalette */
1443 /* they will be patched by USER on startup */
1444 extern HPALETTE WINAPI
GDISelectPalette( HDC hdc
, HPALETTE hpal
, WORD wBkg
);
1445 extern UINT WINAPI
GDIRealizePalette( HDC hdc
);
1446 HPALETTE (WINAPI
*pfnSelectPalette
)( HDC hdc
, HPALETTE hpal
, WORD bkgnd
) = GDISelectPalette
;
1447 UINT (WINAPI
*pfnRealizePalette
)( HDC hdc
) = GDIRealizePalette
;
1449 /***********************************************************************
1450 * SelectPalette (GDI32.@)
1452 HPALETTE WINAPI
SelectPalette( HDC hdc
, HPALETTE palette
, BOOL force_background
)
1456 if (is_meta_dc( hdc
)) return ULongToHandle( METADC_SelectPalette( hdc
, palette
) );
1457 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
1458 if (dc_attr
->emf
&& !EMFDC_SelectPalette( dc_attr
, palette
)) return 0;
1459 return pfnSelectPalette( hdc
, palette
, force_background
);
1462 /***********************************************************************
1463 * RealizePalette (GDI32.@)
1465 UINT WINAPI
RealizePalette( HDC hdc
)
1467 if (is_meta_dc( hdc
)) return METADC_RealizePalette( hdc
);
1468 return pfnRealizePalette( hdc
);
1471 /***********************************************************************
1472 * GdiSetPixelFormat (GDI32.@)
1474 BOOL WINAPI
GdiSetPixelFormat( HDC hdc
, INT format
, const PIXELFORMATDESCRIPTOR
*descr
)
1476 TRACE( "(%p,%d,%p)\n", hdc
, format
, descr
);
1477 return NtGdiSetPixelFormat( hdc
, format
);
1480 /***********************************************************************
1481 * CancelDC (GDI32.@)
1483 BOOL WINAPI
CancelDC(HDC hdc
)
1489 /***********************************************************************
1490 * SetICMMode (GDI32.@)
1492 INT WINAPI
SetICMMode( HDC hdc
, INT mode
)
1494 /* FIXME: Assume that ICM is always off, and cannot be turned on */
1497 case ICM_OFF
: return ICM_OFF
;
1498 case ICM_ON
: return 0;
1499 case ICM_QUERY
: return ICM_OFF
;
1504 /***********************************************************************
1505 * GdiIsMetaPrintDC (GDI32.@)
1507 BOOL WINAPI
GdiIsMetaPrintDC( HDC hdc
)
1509 FIXME( "%p\n", hdc
);
1513 /***********************************************************************
1514 * GdiIsMetaFileDC (GDI32.@)
1516 BOOL WINAPI
GdiIsMetaFileDC( HDC hdc
)
1518 TRACE( "%p\n", hdc
);
1520 switch (GetObjectType( hdc
))
1529 /***********************************************************************
1530 * GdiIsPlayMetafileDC (GDI32.@)
1532 BOOL WINAPI
GdiIsPlayMetafileDC( HDC hdc
)
1534 FIXME( "%p\n", hdc
);