Mercurial > dwindows
comparison win/dw.c @ 1261:61d0c5f84644
Initial attempt at adding dw_draw_arc() support on all platforms.
This code doesn't yet work... will probably require a bunch of fixes...
but I wanted to get the code committed while doing research on it.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 25 Oct 2011 10:51:59 +0000 |
parents | 35b177e8a0a2 |
children | 148daf522080 |
comparison
equal
deleted
inserted
replaced
1260:3cbd8de0b50b | 1261:61d0c5f84644 |
---|---|
8813 FrameRect(hdcPaint, &Rect, TlsGetValue(_hBrush)); | 8813 FrameRect(hdcPaint, &Rect, TlsGetValue(_hBrush)); |
8814 if(!pixmap) | 8814 if(!pixmap) |
8815 ReleaseDC(handle, hdcPaint); | 8815 ReleaseDC(handle, hdcPaint); |
8816 } | 8816 } |
8817 | 8817 |
8818 /* Draw an arc on a window (preferably a render window). | |
8819 * Parameters: | |
8820 * handle: Handle to the window. | |
8821 * pixmap: Handle to the pixmap. (choose only one of these) | |
8822 * flags: For future use. | |
8823 * xorigin: X coordinate of center of arc. | |
8824 * yorigin: Y coordinate of center of arc. | |
8825 * x1: X coordinate of first segment of arc. | |
8826 * y1: Y coordinate of first segment of arc. | |
8827 * x2: X coordinate of second segment of arc. | |
8828 * y2: Y coordinate of second segment of arc. | |
8829 */ | |
8830 void API dw_draw_arc(HWND handle, HPIXMAP pixmap, int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) | |
8831 { | |
8832 HDC hdcPaint; | |
8833 HBRUSH oldBrush; | |
8834 HPEN oldPen; | |
8835 double dx = xorigin - x1; | |
8836 double dy = yorigin - y1; | |
8837 double r = sqrt(dx*dx + dy*dy); | |
8838 | |
8839 if(handle) | |
8840 hdcPaint = GetDC(handle); | |
8841 else if(pixmap) | |
8842 hdcPaint = pixmap->hdc; | |
8843 else | |
8844 return; | |
8845 | |
8846 oldBrush = SelectObject( hdcPaint, TlsGetValue(_hBrush) ); | |
8847 oldPen = SelectObject( hdcPaint, TlsGetValue(_hPen) ); | |
8848 Arc(hdcPaint, xorigin-r, yorigin-r, xorigin+r, yorigin+r, x1, y1, x2, y2); | |
8849 SelectObject( hdcPaint, oldBrush ); | |
8850 SelectObject( hdcPaint, oldPen ); | |
8851 | |
8852 if(!pixmap) | |
8853 ReleaseDC(handle, hdcPaint); | |
8854 } | |
8855 | |
8818 /* Draw text on a window (preferably a render window). | 8856 /* Draw text on a window (preferably a render window). |
8819 * Parameters: | 8857 * Parameters: |
8820 * handle: Handle to the window. | 8858 * handle: Handle to the window. |
8821 * pixmap: Handle to the pixmap. (choose only one of these) | 8859 * pixmap: Handle to the pixmap. (choose only one of these) |
8822 * x: X coordinate. | 8860 * x: X coordinate. |