2 * Misc. graphics operations
4 * Copyright 1993, 1994 Alexandre Julliard
5 * Copyright 1997 Bertho A. Stultiens
12 #include <X11/Intrinsic.h>
29 /***********************************************************************
32 BOOL16 WINAPI
LineTo16( HDC16 hdc
, INT16 x
, INT16 y
)
34 return LineTo32( hdc
, x
, y
);
38 /***********************************************************************
39 * LineTo32 (GDI32.249)
41 BOOL32 WINAPI
LineTo32( HDC32 hdc
, INT32 x
, INT32 y
)
43 DC
* dc
= DC_GetDCPtr( hdc
);
45 if(dc
&& PATH_IsPathOpen(dc
->w
.path
))
46 if(!PATH_LineTo(hdc
, x
, y
))
49 return dc
&& dc
->funcs
->pLineTo
&&
50 dc
->funcs
->pLineTo(dc
,x
,y
);
54 /***********************************************************************
57 DWORD WINAPI
MoveTo( HDC16 hdc
, INT16 x
, INT16 y
)
61 if (!MoveToEx16(hdc
,x
,y
,&pt
))
63 return MAKELONG(pt
.x
,pt
.y
);
67 /***********************************************************************
68 * MoveToEx16 (GDI.483)
70 BOOL16 WINAPI
MoveToEx16( HDC16 hdc
, INT16 x
, INT16 y
, LPPOINT16 pt
)
74 if (!MoveToEx32( (HDC32
)hdc
, (INT32
)x
, (INT32
)y
, &pt32
)) return FALSE
;
75 if (pt
) CONV_POINT32TO16( &pt32
, pt
);
81 /***********************************************************************
82 * MoveToEx32 (GDI32.254)
84 BOOL32 WINAPI
MoveToEx32( HDC32 hdc
, INT32 x
, INT32 y
, LPPOINT32 pt
)
86 DC
* dc
= DC_GetDCPtr( hdc
);
88 if(dc
&& PATH_IsPathOpen(dc
->w
.path
))
92 return dc
&& dc
->funcs
->pMoveToEx
&&
93 dc
->funcs
->pMoveToEx(dc
,x
,y
,pt
);
97 /***********************************************************************
100 BOOL16 WINAPI
Arc16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
101 INT16 bottom
, INT16 xstart
, INT16 ystart
,
102 INT16 xend
, INT16 yend
)
104 return Arc32( (HDC32
)hdc
, (INT32
)left
, (INT32
)top
, (INT32
)right
,
105 (INT32
)bottom
, (INT32
)xstart
, (INT32
)ystart
, (INT32
)xend
,
110 /***********************************************************************
113 BOOL32 WINAPI
Arc32( HDC32 hdc
, INT32 left
, INT32 top
, INT32 right
,
114 INT32 bottom
, INT32 xstart
, INT32 ystart
,
115 INT32 xend
, INT32 yend
)
117 DC
* dc
= DC_GetDCPtr( hdc
);
119 if(dc
&& PATH_IsPathOpen(dc
->w
.path
))
120 if(!PATH_Arc(hdc
, left
, top
, right
, bottom
, xstart
, ystart
, xend
,
124 return dc
&& dc
->funcs
->pArc
&&
125 dc
->funcs
->pArc(dc
,left
,top
,right
,bottom
,xstart
,ystart
,xend
,yend
);
129 /***********************************************************************
132 BOOL16 WINAPI
Pie16( HDC16 hdc
, INT16 left
, INT16 top
,
133 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
134 INT16 xend
, INT16 yend
)
136 return Pie32( (HDC32
)hdc
, (INT32
)left
, (INT32
)top
, (INT32
)right
,
137 (INT32
)bottom
, (INT32
)xstart
, (INT32
)ystart
, (INT32
)xend
,
142 /***********************************************************************
145 BOOL32 WINAPI
Pie32( HDC32 hdc
, INT32 left
, INT32 top
,
146 INT32 right
, INT32 bottom
, INT32 xstart
, INT32 ystart
,
147 INT32 xend
, INT32 yend
)
149 DC
* dc
= DC_GetDCPtr( hdc
);
151 return dc
&& dc
->funcs
->pPie
&&
152 dc
->funcs
->pPie(dc
,left
,top
,right
,bottom
,xstart
,ystart
,xend
,yend
);
156 /***********************************************************************
159 BOOL16 WINAPI
Chord16( HDC16 hdc
, INT16 left
, INT16 top
,
160 INT16 right
, INT16 bottom
, INT16 xstart
, INT16 ystart
,
161 INT16 xend
, INT16 yend
)
163 return Chord32( hdc
, left
, top
, right
, bottom
, xstart
, ystart
, xend
, yend
);
167 /***********************************************************************
170 BOOL32 WINAPI
Chord32( HDC32 hdc
, INT32 left
, INT32 top
,
171 INT32 right
, INT32 bottom
, INT32 xstart
, INT32 ystart
,
172 INT32 xend
, INT32 yend
)
174 DC
* dc
= DC_GetDCPtr( hdc
);
176 return dc
&& dc
->funcs
->pChord
&&
177 dc
->funcs
->pChord(dc
,left
,top
,right
,bottom
,xstart
,ystart
,xend
,yend
);
181 /***********************************************************************
184 BOOL16 WINAPI
Ellipse16( HDC16 hdc
, INT16 left
, INT16 top
,
185 INT16 right
, INT16 bottom
)
187 return Ellipse32( hdc
, left
, top
, right
, bottom
);
191 /***********************************************************************
192 * Ellipse32 (GDI32.75)
194 BOOL32 WINAPI
Ellipse32( HDC32 hdc
, INT32 left
, INT32 top
,
195 INT32 right
, INT32 bottom
)
197 DC
* dc
= DC_GetDCPtr( hdc
);
199 return dc
&& dc
->funcs
->pEllipse
&&
200 dc
->funcs
->pEllipse(dc
,left
,top
,right
,bottom
);
204 /***********************************************************************
205 * Rectangle16 (GDI.27)
207 BOOL16 WINAPI
Rectangle16( HDC16 hdc
, INT16 left
, INT16 top
,
208 INT16 right
, INT16 bottom
)
210 return Rectangle32( hdc
, left
, top
, right
, bottom
);
214 /***********************************************************************
215 * Rectangle32 (GDI32.283)
217 BOOL32 WINAPI
Rectangle32( HDC32 hdc
, INT32 left
, INT32 top
,
218 INT32 right
, INT32 bottom
)
220 DC
* dc
= DC_GetDCPtr( hdc
);
222 return dc
&& dc
->funcs
->pRectangle
&&
223 dc
->funcs
->pRectangle(dc
,left
,top
,right
,bottom
);
227 /***********************************************************************
228 * RoundRect16 (GDI.28)
230 BOOL16 WINAPI
RoundRect16( HDC16 hdc
, INT16 left
, INT16 top
, INT16 right
,
231 INT16 bottom
, INT16 ell_width
, INT16 ell_height
)
233 return RoundRect32( hdc
, left
, top
, right
, bottom
, ell_width
, ell_height
);
237 /***********************************************************************
238 * RoundRect32 (GDI32.291)
240 BOOL32 WINAPI
RoundRect32( HDC32 hdc
, INT32 left
, INT32 top
, INT32 right
,
241 INT32 bottom
, INT32 ell_width
, INT32 ell_height
)
243 DC
* dc
= DC_GetDCPtr( hdc
);
245 return dc
&& dc
->funcs
->pRoundRect
&&
246 dc
->funcs
->pRoundRect(dc
,left
,top
,right
,bottom
,ell_width
,ell_height
);
250 /***********************************************************************
251 * FillRect16 (USER.81)
253 INT16 WINAPI
FillRect16( HDC16 hdc
, const RECT16
*rect
, HBRUSH16 hbrush
)
257 /* coordinates are logical so we cannot fast-check 'rect',
258 * it will be done later in the PatBlt().
261 if (!(prevBrush
= SelectObject16( hdc
, hbrush
))) return 0;
262 PatBlt32( hdc
, rect
->left
, rect
->top
,
263 rect
->right
- rect
->left
, rect
->bottom
- rect
->top
, PATCOPY
);
264 SelectObject16( hdc
, prevBrush
);
269 /***********************************************************************
270 * FillRect32 (USER32.197)
272 INT32 WINAPI
FillRect32( HDC32 hdc
, const RECT32
*rect
, HBRUSH32 hbrush
)
276 if (!(prevBrush
= SelectObject32( hdc
, hbrush
))) return 0;
277 PatBlt32( hdc
, rect
->left
, rect
->top
,
278 rect
->right
- rect
->left
, rect
->bottom
- rect
->top
, PATCOPY
);
279 SelectObject32( hdc
, prevBrush
);
284 /***********************************************************************
285 * InvertRect16 (USER.82)
287 void WINAPI
InvertRect16( HDC16 hdc
, const RECT16
*rect
)
289 PatBlt32( hdc
, rect
->left
, rect
->top
,
290 rect
->right
- rect
->left
, rect
->bottom
- rect
->top
, DSTINVERT
);
294 /***********************************************************************
295 * InvertRect32 (USER32.330)
297 void WINAPI
InvertRect32( HDC32 hdc
, const RECT32
*rect
)
299 PatBlt32( hdc
, rect
->left
, rect
->top
,
300 rect
->right
- rect
->left
, rect
->bottom
- rect
->top
, DSTINVERT
);
304 /***********************************************************************
305 * FrameRect16 (USER.83)
307 INT16 WINAPI
FrameRect16( HDC16 hdc
, const RECT16
*rect
, HBRUSH16 hbrush
)
310 int left
, top
, right
, bottom
;
312 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
313 if (!dc
) return FALSE
;
315 left
= XLPTODP( dc
, rect
->left
);
316 top
= YLPTODP( dc
, rect
->top
);
317 right
= XLPTODP( dc
, rect
->right
);
318 bottom
= YLPTODP( dc
, rect
->bottom
);
320 if ( (right
<= left
) || (bottom
<= top
) ) return 0;
321 if (!(prevBrush
= SelectObject16( hdc
, hbrush
))) return 0;
323 if (DC_SetupGCForBrush( dc
))
325 PatBlt32( hdc
, rect
->left
, rect
->top
, 1,
326 rect
->bottom
- rect
->top
, PATCOPY
);
327 PatBlt32( hdc
, rect
->right
- 1, rect
->top
, 1,
328 rect
->bottom
- rect
->top
, PATCOPY
);
329 PatBlt32( hdc
, rect
->left
, rect
->top
,
330 rect
->right
- rect
->left
, 1, PATCOPY
);
331 PatBlt32( hdc
, rect
->left
, rect
->bottom
- 1,
332 rect
->right
- rect
->left
, 1, PATCOPY
);
334 SelectObject16( hdc
, prevBrush
);
339 /***********************************************************************
340 * FrameRect32 (USER32.203)
342 INT32 WINAPI
FrameRect32( HDC32 hdc
, const RECT32
*rect
, HBRUSH32 hbrush
)
345 CONV_RECT32TO16( rect
, &rect16
);
346 return FrameRect16( (HDC16
)hdc
, &rect16
, (HBRUSH16
)hbrush
);
350 /***********************************************************************
351 * SetPixel16 (GDI.31)
353 COLORREF WINAPI
SetPixel16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
355 return SetPixel32( hdc
, x
, y
, color
);
359 /***********************************************************************
360 * SetPixel32 (GDI32.327)
362 COLORREF WINAPI
SetPixel32( HDC32 hdc
, INT32 x
, INT32 y
, COLORREF color
)
364 DC
* dc
= DC_GetDCPtr( hdc
);
366 if (!dc
|| !dc
->funcs
->pSetPixel
) return 0;
367 return dc
->funcs
->pSetPixel(dc
,x
,y
,color
);
370 /***********************************************************************
371 * SetPixelV32 (GDI32.329)
373 BOOL32 WINAPI
SetPixelV32( HDC32 hdc
, INT32 x
, INT32 y
, COLORREF color
)
375 DC
* dc
= DC_GetDCPtr( hdc
);
377 if (!dc
|| !dc
->funcs
->pSetPixel
) return FALSE
;
378 dc
->funcs
->pSetPixel(dc
,x
,y
,color
);
382 /***********************************************************************
383 * GetPixel16 (GDI.83)
385 COLORREF WINAPI
GetPixel16( HDC16 hdc
, INT16 x
, INT16 y
)
387 return GetPixel32( hdc
, x
, y
);
391 /***********************************************************************
392 * GetPixel32 (GDI32.211)
394 COLORREF WINAPI
GetPixel32( HDC32 hdc
, INT32 x
, INT32 y
)
396 DC
* dc
= DC_GetDCPtr( hdc
);
399 #ifdef SOLITAIRE_SPEED_HACK
403 /* FIXME: should this be in the graphics driver? */
404 if (!PtVisible32( hdc
, x
, y
)) return 0;
405 if (!dc
|| !dc
->funcs
->pGetPixel
) return 0;
406 return dc
->funcs
->pGetPixel(dc
,x
,y
);
410 /******************************************************************************
411 * ChoosePixelFormat [GDI32.13]
412 * Matches a pixel format to given format
415 * hdc [I] Device context to search for best pixel match
416 * ppfd [I] Pixel format for which a match is sought
419 * Success: Pixel format index closest to given format
422 INT32 WINAPI
ChoosePixelFormat( HDC32 hdc
, PIXELFORMATDESCRIPTOR
*ppfd
)
424 FIXME(gdi
, "(%d,%p): stub\n",hdc
,ppfd
);
425 ppfd
->nSize
= sizeof(PIXELFORMATDESCRIPTOR
);
431 /******************************************************************************
432 * SetPixelFormat [GDI32.328]
433 * Sets pixel format of device context
436 * hdc [I] Device context to search for best pixel match
437 * iPixelFormat [I] Pixel format index
438 * ppfd [I] Pixel format for which a match is sought
442 BOOL32 WINAPI
SetPixelFormat( HDC32 hdc
, int iPixelFormat
,
443 PIXELFORMATDESCRIPTOR
* ppfd
)
445 FIXME(gdi
, "(%d,%d,%p): stub\n",hdc
,iPixelFormat
,ppfd
);
450 /******************************************************************************
451 * GetPixelFormat [GDI32.212]
452 * Gets index of pixel format of DC
455 * hdc [I] Device context whose pixel format index is sought
458 * Success: Currently selected pixel format
461 int WINAPI
GetPixelFormat( HDC32 hdc
)
463 FIXME(gdi
, "(%d): stub\n",hdc
);
468 /******************************************************************************
469 * DescribePixelFormat [GDI32.71]
470 * Gets info about pixel format from DC
473 * hdc [I] Device context
474 * iPixelFormat [I] Pixel format selector
475 * nBytes [I] Size of buffer
476 * ppfd [O] Pointer to structure to receive pixel format data
479 * Success: Maximum pixel format index of the device context
482 int WINAPI
DescribePixelFormat( HDC32 hdc
, int iPixelFormat
, UINT32 nBytes
,
483 LPPIXELFORMATDESCRIPTOR ppfd
)
485 FIXME(gdi
, "(%d,%d,%d,%p): stub\n",hdc
,iPixelFormat
,nBytes
,ppfd
);
486 ppfd
->nSize
= nBytes
;
492 /******************************************************************************
493 * SwapBuffers [GDI32.354]
494 * Exchanges front and back buffers of window
497 * hdc [I] Device context whose buffers get swapped
501 BOOL32 WINAPI
SwapBuffers( HDC32 hdc
)
503 FIXME(gdi
, "(%d): stub\n",hdc
);
508 /***********************************************************************
509 * PaintRgn16 (GDI.43)
511 BOOL16 WINAPI
PaintRgn16( HDC16 hdc
, HRGN16 hrgn
)
513 return PaintRgn32( hdc
, hrgn
);
517 /***********************************************************************
518 * PaintRgn32 (GDI32.259)
520 BOOL32 WINAPI
PaintRgn32( HDC32 hdc
, HRGN32 hrgn
)
522 DC
* dc
= DC_GetDCPtr( hdc
);
524 return dc
&& dc
->funcs
->pPaintRgn
&&
525 dc
->funcs
->pPaintRgn(dc
,hrgn
);
529 /***********************************************************************
532 BOOL16 WINAPI
FillRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
)
534 return FillRgn32( hdc
, hrgn
, hbrush
);
538 /***********************************************************************
539 * FillRgn32 (GDI32.101)
541 BOOL32 WINAPI
FillRgn32( HDC32 hdc
, HRGN32 hrgn
, HBRUSH32 hbrush
)
544 HBRUSH32 prevBrush
= SelectObject32( hdc
, hbrush
);
545 if (!prevBrush
) return FALSE
;
546 retval
= PaintRgn32( hdc
, hrgn
);
547 SelectObject32( hdc
, prevBrush
);
552 /***********************************************************************
553 * FrameRgn16 (GDI.41)
555 BOOL16 WINAPI
FrameRgn16( HDC16 hdc
, HRGN16 hrgn
, HBRUSH16 hbrush
,
556 INT16 nWidth
, INT16 nHeight
)
558 return FrameRgn32( hdc
, hrgn
, hbrush
, nWidth
, nHeight
);
562 /***********************************************************************
563 * FrameRgn32 (GDI32.105)
565 BOOL32 WINAPI
FrameRgn32( HDC32 hdc
, HRGN32 hrgn
, HBRUSH32 hbrush
,
566 INT32 nWidth
, INT32 nHeight
)
568 HRGN32 tmp
= CreateRectRgn32( 0, 0, 0, 0 );
569 if(!REGION_FrameRgn( tmp
, hrgn
, nWidth
, nHeight
)) return FALSE
;
570 FillRgn32( hdc
, tmp
, hbrush
);
571 DeleteObject32( tmp
);
576 /***********************************************************************
577 * InvertRgn16 (GDI.42)
579 BOOL16 WINAPI
InvertRgn16( HDC16 hdc
, HRGN16 hrgn
)
581 return InvertRgn32( hdc
, hrgn
);
585 /***********************************************************************
586 * InvertRgn32 (GDI32.246)
588 BOOL32 WINAPI
InvertRgn32( HDC32 hdc
, HRGN32 hrgn
)
590 HBRUSH32 prevBrush
= SelectObject32( hdc
, GetStockObject32(BLACK_BRUSH
) );
591 INT32 prevROP
= SetROP232( hdc
, R2_NOT
);
592 BOOL32 retval
= PaintRgn32( hdc
, hrgn
);
593 SelectObject32( hdc
, prevBrush
);
594 SetROP232( hdc
, prevROP
);
599 /***********************************************************************
600 * DrawFocusRect16 (USER.466)
602 void WINAPI
DrawFocusRect16( HDC16 hdc
, const RECT16
* rc
)
605 CONV_RECT16TO32( rc
, &rect32
);
606 DrawFocusRect32( hdc
, &rect32
);
610 /***********************************************************************
611 * DrawFocusRect32 (USER32.156)
613 * FIXME: PatBlt(PATINVERT) with background brush.
615 void WINAPI
DrawFocusRect32( HDC32 hdc
, const RECT32
* rc
)
617 HPEN32 hOldPen
, hnewPen
;
618 INT32 oldDrawMode
, oldBkMode
;
619 INT32 left
, top
, right
, bottom
;
621 DC
* dc
= (DC
*) GDI_GetObjPtr( hdc
, DC_MAGIC
);
624 left
= XLPTODP( dc
, rc
->left
);
625 top
= YLPTODP( dc
, rc
->top
);
626 right
= XLPTODP( dc
, rc
->right
);
627 bottom
= YLPTODP( dc
, rc
->bottom
);
629 hnewPen
= CreatePen32(PS_DOT
, 1, GetSysColor32(COLOR_WINDOWTEXT
) );
630 hOldPen
= SelectObject32( hdc
, hnewPen
);
631 oldDrawMode
= SetROP232(hdc
, R2_XORPEN
);
632 oldBkMode
= SetBkMode32(hdc
, TRANSPARENT
);
634 /* Hack: make sure the XORPEN operation has an effect */
635 dc
->u
.x
.pen
.pixel
= (1 << screenDepth
) - 1;
637 if (DC_SetupGCForPen( dc
))
638 TSXDrawRectangle( display
, dc
->u
.x
.drawable
, dc
->u
.x
.gc
,
639 dc
->w
.DCOrgX
+ left
, dc
->w
.DCOrgY
+ top
,
640 right
-left
-1, bottom
-top
-1 );
642 SetBkMode32(hdc
, oldBkMode
);
643 SetROP232(hdc
, oldDrawMode
);
644 SelectObject32(hdc
, hOldPen
);
645 DeleteObject32(hnewPen
);
649 /**********************************************************************
650 * Polyline16 (GDI.37)
652 BOOL16 WINAPI
Polyline16( HDC16 hdc
, LPPOINT16 pt
, INT16 count
)
656 LPPOINT32 pt32
= (LPPOINT32
)HeapAlloc( GetProcessHeap(), 0,
657 count
*sizeof(POINT32
) );
659 if (!pt32
) return FALSE
;
660 for (i
=count
;i
--;) CONV_POINT16TO32(&(pt
[i
]),&(pt32
[i
]));
661 ret
= Polyline32(hdc
,pt32
,count
);
662 HeapFree( GetProcessHeap(), 0, pt32
);
667 /**********************************************************************
668 * Polyline32 (GDI32.276)
670 BOOL32 WINAPI
Polyline32( HDC32 hdc
, const LPPOINT32 pt
, INT32 count
)
672 DC
* dc
= DC_GetDCPtr( hdc
);
674 return dc
&& dc
->funcs
->pPolyline
&&
675 dc
->funcs
->pPolyline(dc
,pt
,count
);
679 /**********************************************************************
682 BOOL16 WINAPI
Polygon16( HDC16 hdc
, LPPOINT16 pt
, INT16 count
)
686 LPPOINT32 pt32
= (LPPOINT32
)HeapAlloc( GetProcessHeap(), 0,
687 count
*sizeof(POINT32
) );
689 if (!pt32
) return FALSE
;
690 for (i
=count
;i
--;) CONV_POINT16TO32(&(pt
[i
]),&(pt32
[i
]));
691 ret
= Polygon32(hdc
,pt32
,count
);
692 HeapFree( GetProcessHeap(), 0, pt32
);
697 /**********************************************************************
698 * Polygon32 (GDI32.275)
700 BOOL32 WINAPI
Polygon32( HDC32 hdc
, LPPOINT32 pt
, INT32 count
)
702 DC
* dc
= DC_GetDCPtr( hdc
);
704 return dc
&& dc
->funcs
->pPolygon
&&
705 dc
->funcs
->pPolygon(dc
,pt
,count
);
709 /**********************************************************************
710 * PolyPolygon16 (GDI.450)
712 BOOL16 WINAPI
PolyPolygon16( HDC16 hdc
, LPPOINT16 pt
, LPINT16 counts
,
721 for (i
=polygons
;i
--;)
723 pt32
= (LPPOINT32
)HEAP_xalloc( GetProcessHeap(), 0, sizeof(POINT32
)*nrpts
);
725 CONV_POINT16TO32(&(pt
[i
]),&(pt32
[i
]));
726 counts32
= (LPINT32
)HEAP_xalloc( GetProcessHeap(), 0,
727 polygons
*sizeof(INT32
) );
728 for (i
=polygons
;i
--;) counts32
[i
]=counts
[i
];
730 ret
= PolyPolygon32(hdc
,pt32
,counts32
,polygons
);
731 HeapFree( GetProcessHeap(), 0, counts32
);
732 HeapFree( GetProcessHeap(), 0, pt32
);
736 /**********************************************************************
737 * PolyPolygon32 (GDI.450)
739 BOOL32 WINAPI
PolyPolygon32( HDC32 hdc
, LPPOINT32 pt
, LPINT32 counts
,
742 DC
* dc
= DC_GetDCPtr( hdc
);
744 return dc
&& dc
->funcs
->pPolyPolygon
&&
745 dc
->funcs
->pPolyPolygon(dc
,pt
,counts
,polygons
);
748 /**********************************************************************
749 * PolyPolyline32 (GDI32.272)
751 BOOL32 WINAPI
PolyPolyline32( HDC32 hdc
, LPPOINT32 pt
, LPINT32 counts
,
754 DC
* dc
= DC_GetDCPtr( hdc
);
756 return dc
&& dc
->funcs
->pPolyPolyline
&&
757 dc
->funcs
->pPolyPolyline(dc
,pt
,counts
,polylines
);
760 /**********************************************************************
761 * ExtFloodFill16 (GDI.372)
763 BOOL16 WINAPI
ExtFloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
,
766 return ExtFloodFill32( hdc
, x
, y
, color
, fillType
);
770 /**********************************************************************
771 * ExtFloodFill32 (GDI32.96)
773 BOOL32 WINAPI
ExtFloodFill32( HDC32 hdc
, INT32 x
, INT32 y
, COLORREF color
,
776 DC
*dc
= DC_GetDCPtr( hdc
);
778 return dc
&& dc
->funcs
->pExtFloodFill
&&
779 dc
->funcs
->pExtFloodFill(dc
,x
,y
,color
,fillType
);
783 /**********************************************************************
784 * FloodFill16 (GDI.25)
786 BOOL16 WINAPI
FloodFill16( HDC16 hdc
, INT16 x
, INT16 y
, COLORREF color
)
788 return ExtFloodFill32( hdc
, x
, y
, color
, FLOODFILLBORDER
);
792 /**********************************************************************
793 * FloodFill32 (GDI32.104)
795 BOOL32 WINAPI
FloodFill32( HDC32 hdc
, INT32 x
, INT32 y
, COLORREF color
)
797 return ExtFloodFill32( hdc
, x
, y
, color
, FLOODFILLBORDER
);
801 /**********************************************************************
802 * DrawAnimatedRects32 (USER32.153)
804 BOOL32 WINAPI
DrawAnimatedRects32( HWND32 hwnd
, int idAni
,
805 const LPRECT32 lprcFrom
,
806 const LPRECT32 lprcTo
)
808 FIXME(gdi
,"(%x,%d,%p,%p): empty stub!\n",
809 hwnd
, idAni
, lprcFrom
, lprcTo
);
814 /**********************************************************************
815 * PAINTING_DrawStateJam
817 * Jams in the requested type in the dc
819 static BOOL32
PAINTING_DrawStateJam(HDC32 hdc
, UINT32 opcode
,
820 DRAWSTATEPROC32 func
, LPARAM lp
, WPARAM32 wp
,
821 LPRECT32 rc
, UINT32 dtflags
,
822 BOOL32 unicode
, BOOL32 _32bit
)
827 INT32 cx
= rc
->right
- rc
->left
;
828 INT32 cy
= rc
->bottom
- rc
->top
;
835 return DrawText32W(hdc
, (LPWSTR
)lp
, (INT32
)wp
, rc
, dtflags
);
837 return DrawText32A(hdc
, (LPSTR
)lp
, (INT32
)wp
, rc
, dtflags
);
839 return DrawText32A(hdc
, (LPSTR
)PTR_SEG_TO_LIN(lp
), (INT32
)wp
, rc
, dtflags
);
842 return DrawIcon32(hdc
, rc
->left
, rc
->top
, (HICON32
)lp
);
845 memdc
= CreateCompatibleDC32(hdc
);
846 if(!memdc
) return FALSE
;
847 hbmsave
= (HBITMAP32
)SelectObject32(memdc
, (HBITMAP32
)lp
);
853 retval
= BitBlt32(hdc
, rc
->left
, rc
->top
, cx
, cy
, memdc
, 0, 0, SRCCOPY
);
854 SelectObject32(memdc
, hbmsave
);
861 return func(hdc
, lp
, wp
, cx
, cy
);
863 return (BOOL32
)((DRAWSTATEPROC16
)func
)((HDC16
)hdc
, (LPARAM
)lp
, (WPARAM16
)wp
, (INT16
)cx
, (INT16
)cy
);
870 /**********************************************************************
871 * PAINTING_DrawState32()
873 static BOOL32
PAINTING_DrawState32(HDC32 hdc
, HBRUSH32 hbr
,
874 DRAWSTATEPROC32 func
, LPARAM lp
, WPARAM32 wp
,
875 INT32 x
, INT32 y
, INT32 cx
, INT32 cy
,
876 UINT32 flags
, BOOL32 unicode
, BOOL32 _32bit
)
878 HBITMAP32 hbm
, hbmsave
;
883 UINT32 dtflags
= DT_NOCLIP
;
885 UINT32 opcode
= flags
& 0xf;
889 if((opcode
== DST_TEXT
|| opcode
== DST_PREFIXTEXT
) && !len
) /* The string is '\0' terminated */
892 len
= lstrlen32W((LPWSTR
)lp
);
894 len
= lstrlen32A((LPSTR
)lp
);
896 len
= lstrlen32A((LPSTR
)PTR_SEG_TO_LIN(lp
));
899 /* Find out what size the image has if not given by caller */
911 retval
= GetTextExtentPoint32W(hdc
, (LPWSTR
)lp
, len
, &s
);
913 retval
= GetTextExtentPoint32A(hdc
, (LPSTR
)lp
, len
, &s
);
915 retval
= GetTextExtentPoint32A(hdc
, PTR_SEG_TO_LIN(lp
), len
, &s
);
916 if(!retval
) return FALSE
;
920 ici
= (CURSORICONINFO
*)GlobalLock16((HGLOBAL16
)lp
);
921 if(!ici
) return FALSE
;
924 GlobalUnlock16((HGLOBAL16
)lp
);
928 bmp
= (BITMAPOBJ
*)GDI_GetObjPtr((HBITMAP16
)lp
, BITMAP_MAGIC
);
929 if(!bmp
) return FALSE
;
930 s
.cx
= bmp
->bitmap
.bmWidth
;
931 s
.cy
= bmp
->bitmap
.bmHeight
;
934 case DST_COMPLEX
: /* cx and cy must be set in this mode */
947 if(flags
& DSS_RIGHT
) /* This one is not documented in the win32.hlp file */
949 if(opcode
== DST_TEXT
)
950 dtflags
|= DT_NOPREFIX
;
952 /* For DSS_NORMAL we just jam in the image and return */
953 if((flags
& 0x7ff0) == DSS_NORMAL
)
955 return PAINTING_DrawStateJam(hdc
, opcode
, func
, lp
, len
, &rc
, dtflags
, unicode
, _32bit
);
958 /* For all other states we need to convert the image to B/W in a local bitmap */
959 /* before it is displayed */
960 fg
= SetTextColor32(hdc
, RGB(0, 0, 0));
961 bg
= SetBkColor32(hdc
, RGB(255, 255, 255));
962 hbm
= NULL
; hbmsave
= NULL
; memdc
= NULL
; memdc
= NULL
; hbsave
= NULL
;
963 retval
= FALSE
; /* assume failure */
965 /* From here on we must use "goto cleanup" when something goes wrong */
966 hbm
= CreateBitmap32(cx
, cy
, 1, 1, NULL
);
967 if(!hbm
) goto cleanup
;
968 memdc
= CreateCompatibleDC32(hdc
);
969 if(!memdc
) goto cleanup
;
970 hbmsave
= (HBITMAP32
)SelectObject32(memdc
, hbm
);
971 if(!hbmsave
) goto cleanup
;
972 rc
.left
= rc
.top
= 0;
975 if(!FillRect32(memdc
, &rc
, (HBRUSH32
)GetStockObject32(WHITE_BRUSH
))) goto cleanup
;
976 SetBkColor32(memdc
, RGB(255, 255, 255));
977 SetTextColor32(memdc
, RGB(0, 0, 0));
978 hfsave
= (HFONT32
)SelectObject32(memdc
, GetCurrentObject(hdc
, OBJ_FONT
));
979 if(!hfsave
&& (opcode
== DST_TEXT
|| opcode
== DST_PREFIXTEXT
)) goto cleanup
;
980 tmp
= PAINTING_DrawStateJam(memdc
, opcode
, func
, lp
, len
, &rc
, dtflags
, unicode
, _32bit
);
981 if(hfsave
) SelectObject32(memdc
, hfsave
);
982 if(!tmp
) goto cleanup
;
984 /* These states cause the image to be dithered */
985 if(flags
& (DSS_UNION
|DSS_DISABLED
))
987 hbsave
= (HBRUSH32
)SelectObject32(memdc
, CACHE_GetPattern55AABrush());
988 if(!hbsave
) goto cleanup
;
989 tmp
= PatBlt32(memdc
, 0, 0, cx
, cy
, 0x00FA0089);
990 if(hbsave
) SelectObject32(memdc
, hbsave
);
991 if(!tmp
) goto cleanup
;
994 hbsave
= (HBRUSH32
)SelectObject32(hdc
, hbr
? hbr
: GetStockObject32(WHITE_BRUSH
));
995 if(!hbsave
) goto cleanup
;
997 if(!BitBlt32(hdc
, x
, y
, cx
, cy
, memdc
, 0, 0, 0x00B8074A)) goto cleanup
;
999 /* DSS_DEFAULT makes the image boldface */
1000 if(flags
& DSS_DEFAULT
)
1002 if(!BitBlt32(hdc
, x
+1, y
, cx
, cy
, memdc
, 0, 0, 0x00B8074A)) goto cleanup
;
1005 retval
= TRUE
; /* We succeeded */
1008 SetTextColor32(hdc
, fg
);
1009 SetBkColor32(hdc
, bg
);
1011 if(hbsave
) SelectObject32(hdc
, hbsave
);
1012 if(hbmsave
) SelectObject32(memdc
, hbmsave
);
1013 if(hbm
) DeleteObject32(hbm
);
1014 if(memdc
) DeleteDC32(memdc
);
1019 /**********************************************************************
1020 * DrawState32A() (USER32.162)
1022 BOOL32 WINAPI
DrawState32A(HDC32 hdc
, HBRUSH32 hbr
,
1023 DRAWSTATEPROC32 func
, LPARAM ldata
, WPARAM32 wdata
,
1024 INT32 x
, INT32 y
, INT32 cx
, INT32 cy
, UINT32 flags
)
1026 return PAINTING_DrawState32(hdc
, hbr
, func
, ldata
, wdata
, x
, y
, cx
, cy
, flags
, FALSE
, TRUE
);
1029 /**********************************************************************
1030 * DrawState32W() (USER32.163)
1032 BOOL32 WINAPI
DrawState32W(HDC32 hdc
, HBRUSH32 hbr
,
1033 DRAWSTATEPROC32 func
, LPARAM ldata
, WPARAM32 wdata
,
1034 INT32 x
, INT32 y
, INT32 cx
, INT32 cy
, UINT32 flags
)
1036 return PAINTING_DrawState32(hdc
, hbr
, func
, ldata
, wdata
, x
, y
, cx
, cy
, flags
, TRUE
, TRUE
);
1039 /**********************************************************************
1040 * DrawState16() (USER.449)
1042 BOOL16 WINAPI
DrawState16(HDC16 hdc
, HBRUSH16 hbr
,
1043 DRAWSTATEPROC16 func
, LPARAM ldata
, WPARAM16 wdata
,
1044 INT16 x
, INT16 y
, INT16 cx
, INT16 cy
, UINT16 flags
)
1046 return PAINTING_DrawState32(hdc
, hbr
, (DRAWSTATEPROC32
)func
, ldata
, wdata
, x
, y
, cx
, cy
, flags
, FALSE
, FALSE
);
1050 /******************************************************************************
1051 * PolyBezier16 [GDI.502]
1053 BOOL16 WINAPI
PolyBezier16( HDC16 hDc
, LPPOINT16 lppt
, INT16 cPoints
)
1055 FIXME(gdi
, "(%x,%p,%d): stub\n",hDc
,lppt
,cPoints
);
1059 /******************************************************************************
1060 * PolyBezier32 [GDI32.268]
1061 * Draws one or more Bezier curves
1064 * hDc [I] Handle to device context
1065 * lppt [I] Pointer to endpoints and control points
1066 * cPoints [I] Count of endpoints and control points
1070 BOOL32 WINAPI
PolyBezier32( HDC32 hDc
, LPPOINT32 lppt
, DWORD cPoints
)
1072 FIXME(gdi
, "(%x,%p,%ld): stub\n",hDc
,lppt
,cPoints
);