comparison win/dw.c @ 1275:0b34e2cf0706

Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc. The fill parameter has been replaced by flags which should be backwards compatible. Also updated the source comments to reflect these changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 30 Oct 2011 10:14:49 +0000
parents 24f1dc19601d
children b99b0b2c2826
comparison
equal deleted inserted replaced
1274:885b55c0d7d7 1275:0b34e2cf0706
8725 8725
8726 /* Draw a closed polygon on a window (preferably a render window). 8726 /* Draw a closed polygon on a window (preferably a render window).
8727 * Parameters: 8727 * Parameters:
8728 * handle: Handle to the window. 8728 * handle: Handle to the window.
8729 * pixmap: Handle to the pixmap. (choose only one of these) 8729 * pixmap: Handle to the pixmap. (choose only one of these)
8730 * fill: if true filled 8730 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0).
8731 * number of points 8731 * number of points
8732 * x[]: X coordinates. 8732 * x[]: X coordinates.
8733 * y[]: Y coordinates. 8733 * y[]: Y coordinates.
8734 */ 8734 */
8735 void API dw_draw_polygon(HWND handle, HPIXMAP pixmap, int fill, int npoints, int *x, int *y) 8735 void API dw_draw_polygon(HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y)
8736 { 8736 {
8737 HDC hdcPaint; 8737 HDC hdcPaint;
8738 HBRUSH oldBrush; 8738 HBRUSH oldBrush;
8739 HPEN oldPen; 8739 HPEN oldPen;
8740 POINT *points; 8740 POINT *points;
8773 } 8773 }
8774 } 8774 }
8775 8775
8776 oldBrush = SelectObject( hdcPaint, TlsGetValue(_hBrush) ); 8776 oldBrush = SelectObject( hdcPaint, TlsGetValue(_hBrush) );
8777 oldPen = SelectObject( hdcPaint, TlsGetValue(_hPen) ); 8777 oldPen = SelectObject( hdcPaint, TlsGetValue(_hPen) );
8778 if ( fill ) 8778 if ( flags & DW_DRAW_FILL )
8779 Polygon( hdcPaint, points, npoints ); 8779 Polygon( hdcPaint, points, npoints );
8780 else 8780 else
8781 Polyline( hdcPaint, points, npoints ); 8781 Polyline( hdcPaint, points, npoints );
8782 SelectObject( hdcPaint, oldBrush ); 8782 SelectObject( hdcPaint, oldBrush );
8783 SelectObject( hdcPaint, oldPen ); 8783 SelectObject( hdcPaint, oldPen );
8788 8788
8789 /* Draw a rectangle on a window (preferably a render window). 8789 /* Draw a rectangle on a window (preferably a render window).
8790 * Parameters: 8790 * Parameters:
8791 * handle: Handle to the window. 8791 * handle: Handle to the window.
8792 * pixmap: Handle to the pixmap. (choose only one of these) 8792 * pixmap: Handle to the pixmap. (choose only one of these)
8793 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0).
8793 * x: X coordinate. 8794 * x: X coordinate.
8794 * y: Y coordinate. 8795 * y: Y coordinate.
8795 * width: Width of rectangle. 8796 * width: Width of rectangle.
8796 * height: Height of rectangle. 8797 * height: Height of rectangle.
8797 */ 8798 */
8798 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) 8799 void API dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height)
8799 { 8800 {
8800 HDC hdcPaint; 8801 HDC hdcPaint;
8801 RECT Rect; 8802 RECT Rect;
8802 8803
8803 if(handle) 8804 if(handle)
8806 hdcPaint = pixmap->hdc; 8807 hdcPaint = pixmap->hdc;
8807 else 8808 else
8808 return; 8809 return;
8809 8810
8810 SetRect(&Rect, x, y, x + width , y + height ); 8811 SetRect(&Rect, x, y, x + width , y + height );
8811 if(fill) 8812 if(flags & DW_DRAW_FILL)
8812 FillRect(hdcPaint, &Rect, TlsGetValue(_hBrush)); 8813 FillRect(hdcPaint, &Rect, TlsGetValue(_hBrush));
8813 else 8814 else
8814 FrameRect(hdcPaint, &Rect, TlsGetValue(_hBrush)); 8815 FrameRect(hdcPaint, &Rect, TlsGetValue(_hBrush));
8815 if(!pixmap) 8816 if(!pixmap)
8816 ReleaseDC(handle, hdcPaint); 8817 ReleaseDC(handle, hdcPaint);
8818 8819
8819 /* Draw an arc on a window (preferably a render window). 8820 /* Draw an arc on a window (preferably a render window).
8820 * Parameters: 8821 * Parameters:
8821 * handle: Handle to the window. 8822 * handle: Handle to the window.
8822 * pixmap: Handle to the pixmap. (choose only one of these) 8823 * pixmap: Handle to the pixmap. (choose only one of these)
8823 * flags: For future use. 8824 * flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0).
8825 * DW_DRAW_FULL will draw a complete circle/elipse.
8824 * xorigin: X coordinate of center of arc. 8826 * xorigin: X coordinate of center of arc.
8825 * yorigin: Y coordinate of center of arc. 8827 * yorigin: Y coordinate of center of arc.
8826 * x1: X coordinate of first segment of arc. 8828 * x1: X coordinate of first segment of arc.
8827 * y1: Y coordinate of first segment of arc. 8829 * y1: Y coordinate of first segment of arc.
8828 * x2: X coordinate of second segment of arc. 8830 * x2: X coordinate of second segment of arc.