Release 970202
[wine/multimedia.git] / windows / graphics.c
blob8dd1d65a5bb1b78c813feed758a937147af2a02b
1 /*
2 * GDI graphics operations
4 * Copyright 1993, 1994 Alexandre Julliard
5 */
7 #define NO_TRANSITION_TYPES /* This file is Win32-clean */
8 #include <math.h>
9 #include <stdlib.h>
10 #include <X11/Xlib.h>
11 #include <X11/Xutil.h>
12 #include <X11/Intrinsic.h>
13 #ifndef PI
14 #define PI M_PI
15 #endif
16 #include "graphics.h"
17 #include "gdi.h"
18 #include "dc.h"
19 #include "bitmap.h"
20 #include "callback.h"
21 #include "metafile.h"
22 #include "syscolor.h"
23 #include "stddebug.h"
24 #include "palette.h"
25 #include "color.h"
26 #include "region.h"
27 #include "debug.h"
28 #include "xmalloc.h"
30 /***********************************************************************
31 * LineTo16 (GDI.19)
33 BOOL16 LineTo16( HDC16 hdc, INT16 x, INT16 y )
35 return LineTo32( hdc, x, y );
39 /***********************************************************************
40 * LineTo32 (GDI32.249)
42 BOOL32 LineTo32( HDC32 hdc, INT32 x, INT32 y )
44 DC * dc = DC_GetDCPtr( hdc );
46 return dc && dc->funcs->pLineTo &&
47 dc->funcs->pLineTo(dc,x,y);
51 /***********************************************************************
52 * MoveTo (GDI.20)
54 DWORD MoveTo( HDC16 hdc, INT16 x, INT16 y )
56 POINT16 pt;
58 if (!MoveToEx16(hdc,x,y,&pt))
59 return 0;
60 return MAKELONG(pt.x,pt.y);
64 /***********************************************************************
65 * MoveToEx16 (GDI.483)
67 BOOL16 MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt )
69 POINT32 pt32;
71 if (!MoveToEx32( (HDC32)hdc, (INT32)x, (INT32)y, &pt32 )) return FALSE;
72 if (pt) CONV_POINT32TO16( &pt32, pt );
73 return TRUE;
78 /***********************************************************************
79 * MoveToEx32 (GDI32.254)
81 BOOL32 MoveToEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt )
83 DC * dc = DC_GetDCPtr( hdc );
85 return dc && dc->funcs->pMoveToEx &&
86 dc->funcs->pMoveToEx(dc,x,y,pt);
90 /***********************************************************************
91 * Arc16 (GDI.23)
93 BOOL16 Arc16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom,
94 INT16 xstart, INT16 ystart, INT16 xend, INT16 yend )
96 return Arc32( (HDC32)hdc, (INT32)left, (INT32)top, (INT32)right,
97 (INT32)bottom, (INT32)xstart, (INT32)ystart, (INT32)xend,
98 (INT32)yend );
102 /***********************************************************************
103 * Arc32 (GDI32.7)
105 BOOL32 Arc32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom,
106 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
108 DC * dc = DC_GetDCPtr( hdc );
110 return dc && dc->funcs->pArc &&
111 dc->funcs->pArc(dc,left,top,right,bottom,xstart,ystart,xend,yend);
115 /***********************************************************************
116 * Pie16 (GDI.26)
118 BOOL16 Pie16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom,
119 INT16 xstart, INT16 ystart, INT16 xend, INT16 yend )
121 return Pie32( (HDC32)hdc, (INT32)left, (INT32)top, (INT32)right,
122 (INT32)bottom, (INT32)xstart, (INT32)ystart, (INT32)xend,
123 (INT32)yend );
127 /***********************************************************************
128 * Pie32 (GDI32.262)
130 BOOL32 Pie32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom,
131 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
133 DC * dc = DC_GetDCPtr( hdc );
135 return dc && dc->funcs->pPie &&
136 dc->funcs->pPie(dc,left,top,right,bottom,xstart,ystart,xend,yend);
140 /***********************************************************************
141 * Chord16 (GDI.348)
143 BOOL16 Chord16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom,
144 INT16 xstart, INT16 ystart, INT16 xend, INT16 yend )
146 return Chord32( hdc, left, top, right, bottom, xstart, ystart, xend, yend );
150 /***********************************************************************
151 * Chord32 (GDI32.14)
153 BOOL32 Chord32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom,
154 INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
156 DC * dc = DC_GetDCPtr( hdc );
158 return dc && dc->funcs->pChord &&
159 dc->funcs->pChord(dc,left,top,right,bottom,xstart,ystart,xend,yend);
163 /***********************************************************************
164 * Ellipse16 (GDI.24)
166 BOOL16 Ellipse16( HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom )
168 return Ellipse32( hdc, left, top, right, bottom );
172 /***********************************************************************
173 * Ellipse32 (GDI32.75)
175 BOOL32 Ellipse32( HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom )
177 DC * dc = DC_GetDCPtr( hdc );
179 return dc && dc->funcs->pEllipse &&
180 dc->funcs->pEllipse(dc,left,top,right,bottom);
184 /***********************************************************************
185 * Rectangle16 (GDI.27)
187 BOOL16 Rectangle16(HDC16 hdc, INT16 left, INT16 top, INT16 right, INT16 bottom)
189 return Rectangle32( hdc, left, top, right, bottom );
193 /***********************************************************************
194 * Rectangle32 (GDI32.283)
196 BOOL32 Rectangle32(HDC32 hdc, INT32 left, INT32 top, INT32 right, INT32 bottom)
198 DC * dc = DC_GetDCPtr( hdc );
200 return dc && dc->funcs->pRectangle &&
201 dc->funcs->pRectangle(dc,left,top,right,bottom);
205 /***********************************************************************
206 * RoundRect16 (GDI.28)
208 BOOL16 RoundRect16( HDC16 hdc, INT16 left, INT16 top, INT16 right,
209 INT16 bottom, INT16 ell_width, INT16 ell_height )
211 return RoundRect32( hdc, left, top, right, bottom, ell_width, ell_height );
215 /***********************************************************************
216 * RoundRect32 (GDI32.291)
218 BOOL32 RoundRect32( HDC32 hdc, INT32 left, INT32 top, INT32 right,
219 INT32 bottom, INT32 ell_width, INT32 ell_height )
221 DC * dc = DC_GetDCPtr( hdc );
223 return dc && dc->funcs->pRoundRect &&
224 dc->funcs->pRoundRect(dc,left,top,right,bottom,ell_width,ell_height);
228 /***********************************************************************
229 * FillRect16 (USER.81)
231 INT16 FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
233 HBRUSH16 prevBrush;
235 /* coordinates are logical so we cannot fast-check rectangle
236 * - do it in PatBlt() after LPtoDP().
239 if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0;
240 PatBlt32( hdc, rect->left, rect->top,
241 rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
242 SelectObject16( hdc, prevBrush );
243 return 1;
247 /***********************************************************************
248 * FillRect32 (USER32.196)
250 INT32 FillRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush )
252 HBRUSH32 prevBrush;
254 if (!(prevBrush = SelectObject32( hdc, hbrush ))) return 0;
255 PatBlt32( hdc, rect->left, rect->top,
256 rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
257 SelectObject32( hdc, prevBrush );
258 return 1;
262 /***********************************************************************
263 * InvertRect16 (USER.82)
265 void InvertRect16( HDC16 hdc, const RECT16 *rect )
267 PatBlt32( hdc, rect->left, rect->top,
268 rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
272 /***********************************************************************
273 * InvertRect32 (USER32.329)
275 void InvertRect32( HDC32 hdc, const RECT32 *rect )
277 PatBlt32( hdc, rect->left, rect->top,
278 rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
282 /***********************************************************************
283 * FrameRect16 (USER.83)
285 INT16 FrameRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
287 HBRUSH16 prevBrush;
288 int left, top, right, bottom;
290 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
291 if (!dc) return FALSE;
293 left = XLPTODP( dc, rect->left );
294 top = YLPTODP( dc, rect->top );
295 right = XLPTODP( dc, rect->right );
296 bottom = YLPTODP( dc, rect->bottom );
298 if ( (right <= left) || (bottom <= top) ) return 0;
299 if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0;
301 if (DC_SetupGCForBrush( dc ))
303 PatBlt32( hdc, rect->left, rect->top, 1,
304 rect->bottom - rect->top, PATCOPY );
305 PatBlt32( hdc, rect->right - 1, rect->top, 1,
306 rect->bottom - rect->top, PATCOPY );
307 PatBlt32( hdc, rect->left, rect->top,
308 rect->right - rect->left, 1, PATCOPY );
309 PatBlt32( hdc, rect->left, rect->bottom - 1,
310 rect->right - rect->left, 1, PATCOPY );
312 SelectObject16( hdc, prevBrush );
313 return 1;
317 /***********************************************************************
318 * FrameRect32 (USER32.202)
320 INT32 FrameRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush )
322 RECT16 rect16;
323 CONV_RECT32TO16( rect, &rect16 );
324 return FrameRect16( (HDC16)hdc, &rect16, (HBRUSH16)hbrush );
328 /***********************************************************************
329 * SetPixel16 (GDI.31)
331 COLORREF SetPixel16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
333 return SetPixel32( hdc, x, y, color );
337 /***********************************************************************
338 * SetPixel32 (GDI32.327)
340 COLORREF SetPixel32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
342 DC * dc = DC_GetDCPtr( hdc );
344 if (!dc || !dc->funcs->pSetPixel) return 0;
345 return dc->funcs->pSetPixel(dc,x,y,color);
349 /***********************************************************************
350 * GetPixel16 (GDI.83)
352 COLORREF GetPixel16( HDC16 hdc, INT16 x, INT16 y )
354 return GetPixel32( hdc, x, y );
358 /***********************************************************************
359 * GetPixel32 (GDI32.211)
361 COLORREF GetPixel32( HDC32 hdc, INT32 x, INT32 y )
363 DC * dc = DC_GetDCPtr( hdc );
365 if (!dc) return 0;
366 #ifdef SOLITAIRE_SPEED_HACK
367 return 0;
368 #endif
370 /* FIXME: should this be in the graphics driver? */
371 if (!PtVisible32( hdc, x, y )) return 0;
372 if (!dc || !dc->funcs->pGetPixel) return 0;
373 return dc->funcs->pGetPixel(dc,x,y);
377 /***********************************************************************
378 * PaintRgn16 (GDI.43)
380 BOOL16 PaintRgn16( HDC16 hdc, HRGN16 hrgn )
382 return PaintRgn32( hdc, hrgn );
386 /***********************************************************************
387 * PaintRgn32 (GDI32.259)
389 BOOL32 PaintRgn32( HDC32 hdc, HRGN32 hrgn )
391 DC * dc = DC_GetDCPtr( hdc );
393 return dc && dc->funcs->pPaintRgn &&
394 dc->funcs->pPaintRgn(dc,hrgn);
398 /***********************************************************************
399 * FillRgn16 (GDI.40)
401 BOOL16 FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
403 return FillRgn32( hdc, hrgn, hbrush );
407 /***********************************************************************
408 * FillRgn32 (GDI32.101)
410 BOOL32 FillRgn32( HDC32 hdc, HRGN32 hrgn, HBRUSH32 hbrush )
412 BOOL32 retval;
413 HBRUSH32 prevBrush = SelectObject32( hdc, hbrush );
414 if (!prevBrush) return FALSE;
415 retval = PaintRgn32( hdc, hrgn );
416 SelectObject32( hdc, prevBrush );
417 return retval;
421 /***********************************************************************
422 * FrameRgn16 (GDI.41)
424 BOOL16 FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
425 INT16 nWidth, INT16 nHeight )
427 return FrameRgn32( hdc, hrgn, hbrush, nWidth, nHeight );
431 /***********************************************************************
432 * FrameRgn32 (GDI32.105)
434 BOOL32 FrameRgn32( HDC32 hdc, HRGN32 hrgn, HBRUSH32 hbrush,
435 INT32 nWidth, INT32 nHeight )
437 HRGN32 tmp = CreateRectRgn32( 0, 0, 0, 0 );
438 if(!REGION_FrameRgn( tmp, hrgn, nWidth, nHeight )) return FALSE;
439 FillRgn32( hdc, tmp, hbrush );
440 DeleteObject32( tmp );
441 return TRUE;
445 /***********************************************************************
446 * InvertRgn16 (GDI.42)
448 BOOL16 InvertRgn16( HDC16 hdc, HRGN16 hrgn )
450 return InvertRgn32( hdc, hrgn );
454 /***********************************************************************
455 * InvertRgn32 (GDI32.246)
457 BOOL32 InvertRgn32( HDC32 hdc, HRGN32 hrgn )
459 HBRUSH32 prevBrush = SelectObject32( hdc, GetStockObject32(BLACK_BRUSH) );
460 INT32 prevROP = SetROP232( hdc, R2_NOT );
461 BOOL32 retval = PaintRgn32( hdc, hrgn );
462 SelectObject32( hdc, prevBrush );
463 SetROP232( hdc, prevROP );
464 return retval;
468 /***********************************************************************
469 * DrawFocusRect16 (USER.466)
471 void DrawFocusRect16( HDC16 hdc, const RECT16* rc )
473 RECT32 rect32;
474 CONV_RECT16TO32( rc, &rect32 );
475 DrawFocusRect32( hdc, &rect32 );
479 /***********************************************************************
480 * DrawFocusRect32 (USER32.155)
482 * FIXME: should use Rectangle32!
484 void DrawFocusRect32( HDC32 hdc, const RECT32* rc )
486 HPEN32 hOldPen;
487 INT32 oldDrawMode, oldBkMode;
488 INT32 left, top, right, bottom;
490 DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
491 if (!dc) return;
493 left = XLPTODP( dc, rc->left );
494 top = YLPTODP( dc, rc->top );
495 right = XLPTODP( dc, rc->right );
496 bottom = YLPTODP( dc, rc->bottom );
498 hOldPen = SelectObject32( hdc, sysColorObjects.hpenWindowText );
499 oldDrawMode = SetROP232(hdc, R2_XORPEN);
500 oldBkMode = SetBkMode32(hdc, TRANSPARENT);
502 /* Hack: make sure the XORPEN operation has an effect */
503 dc->u.x.pen.pixel = (1 << screenDepth) - 1;
505 if (DC_SetupGCForPen( dc ))
506 XDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
507 dc->w.DCOrgX + left, dc->w.DCOrgY + top,
508 right-left-1, bottom-top-1 );
510 SetBkMode32(hdc, oldBkMode);
511 SetROP232(hdc, oldDrawMode);
512 SelectObject32(hdc, hOldPen);
516 /**********************************************************************
517 * GRAPH_DrawBitmap
519 * Short-cut function to blit a bitmap into a device.
520 * Faster than CreateCompatibleDC() + SelectBitmap() + BitBlt() + DeleteDC().
522 BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap, int xdest, int ydest,
523 int xsrc, int ysrc, int width, int height )
525 BITMAPOBJ *bmp;
526 DC *dc;
528 if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
529 if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
530 return FALSE;
531 XSetFunction( display, dc->u.x.gc, GXcopy );
532 if (bmp->bitmap.bmBitsPixel == 1)
534 XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
535 XSetBackground( display, dc->u.x.gc, dc->w.textPixel );
536 XCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
537 xsrc, ysrc, width, height,
538 dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest, 1 );
539 return TRUE;
541 else if (bmp->bitmap.bmBitsPixel == dc->w.bitsPerPixel)
543 XCopyArea( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
544 xsrc, ysrc, width, height,
545 dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest );
546 return TRUE;
548 else return FALSE;
552 /**********************************************************************
553 * GRAPH_DrawReliefRect (Not a MSWin Call)
555 void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size,
556 INT32 shadow_size, BOOL32 pressed )
558 HBRUSH32 hbrushOld;
559 INT32 i;
561 hbrushOld = SelectObject32(hdc, pressed ? sysColorObjects.hbrushBtnShadow :
562 sysColorObjects.hbrushBtnHighlight );
563 for (i = 0; i < highlight_size; i++)
565 PatBlt32( hdc, rect->left + i, rect->top,
566 1, rect->bottom - rect->top - i, PATCOPY );
567 PatBlt32( hdc, rect->left, rect->top + i,
568 rect->right - rect->left - i, 1, PATCOPY );
571 SelectObject32( hdc, pressed ? sysColorObjects.hbrushBtnHighlight :
572 sysColorObjects.hbrushBtnShadow );
573 for (i = 0; i < shadow_size; i++)
575 PatBlt32( hdc, rect->right - i - 1, rect->top + i,
576 1, rect->bottom - rect->top - i, PATCOPY );
577 PatBlt32( hdc, rect->left + i, rect->bottom - i - 1,
578 rect->right - rect->left - i, 1, PATCOPY );
581 SelectObject32( hdc, hbrushOld );
585 /**********************************************************************
586 * Polyline16 (GDI.37)
588 BOOL16 Polyline16( HDC16 hdc, LPPOINT16 pt, INT16 count )
590 register int i;
591 LPPOINT32 pt32 = (LPPOINT32)xmalloc(count*sizeof(POINT32));
592 BOOL16 ret;
594 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
595 ret = Polyline32(hdc,pt32,count);
596 free(pt32);
597 return ret;
601 /**********************************************************************
602 * Polyline32 (GDI32.276)
604 BOOL32 Polyline32( HDC32 hdc, const LPPOINT32 pt, INT32 count )
606 DC * dc = DC_GetDCPtr( hdc );
608 return dc && dc->funcs->pPolyline &&
609 dc->funcs->pPolyline(dc,pt,count);
613 /**********************************************************************
614 * Polygon16 (GDI.36)
616 BOOL16 Polygon16( HDC16 hdc, LPPOINT16 pt, INT16 count )
618 register int i;
619 LPPOINT32 pt32 = (LPPOINT32)xmalloc(count*sizeof(POINT32));
620 BOOL32 ret;
623 for (i=count;i--;) CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
624 ret = Polygon32(hdc,pt32,count);
625 free(pt32);
626 return ret;
630 /**********************************************************************
631 * Polygon32 (GDI32.275)
633 BOOL32 Polygon32( HDC32 hdc, LPPOINT32 pt, INT32 count )
635 DC * dc = DC_GetDCPtr( hdc );
637 return dc && dc->funcs->pPolygon &&
638 dc->funcs->pPolygon(dc,pt,count);
642 /**********************************************************************
643 * PolyPolygon16 (GDI.450)
645 BOOL16 PolyPolygon16( HDC16 hdc, LPPOINT16 pt, LPINT16 counts, UINT16 polygons)
647 int i,nrpts;
648 LPPOINT32 pt32;
649 LPINT32 counts32;
650 BOOL16 ret;
652 nrpts=0;
653 for (i=polygons;i--;)
654 nrpts+=counts[i];
655 pt32 = (LPPOINT32)xmalloc(sizeof(POINT32)*nrpts);
656 for (i=nrpts;i--;)
657 CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
658 counts32 = (LPINT32)xmalloc(polygons*sizeof(INT32));
659 for (i=polygons;i--;) counts32[i]=counts[i];
661 ret = PolyPolygon32(hdc,pt32,counts32,polygons);
662 free(counts32);
663 free(pt32);
664 return ret;
667 /**********************************************************************
668 * PolyPolygon32 (GDI.450)
670 BOOL32 PolyPolygon32( HDC32 hdc, LPPOINT32 pt, LPINT32 counts, UINT32 polygons)
672 DC * dc = DC_GetDCPtr( hdc );
674 return dc && dc->funcs->pPolyPolygon &&
675 dc->funcs->pPolyPolygon(dc,pt,counts,polygons);
678 /**********************************************************************
679 * ExtFloodFill16 (GDI.372)
681 BOOL16 ExtFloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color,
682 UINT16 fillType )
684 return ExtFloodFill32( hdc, x, y, color, fillType );
688 /**********************************************************************
689 * ExtFloodFill32 (GDI32.96)
691 BOOL32 ExtFloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color,
692 UINT32 fillType )
694 DC *dc = DC_GetDCPtr( hdc );
696 return dc && dc->funcs->pExtFloodFill &&
697 dc->funcs->pExtFloodFill(dc,x,y,color,fillType);
701 /**********************************************************************
702 * FloodFill16 (GDI.25)
704 BOOL16 FloodFill16( HDC16 hdc, INT16 x, INT16 y, COLORREF color )
706 return ExtFloodFill32( hdc, x, y, color, FLOODFILLBORDER );
710 /**********************************************************************
711 * FloodFill32 (GDI32.104)
713 BOOL32 FloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
715 return ExtFloodFill32( hdc, x, y, color, FLOODFILLBORDER );
719 /**********************************************************************
720 * DrawEdge16 (USER.659)
722 BOOL16 DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
724 RECT32 rect32;
725 BOOL32 ret;
727 CONV_RECT16TO32( rc, &rect32 );
728 ret = DrawEdge32( hdc, &rect32, edge, flags );
729 CONV_RECT32TO16( &rect32, rc );
730 return ret;
734 /**********************************************************************
735 * DrawEdge32 (USER32.154)
737 BOOL32 DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
739 HBRUSH32 hbrushOld;
741 if (flags >= BF_DIAGONAL)
742 fprintf( stderr, "DrawEdge: unsupported flags %04x\n", flags );
744 dprintf_graphics( stddeb, "DrawEdge: %04x %d,%d-%d,%d %04x %04x\n",
745 hdc, rc->left, rc->top, rc->right, rc->bottom,
746 edge, flags );
748 /* First do all the raised edges */
750 hbrushOld = SelectObject32( hdc, sysColorObjects.hbrushBtnHighlight );
751 if (edge & BDR_RAISEDOUTER)
753 if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top,
754 1, rc->bottom - rc->top - 1, PATCOPY );
755 if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top,
756 rc->right - rc->left - 1, 1, PATCOPY );
758 if (edge & BDR_SUNKENOUTER)
760 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top,
761 1, rc->bottom - rc->top, PATCOPY );
762 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1,
763 rc->right - rc->left, 1, PATCOPY );
765 if (edge & BDR_RAISEDINNER)
767 if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1,
768 1, rc->bottom - rc->top - 2, PATCOPY );
769 if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1,
770 rc->right - rc->left - 2, 1, PATCOPY );
772 if (edge & BDR_SUNKENINNER)
774 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1,
775 1, rc->bottom - rc->top - 2, PATCOPY );
776 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2,
777 rc->right - rc->left - 2, 1, PATCOPY );
780 /* Then do all the sunken edges */
782 SelectObject32( hdc, sysColorObjects.hbrushBtnShadow );
783 if (edge & BDR_SUNKENOUTER)
785 if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top,
786 1, rc->bottom - rc->top - 1, PATCOPY );
787 if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top,
788 rc->right - rc->left - 1, 1, PATCOPY );
790 if (edge & BDR_RAISEDOUTER)
792 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top,
793 1, rc->bottom - rc->top, PATCOPY );
794 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1,
795 rc->right - rc->left, 1, PATCOPY );
797 if (edge & BDR_SUNKENINNER)
799 if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1,
800 1, rc->bottom - rc->top - 2, PATCOPY );
801 if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1,
802 rc->right - rc->left - 2, 1, PATCOPY );
804 if (edge & BDR_RAISEDINNER)
806 if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1,
807 1, rc->bottom - rc->top - 2, PATCOPY );
808 if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2,
809 rc->right - rc->left - 2, 1, PATCOPY );
812 SelectObject32( hdc, hbrushOld );
813 return TRUE;
817 /**********************************************************************
818 * DrawFrameControl16 (USER.656)
820 BOOL16 DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
822 fprintf( stdnimp,"DrawFrameControl16(%x,%p,%d,%x), empty stub!\n",
823 hdc,rc,edge,flags );
824 return TRUE;
828 /**********************************************************************
829 * DrawFrameControl32 (USER32.157)
831 BOOL32 DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
833 fprintf( stdnimp,"DrawFrameControl32(%x,%p,%d,%x), empty stub!\n",
834 hdc,rc,edge,flags );
835 return TRUE;