Commit 51c9cdd3 authored by Michael Schumacher's avatar Michael Schumacher Committed by Michael Schumacher

applying a patch by Joao S. O. Bueno Calligaris which implements

2006-01-31  Michael Schumacher  <schumaml@cvs.gnome.org>

	* app/core/gimpbrushpipe.c: applying a patch by Joao S. O. Bueno
	Calligaris which implements PIPE_SELECT_VELOCITY for brush
	pipes. Fixes bug #150227.
parent 21ff206f
2006-01-31 Michael Schumacher <schumaml@cvs.gnome.org>
* app/core/gimpbrushpipe.c: applying a patch by Joao S. O. Bueno
Calligaris which implements PIPE_SELECT_VELOCITY for brush
pipes. Fixes bug #150227.
2006-01-31 Sven Neumann <sven@gimp.org>
* app/tools/gimplevelstool.c (gimp_levels_tool_color_picker_new):
......
......@@ -194,11 +194,16 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
{
GimpBrushPipe *pipe = GIMP_BRUSH_PIPE (brush);
gint i, brushix, ix;
gdouble angle;
gdouble angle, velocity, spacing;
if (pipe->nbrushes == 1)
return GIMP_BRUSH (pipe->current);
/* calculates brush native spacing in pixels, based on it's width)*/
spacing = ((gdouble) pipe->current->spacing / 100) *
MAX (brush->mask->width, brush->mask->height);
brushix = 0;
for (i = 0; i < pipe->dimension; i++)
{
......@@ -221,6 +226,15 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
ix = RINT (angle / (2.0 * G_PI) * pipe->rank[i]);
break;
case PIPE_SELECT_VELOCITY:
velocity = sqrt (SQR (cur_coords->x - last_coords->x) +
SQR (cur_coords->y - last_coords->y));
/* I don't know how much velocity is enough velocity. I will assume 0 to
brush' saved spacing (converted to pixels) to be 'enough' velocity */
ix = ROUND ((1.0 - MIN (1.0, velocity / (spacing))) * pipe->rank[i]);
break;
case PIPE_SELECT_RANDOM:
/* This probably isn't the right way */
ix = g_random_int_range (0, pipe->rank[i]);
......
......@@ -194,11 +194,16 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
{
GimpBrushPipe *pipe = GIMP_BRUSH_PIPE (brush);
gint i, brushix, ix;
gdouble angle;
gdouble angle, velocity, spacing;
if (pipe->nbrushes == 1)
return GIMP_BRUSH (pipe->current);
/* calculates brush native spacing in pixels, based on it's width)*/
spacing = ((gdouble) pipe->current->spacing / 100) *
MAX (brush->mask->width, brush->mask->height);
brushix = 0;
for (i = 0; i < pipe->dimension; i++)
{
......@@ -221,6 +226,15 @@ gimp_brush_pipe_select_brush (GimpBrush *brush,
ix = RINT (angle / (2.0 * G_PI) * pipe->rank[i]);
break;
case PIPE_SELECT_VELOCITY:
velocity = sqrt (SQR (cur_coords->x - last_coords->x) +
SQR (cur_coords->y - last_coords->y));
/* I don't know how much velocity is enough velocity. I will assume 0 to
brush' saved spacing (converted to pixels) to be 'enough' velocity */
ix = ROUND ((1.0 - MIN (1.0, velocity / (spacing))) * pipe->rank[i]);
break;
case PIPE_SELECT_RANDOM:
/* This probably isn't the right way */
ix = g_random_int_range (0, pipe->rank[i]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment