Release 970305
[wine/multimedia.git] / windows / graphics.c
blob6169fa75cf72300d879faf96fd467ae7b6d98b2c
1 /*
2 * GDI graphics operations
4 * Copyright 1993, 1994 Alexandre Julliard
5 */
7 #include <math.h>
8 #include <stdlib.h>
9 #include <X11/Xlib.h>
10 #include <X11/Xutil.h>
11 #include <X11/Intrinsic.h>
12 #ifndef PI
13 #define PI M_PI
14 #endif
15 #include "graphics.h"
16 #include "gdi.h"
17 #include "dc.h"
18 #include "bitmap.h"
19 #include "callback.h"
20 #include "metafile.h"
21 #include "syscolor.h"
22 #include "stddebug.h"
23 #include "palette.h"
24 #include "color.h"
25 #include "region.h"
26 #include "debug.h"
27 #include "xmalloc.h"
29 /***********************************************************************
30 * LineTo16 (GDI.19)
32 BOOL16 LineTo16( HDC16 hdc, INT16 x, INT16 y )
34 return LineTo32( hdc, x, y );
38 /***********************************************************************
39 * LineTo32 (GDI32.249)
41 BOOL32 LineTo32( HDC32 hdc, INT32 x, INT32 y )
43 DC * dc = DC_GetDCPtr( hdc );
45 return dc && dc->funcs->pLineTo &&
46 dc->funcs->pLineTo(dc,x,y);
50 /***********************************************************************
51 * MoveTo (GDI.20)
53 DWORD MoveTo( HDC16 hdc, INT16 x, INT16 y )
55 POINT16 pt;
57 if (!MoveToEx16(hdc,x,y,&pt))
58 return 0;
59 return MAKELONG(pt.x,pt.y);
63 /***********************************************************************
64 * MoveToEx16 (GDI.483)
66 BOOL16 MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
68 POINT32 pt32;
70 if (!MoveToEx32( (HDC32)hdc, (INT32)x, (INT32)y, &pt32 )) return FALSE;
71 if (pt) CONV_POINT32TO16( &pt32, pt );
72 return TRUE;
77 /***********************************************************************
78 * MoveToEx32 (GDI32.254)
80 BOOL32 MoveToEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt )
82 DC * dc = DC_GetDCPtr( hdc );
84 return dc && dc->funcs->pMoveToEx &&
85 dc->funcs->pMoveToEx(dc,x,y,pt);
89 /***********************************************************************
90 * Arc16 (GDI.23)
92 BOOL16 Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom,
93 INT16 xstart, INT16 ystart, INT16 xend, INT16 yend )
95 return Arc32( (HDC32)hdc, (INT32)left, (INT32)top, (INT32)right,
96 (INT32)bottom, (INT32)xstart, (INT32)ystart, (INT32)xend,
97 (INT32)yend );
101 /***********************************************************************
102 * Arc32 (GDI32.7)
104 BOOL32 Arc32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom,
105 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
107 DC * dc = DC_GetDCPtr( hdc );
109 return dc && dc->funcs->pArc &&
110 dc->funcs->pArc(dc,left,top,right,bottom,xstart,ystart,xend,yend);
114 /***********************************************************************
115 * Pie16 (GDI.26)
117 BOOL16 Pie16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom,
118 INT16 xstart, INT16 ystart, INT16 xend, INT16 yend )
120 return Pie32( (HDC32)hdc, (INT32)left, (INT32)top, (INT32)right,
121 (INT32)bottom, (INT32)xstart, (INT32)ystart, (INT32)xend,
122 (INT32)yend );
126 /***********************************************************************
127 * Pie32 (GDI32.262)
129 BOOL32 Pie32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom,
130 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
132 DC * dc = DC_GetDCPtr( hdc );
134 return dc && dc->funcs->pPie &&
135 dc->funcs->pPie(dc,left,top,right,bottom,xstart,ystart,xend,yend);
139 /***********************************************************************
140 * Chord16 (GDI.348)
142 BOOL16 Chord16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom,
143 INT16 xstart, INT16 ystart, INT16 xend, INT16 yend )
145 return Chord32( hdc, left, top, right, bottom, xstart, ystart, xend, yend );
149 /***********************************************************************
150 * Chord32 (GDI32.14)
152 BOOL32 Chord32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom,
153 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
155 DC * dc = DC_GetDCPtr( hdc );
157 return dc && dc->funcs->pChord &&
158 dc->funcs->pChord(dc,left,top,right,bottom,xstart,ystart,xend,yend);
162 /***********************************************************************
163 * Ellipse16 (GDI.24)
165 BOOL16 Ellipse16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom )
167 return Ellipse32( hdc, left, top, right, bottom );
171 /***********************************************************************
172 * Ellipse32 (GDI32.75)
174 BOOL32 Ellipse32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom )
176 DC * dc = DC_GetDCPtr( hdc );
178 return dc && dc->funcs->pEllipse &&
179 dc->funcs->pEllipse(dc,left,top,right,bottom);
183 /***********************************************************************
184 * Rectangle16 (GDI.27)
186 BOOL16 Rectangle16(HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom)
188 return Rectangle32( hdc, left, top, right, bottom );
192 /***********************************************************************
193 * Rectangle32 (GDI32.283)
195 BOOL32 Rectangle32(HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom)
197 DC * dc = DC_GetDCPtr( hdc );
199 return dc && dc->funcs->pRectangle &&
200 dc->funcs->pRectangle(dc,left,top,right,bottom);
204 /***********************************************************************
205 * RoundRect16 (GDI.28)
207 BOOL16 RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
208 INT16 bottom, INT16 ell_width, INT16 ell_height )
210 return RoundRect32( hdc, left, top, right, bottom, ell_width, ell_height );
214 /***********************************************************************
215 * RoundRect32 (GDI32.291)
217 BOOL32 RoundRect32( HDC32 hdc, INT32 left, INT32 top, INT32 right,
218 INT32 bottom, INT32 ell_width, INT32 ell_height )
220 DC * dc = DC_GetDCPtr( hdc );
222 return dc && dc->funcs->pRoundRect &&
223 dc->funcs->pRoundRect(dc,left,top,right,bottom,ell_width,ell_height);
227 /***********************************************************************
228 * FillRect16 (USER.81)
230 INT16 FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
232 HBRUSH16 prevBrush;
234 /* coordinates are logical so we cannot fast-check rectangle
235 * - do it in PatBlt() after LPtoDP().
238 if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0;
239 PatBlt32( hdc, rect->left, rect->top,
240 rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
241 SelectObject16( hdc, prevBrush );
242 return 1;
246 /***********************************************************************
247 * FillRect32 (USER32.196)
249 INT32 FillRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush )
251 HBRUSH32 prevBrush;
253 if (!(prevBrush = SelectObject32( hdc, hbrush ))) return 0;
254 PatBlt32( hdc, rect->left, rect->top,
255 rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
256 SelectObject32( hdc, prevBrush );
257 return 1;
261 /***********************************************************************
262 * InvertRect16 (USER.82)
264 void InvertRect16( HDC16 hdc, const RECT16 *rect )
266 PatBlt32( hdc, rect->left, rect->top,
267 rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
271 /***********************************************************************
272 * InvertRect32 (USER32.329)
274 void InvertRect32( HDC32 hdc, const RECT32 *rect )
276 PatBlt32( hdc, rect->left, rect->top,
277 rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
281 /***********************************************************************
282 * FrameRect16 (USER.83)
284 INT16 FrameRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
286 HBRUSH16 prevBrush;
287 int left, top, right, bottom;
289 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
290 if (!dc) return FALSE;
292 left = XLPTODP( dc, rect->left );
293 top = YLPTODP( dc, rect->top );
294 right = XLPTODP( dc, rect->right );
295 bottom = YLPTODP( dc, rect->bottom );
297 if ( (right <= left) || (bottom <= top) ) return 0;
298 if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0;
300 if (DC_SetupGCForBrush( dc ))
302 PatBlt32( hdc, rect->left, rect->top, 1,
303 rect->bottom - rect->top, PATCOPY );
304 PatBlt32( hdc, rect->right - 1, rect->top, 1,
305 rect->bottom - rect->top, PATCOPY );
306 PatBlt32( hdc, rect->left, rect->top,
307 rect->right - rect->left, 1, PATCOPY );
308 PatBlt32( hdc, rect->left, rect->bottom - 1,
309 rect->right - rect->left, 1, PATCOPY );
311 SelectObject16( hdc, prevBrush );
312 return 1;
316 /***********************************************************************
317 * FrameRect32 (USER32.202)
319 INT32 FrameRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush )
321 RECT16 rect16;
322 CONV_RECT32TO16( rect, &rect16 );
323 return FrameRect16( (HDC16)hdc, &rect16, (HBRUSH16)hbrush );
327 /***********************************************************************
328 * SetPixel16 (GDI.31)
330 COLORREF SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
332 return SetPixel32( hdc, x, y, color );
336 /***********************************************************************
337 * SetPixel32 (GDI32.327)
339 COLORREF SetPixel32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
341 DC * dc = DC_GetDCPtr( hdc );
343 if (!dc || !dc->funcs->pSetPixel) return 0;
344 return dc->funcs->pSetPixel(dc,x,y,color);
348 /***********************************************************************
349 * GetPixel16 (GDI.83)
351 COLORREF GetPixel16( HDC16 hdc, INT16 x, INT16 y )
353 return GetPixel32( hdc, x, y );
357 /***********************************************************************
358 * GetPixel32 (GDI32.211)
360 COLORREF GetPixel32( HDC32 hdc, INT32 x, INT32 y )
362 DC * dc = DC_GetDCPtr( hdc );
364 if (!dc) return 0;
365 #ifdef SOLITAIRE_SPEED_HACK
366 return 0;
367 #endif
369 /* FIXME: should this be in the graphics driver? */
370 if (!PtVisible32( hdc, x, y )) return 0;
371 if (!dc || !dc->funcs->pGetPixel) return 0;
372 return dc->funcs->pGetPixel(dc,x,y);
376 /***********************************************************************
377 * PaintRgn16 (GDI.43)
379 BOOL16 PaintRgn16( HDC16 hdc, HRGN16 hrgn )
381 return PaintRgn32( hdc, hrgn );
385 /***********************************************************************
386 * PaintRgn32 (GDI32.259)
388 BOOL32 PaintRgn32( HDC32 hdc, HRGN32 hrgn )
390 DC * dc = DC_GetDCPtr( hdc );
392 return dc && dc->funcs->pPaintRgn &&
393 dc->funcs->pPaintRgn(dc,hrgn);
397 /***********************************************************************
398 * FillRgn16 (GDI.40)
400 BOOL16 FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
402 return FillRgn32( hdc, hrgn, hbrush );
406 /***********************************************************************
407 * FillRgn32 (GDI32.101)
409 BOOL32 FillRgn32( HDC32 hdc, HRGN32 hrgn, HBRUSH32 hbrush )
411 BOOL32 retval;
412 HBRUSH32 prevBrush = SelectObject32( hdc, hbrush );
413 if (!prevBrush) return FALSE;
414 retval = PaintRgn32( hdc, hrgn );
415 SelectObject32( hdc, prevBrush );
416 return retval;
420 /***********************************************************************
421 * FrameRgn16 (GDI.41)
423 BOOL16 FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
424 INT16 nWidth, INT16 nHeight )
426 return FrameRgn32( hdc, hrgn, hbrush, nWidth, nHeight );
430 /***********************************************************************
431 * FrameRgn32 (GDI32.105)
433 BOOL32 FrameRgn32( HDC32 hdc, HRGN32 hrgn, HBRUSH32 hbrush,
434 INT32 nWidth, INT32 nHeight )
436 HRGN32 tmp = CreateRectRgn32( 0, 0, 0, 0 );
437 if(!REGION_FrameRgn( tmp, hrgn, nWidth, nHeight )) return FALSE;
438 FillRgn32( hdc, tmp, hbrush );
439 DeleteObject32( tmp );
440 return TRUE;
444 /***********************************************************************
445 * InvertRgn16 (GDI.42)
447 BOOL16 InvertRgn16( HDC16 hdc, HRGN16 hrgn )
449 return InvertRgn32( hdc, hrgn );
453 /***********************************************************************
454 * InvertRgn32 (GDI32.246)
456 BOOL32 InvertRgn32( HDC32 hdc, HRGN32 hrgn )
458 HBRUSH32 prevBrush = SelectObject32( hdc, GetStockObject32(BLACK_BRUSH) );
459 INT32 prevROP = SetROP232( hdc, R2_NOT );
460 BOOL32 retval = PaintRgn32( hdc, hrgn );
461 SelectObject32( hdc, prevBrush );
462 SetROP232( hdc, prevROP );
463 return retval;
467 /***********************************************************************
468 * DrawFocusRect16 (USER.466)
470 void DrawFocusRect16( HDC16 hdc, const RECT16* rc )
472 RECT32 rect32;
473 CONV_RECT16TO32( rc, &rect32 );
474 DrawFocusRect32( hdc, &rect32 );
478 /***********************************************************************
479 * DrawFocusRect32 (USER32.155)
481 * FIXME: should use Rectangle32!
483 void DrawFocusRect32( HDC32 hdc, const RECT32* rc )
485 HPEN32 hOldPen;
486 INT32 oldDrawMode, oldBkMode;
487 INT32 left, top, right, bottom;
489 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
490 if (!dc) return;
492 left = XLPTODP( dc, rc->left );
493 top = YLPTODP( dc, rc->top );
494 right = XLPTODP( dc, rc->right );
495 bottom = YLPTODP( dc, rc->bottom );
497 hOldPen = SelectObject32( hdc, sysColorObjects.hpenWindowText );
498 oldDrawMode = SetROP232(hdc, R2_XORPEN);
499 oldBkMode = SetBkMode32(hdc, TRANSPARENT);
501 /* Hack: make sure the XORPEN operation has an effect */
502 dc->u.x.pen.pixel = (1 << screenDepth) - 1;
504 if (DC_SetupGCForPen( dc ))
505 XDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
506 dc->w.DCOrgX + left, dc->w.DCOrgY + top,
507 right-left-1, bottom-top-1 );
509 SetBkMode32(hdc, oldBkMode);
510 SetROP232(hdc, oldDrawMode);
511 SelectObject32(hdc, hOldPen);
515 /**********************************************************************
516 * GRAPH_DrawBitmap
518 * Short-cut function to blit a bitmap into a device.
519 * Faster than CreateCompatibleDC() + SelectBitmap() + BitBlt() + DeleteDC().
521 BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap, int xdest, int ydest,
522 int xsrc, int ysrc, int width, int height )
524 BITMAPOBJ *bmp;
525 DC *dc;
527 if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
528 if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
529 return FALSE;
530 XSetFunction( display, dc->u.x.gc, GXcopy );
531 if (bmp->bitmap.bmBitsPixel == 1)
533 XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
534 XSetBackground( display, dc->u.x.gc, dc->w.textPixel );
535 XCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
536 xsrc, ysrc, width, height,
537 dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest, 1 );
538 return TRUE;
540 else if (bmp->bitmap.bmBitsPixel == dc->w.bitsPerPixel)
542 XCopyArea( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
543 xsrc, ysrc, width, height,
544 dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest );
545 return TRUE;
547 else return FALSE;
551 /**********************************************************************
552 * GRAPH_DrawReliefRect (Not a MSWin Call)
554 void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size,
555 INT32 shadow_size, BOOL32 pressed )
557 HBRUSH32 hbrushOld;
558 INT32 i;
560 hbrushOld = SelectObject32(hdc, pressed ? sysColorObjects.hbrushBtnShadow :
561 sysColorObjects.hbrushBtnHighlight );
562 for (i = 0; i < highlight_size; i++)
564 PatBlt32( hdc, rect->left + i, rect->top,
565 1, rect->bottom - rect->top - i, PATCOPY );
566 PatBlt32( hdc, rect->left, rect->top + i,
567 rect->right - rect->left - i, 1, PATCOPY );
570 SelectObject32( hdc, pressed ? sysColorObjects.hbrushBtnHighlight :
571 sysColorObjects.hbrushBtnShadow );
572 for (i = 0; i < shadow_size; i++)
574 PatBlt32( hdc, rect->right - i - 1, rect->top + i,
575 1, rect->bottom - rect->top - i, PATCOPY );
576 PatBlt32( hdc, rect->left + i, rect->bottom - i - 1,
577 rect->right - rect->left - i, 1, PATCOPY );
580 SelectObject32( hdc, hbrushOld );
584 /**********************************************************************
585 * Polyline16 (GDI.37)
587 BOOL16 Polyline16( HDC16 hdc, LPPOINT16 pt, INT16 count )
589 register int i;
590 LPPOINT32 pt32 = (LPPOINT32)xmalloc(count*sizeof(POINT32));
591 BOOL16 ret;
593 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
594 ret = Polyline32(hdc,pt32,count);
595 free(pt32);
596 return ret;
600 /**********************************************************************
601 * Polyline32 (GDI32.276)
603 BOOL32 Polyline32( HDC32 hdc, const LPPOINT32 pt, INT32 count )
605 DC * dc = DC_GetDCPtr( hdc );
607 return dc && dc->funcs->pPolyline &&
608 dc->funcs->pPolyline(dc,pt,count);
612 /**********************************************************************
613 * Polygon16 (GDI.36)
615 BOOL16 Polygon16( HDC16 hdc, LPPOINT16 pt, INT16 count )
617 register int i;
618 LPPOINT32 pt32 = (LPPOINT32)xmalloc(count*sizeof(POINT32));
619 BOOL32 ret;
622 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
623 ret = Polygon32(hdc,pt32,count);
624 free(pt32);
625 return ret;
629 /**********************************************************************
630 * Polygon32 (GDI32.275)
632 BOOL32 Polygon32( HDC32 hdc, LPPOINT32 pt, INT32 count )
634 DC * dc = DC_GetDCPtr( hdc );
636 return dc && dc->funcs->pPolygon &&
637 dc->funcs->pPolygon(dc,pt,count);
641 /**********************************************************************
642 * PolyPolygon16 (GDI.450)
644 BOOL16 PolyPolygon16( HDC16 hdc, LPPOINT16 pt, LPINT16 counts, UINT16 polygons)
646 int i,nrpts;
647 LPPOINT32 pt32;
648 LPINT32 counts32;
649 BOOL16 ret;
651 nrpts=0;
652 for (i=polygons;i--;)
653 nrpts+=counts[i];
654 pt32 = (LPPOINT32)xmalloc(sizeof(POINT32)*nrpts);
655 for (i=nrpts;i--;)
656 CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
657 counts32 = (LPINT32)xmalloc(polygons*sizeof(INT32));
658 for (i=polygons;i--;) counts32[i]=counts[i];
660 ret = PolyPolygon32(hdc,pt32,counts32,polygons);
661 free(counts32);
662 free(pt32);
663 return ret;
666 /**********************************************************************
667 * PolyPolygon32 (GDI.450)
669 BOOL32 PolyPolygon32( HDC32 hdc, LPPOINT32 pt, LPINT32 counts, UINT32 polygons)
671 DC * dc = DC_GetDCPtr( hdc );
673 return dc && dc->funcs->pPolyPolygon &&
674 dc->funcs->pPolyPolygon(dc,pt,counts,polygons);
677 /**********************************************************************
678 * ExtFloodFill16 (GDI.372)
680 BOOL16 ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
681 UINT16 fillType )
683 return ExtFloodFill32( hdc, x, y, color, fillType );
687 /**********************************************************************
688 * ExtFloodFill32 (GDI32.96)
690 BOOL32 ExtFloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color,
691 UINT32 fillType )
693 DC *dc = DC_GetDCPtr( hdc );
695 return dc && dc->funcs->pExtFloodFill &&
696 dc->funcs->pExtFloodFill(dc,x,y,color,fillType);
700 /**********************************************************************
701 * FloodFill16 (GDI.25)
703 BOOL16 FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
705 return ExtFloodFill32( hdc, x, y, color, FLOODFILLBORDER );
709 /**********************************************************************
710 * FloodFill32 (GDI32.104)
712 BOOL32 FloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
714 return ExtFloodFill32( hdc, x, y, color, FLOODFILLBORDER );
718 /**********************************************************************
719 * DrawEdge16 (USER.659)
721 BOOL16 DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
723 RECT32 rect32;
724 BOOL32 ret;
726 CONV_RECT16TO32( rc, &rect32 );
727 ret = DrawEdge32( hdc, &rect32, edge, flags );
728 CONV_RECT32TO16( &rect32, rc );
729 return ret;
733 /**********************************************************************
734 * DrawEdge32 (USER32.154)
736 BOOL32 DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
738 HBRUSH32 hbrushOld;
740 if (flags >= BF_DIAGONAL)
741 fprintf( stderr, "DrawEdge: unsupported flags %04x\n", flags );
743 dprintf_graphics( stddeb, "DrawEdge: %04x %d,%d-%d,%d %04x %04x\n",
744 hdc, rc->left, rc->top, rc->right, rc->bottom,
745 edge, flags );
747 /* First do all the raised edges */
749 hbrushOld = SelectObject32( hdc, sysColorObjects.hbrushBtnHighlight );
750 if (edge & BDR_RAISEDOUTER)
752 if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top,
753 1, rc->bottom - rc->top - 1, PATCOPY );
754 if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top,
755 rc->right - rc->left - 1, 1, PATCOPY );
757 if (edge & BDR_SUNKENOUTER)
759 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top,
760 1, rc->bottom - rc->top, PATCOPY );
761 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1,
762 rc->right - rc->left, 1, PATCOPY );
764 if (edge & BDR_RAISEDINNER)
766 if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1,
767 1, rc->bottom - rc->top - 2, PATCOPY );
768 if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1,
769 rc->right - rc->left - 2, 1, PATCOPY );
771 if (edge & BDR_SUNKENINNER)
773 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1,
774 1, rc->bottom - rc->top - 2, PATCOPY );
775 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2,
776 rc->right - rc->left - 2, 1, PATCOPY );
779 /* Then do all the sunken edges */
781 SelectObject32( hdc, sysColorObjects.hbrushBtnShadow );
782 if (edge & BDR_SUNKENOUTER)
784 if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top,
785 1, rc->bottom - rc->top - 1, PATCOPY );
786 if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top,
787 rc->right - rc->left - 1, 1, PATCOPY );
789 if (edge & BDR_RAISEDOUTER)
791 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top,
792 1, rc->bottom - rc->top, PATCOPY );
793 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1,
794 rc->right - rc->left, 1, PATCOPY );
796 if (edge & BDR_SUNKENINNER)
798 if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1,
799 1, rc->bottom - rc->top - 2, PATCOPY );
800 if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1,
801 rc->right - rc->left - 2, 1, PATCOPY );
803 if (edge & BDR_RAISEDINNER)
805 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1,
806 1, rc->bottom - rc->top - 2, PATCOPY );
807 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2,
808 rc->right - rc->left - 2, 1, PATCOPY );
811 SelectObject32( hdc, hbrushOld );
812 return TRUE;
816 /**********************************************************************
817 * DrawFrameControl16 (USER.656)
819 BOOL16 DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
821 fprintf( stdnimp,"DrawFrameControl16(%x,%p,%d,%x), empty stub!\n",
822 hdc,rc,edge,flags );
823 return TRUE;
827 /**********************************************************************
828 * DrawFrameControl32 (USER32.157)
830 BOOL32 DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
832 fprintf( stdnimp,"DrawFrameControl32(%x,%p,%d,%x), empty stub!\n",
833 hdc,rc,edge,flags );
834 return TRUE;