Mercurial > audlegacy-plugins
annotate src/paranormal/drawing.c @ 1060:2649ba83333b trunk
[svn] - remove xmms_session value from GeneralPlugin structs per plugin api v2
author | nenolod |
---|---|
date | Thu, 24 May 2007 02:07:53 -0700 |
parents | 3d0b7ca9c8eb |
children | 8aab955fb114 |
rev | line source |
---|---|
193 | 1 #include <math.h> |
2 | |
192 | 3 #include "paranormal.h" |
4 #include "actuators.h" | |
5 #include "pn_utils.h" | |
6 | |
7 extern SDL_Surface *screen; | |
8 | |
9 void | |
304
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
10 pn_draw_dot (guint x, guint y, guchar value) |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
11 { |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
12 if (x > pn_image_data->width || x < 0 || y > pn_image_data->height || y < 0) |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
13 return; |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
14 |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
15 pn_image_data->surface[0][PN_IMG_INDEX(x, y)] = value; |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
16 } |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
17 |
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
18 void |
192 | 19 pn_draw_line (guint _x0, guint _y0, guint _x1, guint _y1, guchar value) |
20 { | |
21 gint x0 = _x0; | |
22 gint y0 = _y0; | |
23 gint x1 = _x1; | |
24 gint y1 = _y1; | |
25 | |
193 | 26 gint dx = x1 - x0; |
192 | 27 gint dy = y1 - y0; |
28 | |
304
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
29 pn_draw_dot(x0, y0, value); |
193 | 30 |
31 if (dx != 0) | |
192 | 32 { |
193 | 33 gfloat m = (gfloat) dy / (gfloat) dx; |
34 gfloat b = y0 - m * x0; | |
35 | |
36 dx = (x1 > x0) ? 1 : - 1; | |
192 | 37 while (x0 != x1) |
193 | 38 { |
39 x0 += dx; | |
268 | 40 y0 = m * x0 + b; |
193 | 41 |
304
3d0b7ca9c8eb
[svn] - add pn_draw_dot() and convert some functions to use that instead of redundant checks all over the code.
nenolod
parents:
298
diff
changeset
|
42 pn_draw_dot(x0, y0, value); |
193 | 43 } |
192 | 44 } |
45 } |