Mercurial > dwindows
comparison gtk3/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 | 8655753e2bc4 |
children | fe92a6f6d3e7 |
comparison
equal
deleted
inserted
replaced
1274:885b55c0d7d7 | 1275:0b34e2cf0706 |
---|---|
6830 | 6830 |
6831 /* Draw a closed polygon on a window (preferably a render window). | 6831 /* Draw a closed polygon on a window (preferably a render window). |
6832 * Parameters: | 6832 * Parameters: |
6833 * handle: Handle to the window. | 6833 * handle: Handle to the window. |
6834 * pixmap: Handle to the pixmap. (choose only one of these) | 6834 * pixmap: Handle to the pixmap. (choose only one of these) |
6835 * fill: if true filled | 6835 * flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0). |
6836 * number of points | 6836 * number of points |
6837 * x[]: X coordinates. | 6837 * x[]: X coordinates. |
6838 * y[]: Y coordinates. | 6838 * y[]: Y coordinates. |
6839 */ | 6839 */ |
6840 void dw_draw_polygon(HWND handle, HPIXMAP pixmap, int fill, int npoints, int *x, int *y) | 6840 void dw_draw_polygon(HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y) |
6841 { | 6841 { |
6842 int _locked_by_me = FALSE; | 6842 int _locked_by_me = FALSE; |
6843 cairo_t *cr = NULL; | 6843 cairo_t *cr = NULL; |
6844 int z; | 6844 int z; |
6845 | 6845 |
6866 cairo_move_to(cr, x[0], y[0]); | 6866 cairo_move_to(cr, x[0], y[0]); |
6867 for(z=1;z<npoints;z++) | 6867 for(z=1;z<npoints;z++) |
6868 { | 6868 { |
6869 cairo_line_to(cr, x[z], y[z]); | 6869 cairo_line_to(cr, x[z], y[z]); |
6870 } | 6870 } |
6871 if(fill) | 6871 if(flags & DW_DRAW_FILL) |
6872 cairo_fill(cr); | 6872 cairo_fill(cr); |
6873 cairo_stroke(cr); | 6873 cairo_stroke(cr); |
6874 cairo_destroy(cr); | 6874 cairo_destroy(cr); |
6875 } | 6875 } |
6876 DW_MUTEX_UNLOCK; | 6876 DW_MUTEX_UNLOCK; |
6878 | 6878 |
6879 /* Draw a rectangle on a window (preferably a render window). | 6879 /* Draw a rectangle on a window (preferably a render window). |
6880 * Parameters: | 6880 * Parameters: |
6881 * handle: Handle to the window. | 6881 * handle: Handle to the window. |
6882 * pixmap: Handle to the pixmap. (choose only one of these) | 6882 * pixmap: Handle to the pixmap. (choose only one of these) |
6883 * fill: if true filled | 6883 * flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0). |
6884 * x: X coordinate. | 6884 * x: X coordinate. |
6885 * y: Y coordinate. | 6885 * y: Y coordinate. |
6886 * width: Width of rectangle. | 6886 * width: Width of rectangle. |
6887 * height: Height of rectangle. | 6887 * height: Height of rectangle. |
6888 */ | 6888 */ |
6889 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int fill, int x, int y, int width, int height) | 6889 void dw_draw_rect(HWND handle, HPIXMAP pixmap, int flags, int x, int y, int width, int height) |
6890 { | 6890 { |
6891 int _locked_by_me = FALSE; | 6891 int _locked_by_me = FALSE; |
6892 cairo_t *cr = NULL; | 6892 cairo_t *cr = NULL; |
6893 | 6893 |
6894 DW_MUTEX_LOCK; | 6894 DW_MUTEX_LOCK; |
6913 cairo_set_line_width(cr, 1); | 6913 cairo_set_line_width(cr, 1); |
6914 cairo_move_to(cr, x, y); | 6914 cairo_move_to(cr, x, y); |
6915 cairo_line_to(cr, x, y + height); | 6915 cairo_line_to(cr, x, y + height); |
6916 cairo_line_to(cr, x + width, y + height); | 6916 cairo_line_to(cr, x + width, y + height); |
6917 cairo_line_to(cr, x + width, y); | 6917 cairo_line_to(cr, x + width, y); |
6918 if(fill) | 6918 if(flags & DW_DRAW_FILL) |
6919 cairo_fill(cr); | 6919 cairo_fill(cr); |
6920 cairo_stroke(cr); | 6920 cairo_stroke(cr); |
6921 cairo_destroy(cr); | 6921 cairo_destroy(cr); |
6922 } | 6922 } |
6923 DW_MUTEX_UNLOCK; | 6923 DW_MUTEX_UNLOCK; |
6925 | 6925 |
6926 /* Draw an arc on a window (preferably a render window). | 6926 /* Draw an arc on a window (preferably a render window). |
6927 * Parameters: | 6927 * Parameters: |
6928 * handle: Handle to the window. | 6928 * handle: Handle to the window. |
6929 * pixmap: Handle to the pixmap. (choose only one of these) | 6929 * pixmap: Handle to the pixmap. (choose only one of these) |
6930 * flags: For future use. | 6930 * flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0). |
6931 * DW_DRAW_FULL will draw a complete circle/elipse. | |
6931 * xorigin: X coordinate of center of arc. | 6932 * xorigin: X coordinate of center of arc. |
6932 * yorigin: Y coordinate of center of arc. | 6933 * yorigin: Y coordinate of center of arc. |
6933 * x1: X coordinate of first segment of arc. | 6934 * x1: X coordinate of first segment of arc. |
6934 * y1: Y coordinate of first segment of arc. | 6935 * y1: Y coordinate of first segment of arc. |
6935 * x2: X coordinate of second segment of arc. | 6936 * x2: X coordinate of second segment of arc. |