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"
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(gdi
);
28 static DC_ATTR
*get_dc_attr( HDC hdc
)
30 WORD type
= gdi_handle_type( hdc
);
32 if ((type
& 0x1f) != NTGDI_OBJ_DC
|| !(dc_attr
= get_gdi_client_ptr( hdc
, 0 )))
34 SetLastError( ERROR_INVALID_HANDLE
);
37 return dc_attr
->disabled
? NULL
: dc_attr
;
40 /***********************************************************************
41 * GetTextAlign (GDI32.@)
43 UINT WINAPI
GetTextAlign( HDC hdc
)
45 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
46 return dc_attr
? dc_attr
->text_align
: 0;
49 /***********************************************************************
50 * SetTextAlign (GDI32.@)
52 UINT WINAPI
SetTextAlign( HDC hdc
, UINT align
)
57 TRACE("hdc=%p align=%d\n", hdc
, align
);
59 if (is_meta_dc( hdc
)) return METADC_SetTextAlign( hdc
, align
);
60 if (!(dc_attr
= get_dc_attr( hdc
))) return GDI_ERROR
;
61 if (dc_attr
->emf
&& !EMFDC_SetTextAlign( dc_attr
, align
)) return GDI_ERROR
;
63 ret
= dc_attr
->text_align
;
64 dc_attr
->text_align
= align
;
68 /***********************************************************************
69 * GetBkColor (GDI32.@)
71 COLORREF WINAPI
GetBkColor( HDC hdc
)
73 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
74 return dc_attr
? dc_attr
->background_color
: CLR_INVALID
;
77 /***********************************************************************
78 * GetDCBrushColor (GDI32.@)
80 COLORREF WINAPI
GetDCBrushColor( HDC hdc
)
82 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
83 return dc_attr
? dc_attr
->brush_color
: CLR_INVALID
;
86 /***********************************************************************
87 * GetDCPenColor (GDI32.@)
89 COLORREF WINAPI
GetDCPenColor(HDC hdc
)
91 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
92 return dc_attr
? dc_attr
->pen_color
: CLR_INVALID
;
95 /***********************************************************************
96 * GetTextColor (GDI32.@)
98 COLORREF WINAPI
GetTextColor( HDC hdc
)
100 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
101 return dc_attr
? dc_attr
->text_color
: 0;
104 /***********************************************************************
105 * GetBkMode (GDI32.@)
107 INT WINAPI
GetBkMode( HDC hdc
)
109 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
110 return dc_attr
? dc_attr
->background_mode
: 0;
113 /***********************************************************************
114 * SetBkMode (GDI32.@)
116 INT WINAPI
SetBkMode( HDC hdc
, INT mode
)
121 if (mode
<= 0 || mode
> BKMODE_LAST
)
123 SetLastError(ERROR_INVALID_PARAMETER
);
127 if (is_meta_dc( hdc
)) return METADC_SetBkMode( hdc
, mode
);
128 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
129 if (dc_attr
->emf
&& !EMFDC_SetBkMode( dc_attr
, mode
)) return 0;
131 ret
= dc_attr
->background_mode
;
132 dc_attr
->background_mode
= mode
;
136 /***********************************************************************
137 * GetGraphicsMode (GDI32.@)
139 INT WINAPI
GetGraphicsMode( HDC hdc
)
141 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
142 return dc_attr
? dc_attr
->graphics_mode
: 0;
145 /***********************************************************************
146 * GetArcDirection (GDI32.@)
148 INT WINAPI
GetArcDirection( HDC hdc
)
150 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
151 return dc_attr
? dc_attr
->arc_direction
: 0;
154 /***********************************************************************
155 * SetArcDirection (GDI32.@)
157 INT WINAPI
SetArcDirection( HDC hdc
, INT dir
)
162 if (dir
!= AD_COUNTERCLOCKWISE
&& dir
!= AD_CLOCKWISE
)
164 SetLastError(ERROR_INVALID_PARAMETER
);
168 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
169 if (dc_attr
->emf
&& !EMFDC_SetArcDirection( dc_attr
, dir
)) return 0;
171 ret
= dc_attr
->arc_direction
;
172 dc_attr
->arc_direction
= dir
;
176 /***********************************************************************
177 * GetLayout (GDI32.@)
179 DWORD WINAPI
GetLayout( HDC hdc
)
181 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
182 return dc_attr
? dc_attr
->layout
: GDI_ERROR
;
185 /***********************************************************************
186 * GetMapMode (GDI32.@)
188 INT WINAPI
GetMapMode( HDC hdc
)
190 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
191 return dc_attr
? dc_attr
->map_mode
: 0;
194 /***********************************************************************
195 * GetPolyFillMode (GDI32.@)
197 INT WINAPI
GetPolyFillMode( HDC hdc
)
199 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
200 return dc_attr
? dc_attr
->poly_fill_mode
: 0;
203 /***********************************************************************
204 * SetPolyFillMode (GDI32.@)
206 INT WINAPI
SetPolyFillMode( HDC hdc
, INT mode
)
211 if (mode
<= 0 || mode
> POLYFILL_LAST
)
213 SetLastError(ERROR_INVALID_PARAMETER
);
217 if (is_meta_dc( hdc
)) return METADC_SetPolyFillMode( hdc
, mode
);
218 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
219 if (dc_attr
->emf
&& !EMFDC_SetPolyFillMode( dc_attr
, mode
)) return 0;
221 ret
= dc_attr
->poly_fill_mode
;
222 dc_attr
->poly_fill_mode
= mode
;
226 /***********************************************************************
227 * GetStretchBltMode (GDI32.@)
229 INT WINAPI
GetStretchBltMode( HDC hdc
)
231 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
232 return dc_attr
? dc_attr
->stretch_blt_mode
: 0;
235 /***********************************************************************
236 * SetStretchBltMode (GDI32.@)
238 INT WINAPI
SetStretchBltMode( HDC hdc
, INT mode
)
243 if (mode
<= 0 || mode
> MAXSTRETCHBLTMODE
)
245 SetLastError(ERROR_INVALID_PARAMETER
);
249 if (is_meta_dc( hdc
)) return METADC_SetStretchBltMode( hdc
, mode
);
250 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
251 if (dc_attr
->emf
&& !EMFDC_SetStretchBltMode( dc_attr
, mode
)) return 0;
253 ret
= dc_attr
->stretch_blt_mode
;
254 dc_attr
->stretch_blt_mode
= mode
;
258 /***********************************************************************
259 * GetCurrentPositionEx (GDI32.@)
261 BOOL WINAPI
GetCurrentPositionEx( HDC hdc
, POINT
*point
)
264 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
265 *point
= dc_attr
->cur_pos
;
269 /***********************************************************************
272 INT WINAPI
GetROP2( HDC hdc
)
274 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
275 return dc_attr
? dc_attr
->rop_mode
: 0;
278 /***********************************************************************
279 * GetRelAbs (GDI32.@)
281 INT WINAPI
GetRelAbs( HDC hdc
, DWORD ignore
)
283 DC_ATTR
*dc_attr
= get_dc_attr( hdc
);
284 return dc_attr
? dc_attr
->rel_abs_mode
: 0;
287 /***********************************************************************
288 * SetRelAbs (GDI32.@)
290 INT WINAPI
SetRelAbs( HDC hdc
, INT mode
)
295 if (mode
!= ABSOLUTE
&& mode
!= RELATIVE
)
297 SetLastError(ERROR_INVALID_PARAMETER
);
301 if (is_meta_dc( hdc
)) return METADC_SetRelAbs( hdc
, mode
);
302 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
303 ret
= dc_attr
->rel_abs_mode
;
304 dc_attr
->rel_abs_mode
= mode
;
308 /***********************************************************************
311 INT WINAPI
SetROP2( HDC hdc
, INT mode
)
316 if ((mode
< R2_BLACK
) || (mode
> R2_WHITE
))
318 SetLastError(ERROR_INVALID_PARAMETER
);
322 if (is_meta_dc( hdc
)) return METADC_SetROP2( hdc
, mode
);
323 if (!(dc_attr
= get_dc_attr( hdc
))) return 0;
324 if (dc_attr
->emf
&& !EMFDC_SetROP2( dc_attr
, mode
)) return 0;
326 ret
= dc_attr
->rop_mode
;
327 dc_attr
->rop_mode
= mode
;
331 /***********************************************************************
332 * GetMiterLimit (GDI32.@)
334 BOOL WINAPI
GetMiterLimit( HDC hdc
, FLOAT
*limit
)
337 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
338 if (limit
) *limit
= dc_attr
->miter_limit
;
342 /***********************************************************************
345 COLORREF WINAPI
SetPixel( HDC hdc
, INT x
, INT y
, COLORREF color
)
349 if (is_meta_dc( hdc
)) return METADC_SetPixel( hdc
, x
, y
, color
);
350 if (!(dc_attr
= get_dc_attr( hdc
))) return CLR_INVALID
;
351 if (dc_attr
->emf
&& !EMFDC_SetPixel( dc_attr
, x
, y
, color
)) return CLR_INVALID
;
352 return NtGdiSetPixel( hdc
, x
, y
, color
);
355 /***********************************************************************
356 * SetPixelV (GDI32.@)
358 BOOL WINAPI
SetPixelV( HDC hdc
, INT x
, INT y
, COLORREF color
)
360 return SetPixel( hdc
, x
, y
, color
) != CLR_INVALID
;
363 /***********************************************************************
366 BOOL WINAPI
LineTo( HDC hdc
, INT x
, INT y
)
370 TRACE( "%p, (%d, %d)\n", hdc
, x
, y
);
372 if (is_meta_dc( hdc
)) return METADC_LineTo( hdc
, x
, y
);
373 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
374 if (dc_attr
->emf
&& !EMFDC_LineTo( dc_attr
, x
, y
)) return FALSE
;
375 return NtGdiLineTo( hdc
, x
, y
);
378 /***********************************************************************
381 BOOL WINAPI
MoveToEx( HDC hdc
, INT x
, INT y
, POINT
*pt
)
385 TRACE( "%p, (%d, %d), %p\n", hdc
, x
, y
, pt
);
387 if (is_meta_dc( hdc
)) return METADC_MoveTo( hdc
, x
, y
);
388 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
389 if (dc_attr
->emf
&& !EMFDC_MoveTo( dc_attr
, x
, y
)) return FALSE
;
390 return NtGdiMoveTo( hdc
, x
, y
, pt
);
393 /***********************************************************************
396 BOOL WINAPI
Arc( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
397 INT xstart
, INT ystart
, INT xend
, INT yend
)
401 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
402 right
, bottom
, xstart
, ystart
, xend
, yend
);
404 if (is_meta_dc( hdc
))
405 return METADC_Arc( hdc
, left
, top
, right
, bottom
,
406 xstart
, ystart
, xend
, yend
);
408 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
409 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
410 xstart
, ystart
, xend
, yend
, EMR_ARC
))
413 return NtGdiArcInternal( NtGdiArc
, hdc
, left
, top
, right
, bottom
,
414 xstart
, ystart
, xend
, yend
);
417 /***********************************************************************
420 BOOL WINAPI
ArcTo( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
421 INT xstart
, INT ystart
, INT xend
, INT yend
)
425 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
426 right
, bottom
, xstart
, ystart
, xend
, yend
);
428 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
429 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
430 xstart
, ystart
, xend
, yend
, EMR_ARCTO
))
433 return NtGdiArcInternal( NtGdiArcTo
, hdc
, left
, top
, right
, bottom
,
434 xstart
, ystart
, xend
, yend
);
437 /***********************************************************************
440 BOOL WINAPI
Chord( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
441 INT xstart
, INT ystart
, INT xend
, INT yend
)
445 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
446 right
, bottom
, xstart
, ystart
, xend
, yend
);
448 if (is_meta_dc( hdc
))
449 return METADC_Chord( hdc
, left
, top
, right
, bottom
,
450 xstart
, ystart
, xend
, yend
);
452 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
453 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
454 xstart
, ystart
, xend
, yend
, EMR_CHORD
))
457 return NtGdiArcInternal( NtGdiChord
, hdc
, left
, top
, right
, bottom
,
458 xstart
, ystart
, xend
, yend
);
461 /***********************************************************************
464 BOOL WINAPI
Pie( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
,
465 INT xstart
, INT ystart
, INT xend
, INT yend
)
469 TRACE( "%p, (%d, %d)-(%d, %d), (%d, %d), (%d, %d)\n", hdc
, left
, top
,
470 right
, bottom
, xstart
, ystart
, xend
, yend
);
472 if (is_meta_dc( hdc
))
473 return METADC_Pie( hdc
, left
, top
, right
, bottom
,
474 xstart
, ystart
, xend
, yend
);
476 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
477 if (dc_attr
->emf
&& !EMFDC_ArcChordPie( dc_attr
, left
, top
, right
, bottom
,
478 xstart
, ystart
, xend
, yend
, EMR_PIE
))
481 return NtGdiArcInternal( NtGdiPie
, hdc
, left
, top
, right
, bottom
,
482 xstart
, ystart
, xend
, yend
);
485 /***********************************************************************
488 BOOL WINAPI
AngleArc( HDC hdc
, INT x
, INT y
, DWORD radius
, FLOAT start_angle
, FLOAT sweep_angle
)
492 TRACE( "%p, (%d, %d), %u, %f, %f\n", hdc
, x
, y
, radius
, start_angle
, sweep_angle
);
494 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
495 if (dc_attr
->emf
&& !EMFDC_AngleArc( dc_attr
, x
, y
, radius
, start_angle
, sweep_angle
))
497 return NtGdiAngleArc( hdc
, x
, y
, radius
, start_angle
, sweep_angle
);
500 /***********************************************************************
503 BOOL WINAPI
Ellipse( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
507 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc
, left
, top
, right
, bottom
);
509 if (is_meta_dc( hdc
)) return METADC_Ellipse( hdc
, left
, top
, right
, bottom
);
510 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
511 if (dc_attr
->emf
&& !EMFDC_Ellipse( dc_attr
, left
, top
, right
, bottom
)) return FALSE
;
512 return NtGdiEllipse( hdc
, left
, top
, right
, bottom
);
515 /***********************************************************************
516 * Rectangle (GDI32.@)
518 BOOL WINAPI
Rectangle( HDC hdc
, INT left
, INT top
, INT right
, INT bottom
)
522 TRACE( "%p, (%d, %d)-(%d, %d)\n", hdc
, left
, top
, right
, bottom
);
524 if (is_meta_dc( hdc
)) return METADC_Rectangle( hdc
, left
, top
, right
, bottom
);
525 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
526 if (dc_attr
->emf
&& !EMFDC_Rectangle( dc_attr
, left
, top
, right
, bottom
)) return FALSE
;
527 return NtGdiRectangle( hdc
, left
, top
, right
, bottom
);
530 /***********************************************************************
531 * RoundRect (GDI32.@)
533 BOOL WINAPI
RoundRect( HDC hdc
, INT left
, INT top
, INT right
,
534 INT bottom
, INT ell_width
, INT ell_height
)
538 TRACE( "%p, (%d, %d)-(%d, %d), %dx%d\n", hdc
, left
, top
, right
, bottom
,
539 ell_width
, ell_height
);
541 if (is_meta_dc( hdc
))
542 return METADC_RoundRect( hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
544 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
545 if (dc_attr
->emf
&& !EMFDC_RoundRect( dc_attr
, left
, top
, right
, bottom
,
546 ell_width
, ell_height
))
549 return NtGdiRoundRect( hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
552 /**********************************************************************
555 BOOL WINAPI
Polygon( HDC hdc
, const POINT
*points
, INT count
)
559 TRACE( "%p, %p, %d\n", hdc
, points
, count
);
561 if (is_meta_dc( hdc
)) return METADC_Polygon( hdc
, points
, count
);
562 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
563 if (dc_attr
->emf
&& !EMFDC_Polygon( dc_attr
, points
, count
)) return FALSE
;
564 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)&count
, 1, NtGdiPolyPolygon
);
567 /**********************************************************************
568 * PolyPolygon (GDI32.@)
570 BOOL WINAPI
PolyPolygon( HDC hdc
, const POINT
*points
, const INT
*counts
, UINT polygons
)
574 TRACE( "%p, %p, %p, %u\n", hdc
, points
, counts
, polygons
);
576 if (is_meta_dc( hdc
)) return METADC_PolyPolygon( hdc
, points
, counts
, polygons
);
577 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
578 if (dc_attr
->emf
&& !EMFDC_PolyPolygon( dc_attr
, points
, counts
, polygons
)) return FALSE
;
579 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)counts
, polygons
, NtGdiPolyPolygon
);
582 /**********************************************************************
585 BOOL WINAPI
Polyline( HDC hdc
, const POINT
*points
, INT count
)
589 TRACE( "%p, %p, %d\n", hdc
, points
, count
);
591 if (is_meta_dc( hdc
)) return METADC_Polyline( hdc
, points
, count
);
592 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
593 if (dc_attr
->emf
&& !EMFDC_Polyline( dc_attr
, points
, count
)) return FALSE
;
594 return NtGdiPolyPolyDraw( hdc
, points
, (const UINT
*)&count
, 1, NtGdiPolyPolyline
);
597 /**********************************************************************
598 * PolyPolyline (GDI32.@)
600 BOOL WINAPI
PolyPolyline( HDC hdc
, const POINT
*points
, const DWORD
*counts
, DWORD polylines
)
604 TRACE( "%p, %p, %p, %u\n", hdc
, points
, counts
, polylines
);
606 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
607 if (dc_attr
->emf
&& !EMFDC_PolyPolyline( dc_attr
, points
, counts
, polylines
)) return FALSE
;
608 return NtGdiPolyPolyDraw( hdc
, points
, counts
, polylines
, NtGdiPolyPolyline
);
611 /******************************************************************************
612 * PolyBezier (GDI32.@)
614 BOOL WINAPI
PolyBezier( HDC hdc
, const POINT
*points
, DWORD count
)
618 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
620 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
621 if (dc_attr
->emf
&& !EMFDC_PolyBezier( dc_attr
, points
, count
)) return FALSE
;
622 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolyBezier
);
625 /******************************************************************************
626 * PolyBezierTo (GDI32.@)
628 BOOL WINAPI
PolyBezierTo( HDC hdc
, const POINT
*points
, DWORD count
)
632 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
634 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
635 if (dc_attr
->emf
&& !EMFDC_PolyBezierTo( dc_attr
, points
, count
)) return FALSE
;
636 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolyBezierTo
);
639 /**********************************************************************
640 * PolylineTo (GDI32.@)
642 BOOL WINAPI
PolylineTo( HDC hdc
, const POINT
*points
, DWORD count
)
646 TRACE( "%p, %p, %u\n", hdc
, points
, count
);
648 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
649 if (dc_attr
->emf
&& !EMFDC_PolylineTo( dc_attr
, points
, count
)) return FALSE
;
650 return NtGdiPolyPolyDraw( hdc
, points
, &count
, 1, NtGdiPolylineTo
);
653 /***********************************************************************
656 BOOL WINAPI
PolyDraw( HDC hdc
, const POINT
*points
, const BYTE
*types
, DWORD count
)
660 TRACE( "%p, %p, %p, %u\n", hdc
, points
, types
, count
);
662 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
663 if (dc_attr
->emf
&& !EMFDC_PolyDraw( dc_attr
, points
, types
, count
)) return FALSE
;
664 return NtGdiPolyDraw( hdc
, points
, types
, count
);
667 /***********************************************************************
670 BOOL WINAPI
FillRgn( HDC hdc
, HRGN hrgn
, HBRUSH hbrush
)
674 TRACE( "%p, %p, %p\n", hdc
, hrgn
, hbrush
);
676 if (is_meta_dc( hdc
)) return METADC_FillRgn( hdc
, hrgn
, hbrush
);
677 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
678 if (dc_attr
->emf
&& !EMFDC_FillRgn( dc_attr
, hrgn
, hbrush
)) return FALSE
;
679 return NtGdiFillRgn( hdc
, hrgn
, hbrush
);
682 /***********************************************************************
685 BOOL WINAPI
PaintRgn( HDC hdc
, HRGN hrgn
)
689 TRACE( "%p, %p\n", hdc
, hrgn
);
691 if (is_meta_dc( hdc
)) return METADC_PaintRgn( hdc
, hrgn
);
692 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
693 if (dc_attr
->emf
&& !EMFDC_PaintRgn( dc_attr
, hrgn
)) return FALSE
;
694 return NtGdiFillRgn( hdc
, hrgn
, GetCurrentObject( hdc
, OBJ_BRUSH
));
697 /***********************************************************************
700 BOOL WINAPI
FrameRgn( HDC hdc
, HRGN hrgn
, HBRUSH hbrush
, INT width
, INT height
)
704 TRACE( "%p, %p, %p, %dx%d\n", hdc
, hrgn
, hbrush
, width
, height
);
706 if (is_meta_dc( hdc
)) return METADC_FrameRgn( hdc
, hrgn
, hbrush
, width
, height
);
707 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
708 if (dc_attr
->emf
&& !EMFDC_FrameRgn( dc_attr
, hrgn
, hbrush
, width
, height
))
710 return NtGdiFrameRgn( hdc
, hrgn
, hbrush
, width
, height
);
713 /***********************************************************************
714 * InvertRgn (GDI32.@)
716 BOOL WINAPI
InvertRgn( HDC hdc
, HRGN hrgn
)
720 TRACE( "%p, %p\n", hdc
, hrgn
);
722 if (is_meta_dc( hdc
)) return METADC_InvertRgn( hdc
, hrgn
);
723 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
724 if (dc_attr
->emf
&& !EMFDC_InvertRgn( dc_attr
, hrgn
)) return FALSE
;
725 return NtGdiInvertRgn( hdc
, hrgn
);
728 /***********************************************************************
729 * ExtFloodFill (GDI32.@)
731 BOOL WINAPI
ExtFloodFill( HDC hdc
, INT x
, INT y
, COLORREF color
, UINT fill_type
)
735 TRACE( "%p, (%d, %d), %08x, %x\n", hdc
, x
, y
, color
, fill_type
);
737 if (is_meta_dc( hdc
)) return METADC_ExtFloodFill( hdc
, x
, y
, color
, fill_type
);
738 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
739 if (dc_attr
->emf
&& !EMFDC_ExtFloodFill( dc_attr
, x
, y
, color
, fill_type
)) return FALSE
;
740 return NtGdiExtFloodFill( hdc
, x
, y
, color
, fill_type
);
743 /***********************************************************************
744 * FloodFill (GDI32.@)
746 BOOL WINAPI
FloodFill( HDC hdc
, INT x
, INT y
, COLORREF color
)
748 return ExtFloodFill( hdc
, x
, y
, color
, FLOODFILLBORDER
);
751 /******************************************************************************
752 * GdiGradientFill (GDI32.@)
754 BOOL WINAPI
GdiGradientFill( HDC hdc
, TRIVERTEX
*vert_array
, ULONG nvert
,
755 void *grad_array
, ULONG ngrad
, ULONG mode
)
759 TRACE( "%p vert_array:%p nvert:%d grad_array:%p ngrad:%d\n", hdc
, vert_array
,
760 nvert
, grad_array
, ngrad
);
762 if (!(dc_attr
= get_dc_attr( hdc
)))
764 SetLastError( ERROR_INVALID_PARAMETER
);
768 !EMFDC_GradientFill( dc_attr
, vert_array
, nvert
, grad_array
, ngrad
, mode
))
770 return NtGdiGradientFill( hdc
, vert_array
, nvert
, grad_array
, ngrad
, mode
);
773 /***********************************************************************
774 * ExtTextOutW (GDI32.@)
776 BOOL WINAPI
ExtTextOutW( HDC hdc
, INT x
, INT y
, UINT flags
, const RECT
*rect
,
777 const WCHAR
*str
, UINT count
, const INT
*dx
)
781 if (is_meta_dc( hdc
)) return METADC_ExtTextOut( hdc
, x
, y
, flags
, rect
, str
, count
, dx
);
782 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
783 if (dc_attr
->emf
&& !EMFDC_ExtTextOut( dc_attr
, x
, y
, flags
, rect
, str
, count
, dx
))
785 return NtGdiExtTextOutW( hdc
, x
, y
, flags
, rect
, str
, count
, dx
, 0 );
788 /***********************************************************************
789 * BeginPath (GDI32.@)
791 BOOL WINAPI
BeginPath(HDC hdc
)
795 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
796 if (dc_attr
->emf
&& !EMFDC_BeginPath( dc_attr
)) return FALSE
;
797 return NtGdiBeginPath( hdc
);
800 /***********************************************************************
803 BOOL WINAPI
EndPath(HDC hdc
)
807 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
808 if (dc_attr
->emf
&& !EMFDC_EndPath( dc_attr
)) return FALSE
;
809 return NtGdiEndPath( hdc
);
812 /***********************************************************************
813 * AbortPath (GDI32.@)
815 BOOL WINAPI
AbortPath( HDC hdc
)
819 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
820 if (dc_attr
->emf
&& !EMFDC_AbortPath( dc_attr
)) return FALSE
;
821 return NtGdiAbortPath( hdc
);
824 /***********************************************************************
825 * CloseFigure (GDI32.@)
827 BOOL WINAPI
CloseFigure( HDC hdc
)
831 if (!(dc_attr
= get_dc_attr( hdc
))) return FALSE
;
832 if (dc_attr
->emf
&& !EMFDC_CloseFigure( dc_attr
)) return FALSE
;
833 return NtGdiCloseFigure( hdc
);
836 /***********************************************************************
837 * GdiSetPixelFormat (GDI32.@)
839 BOOL WINAPI
GdiSetPixelFormat( HDC hdc
, INT format
, const PIXELFORMATDESCRIPTOR
*descr
)
841 TRACE( "(%p,%d,%p)\n", hdc
, format
, descr
);
842 return NtGdiSetPixelFormat( hdc
, format
);