mirror of https://github.com/GNOME/gimp.git
also implement brush dynamics emulation for stroking selections.
2008-07-23 Sven Neumann <sven@gimp.org> * app/paint/gimppaintcore-stroke.[ch]: also implement brush dynamics emulation for stroking selections. * app/core/gimpchannel.c: pass the 'emulate-dynamics' parameter to gimp_paint_core_stroke_boundary(). svn path=/trunk/; revision=26293
This commit is contained in:
parent
7c389ba534
commit
5624a717fe
|
@ -1,3 +1,11 @@
|
||||||
|
2008-07-23 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/paint/gimppaintcore-stroke.[ch]: also implement brush
|
||||||
|
dynamics emulation for stroking selections.
|
||||||
|
|
||||||
|
* app/core/gimpchannel.c: pass the 'emulate-dynamics' parameter to
|
||||||
|
gimp_paint_core_stroke_boundary().
|
||||||
|
|
||||||
2008-07-23 Sven Neumann <sven@gimp.org>
|
2008-07-23 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpsessioninfo.c (gimp_session_info_get_geometry):
|
* app/widgets/gimpsessioninfo.c (gimp_session_info_get_geometry):
|
||||||
|
|
|
@ -712,6 +712,7 @@ gimp_channel_stroke (GimpItem *item,
|
||||||
|
|
||||||
retval = gimp_paint_core_stroke_boundary (core, drawable,
|
retval = gimp_paint_core_stroke_boundary (core, drawable,
|
||||||
stroke_desc->paint_options,
|
stroke_desc->paint_options,
|
||||||
|
stroke_desc->emulate_dynamics,
|
||||||
segs_in, n_segs_in,
|
segs_in, n_segs_in,
|
||||||
offset_x, offset_y,
|
offset_x, offset_y,
|
||||||
error);
|
error);
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
#include "gimppaintoptions.h"
|
#include "gimppaintoptions.h"
|
||||||
|
|
||||||
|
|
||||||
static void gimp_paint_core_stroke_emulate_dynamics (GArray *coords);
|
static void gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
|
||||||
|
gint len);
|
||||||
|
|
||||||
static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
|
static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
|
||||||
|
|
||||||
|
@ -93,6 +94,7 @@ gboolean
|
||||||
gimp_paint_core_stroke_boundary (GimpPaintCore *core,
|
gimp_paint_core_stroke_boundary (GimpPaintCore *core,
|
||||||
GimpDrawable *drawable,
|
GimpDrawable *drawable,
|
||||||
GimpPaintOptions *paint_options,
|
GimpPaintOptions *paint_options,
|
||||||
|
gboolean emulate_dynamics,
|
||||||
const BoundSeg *bound_segs,
|
const BoundSeg *bound_segs,
|
||||||
gint n_bound_segs,
|
gint n_bound_segs,
|
||||||
gint offset_x,
|
gint offset_x,
|
||||||
|
@ -162,6 +164,9 @@ gimp_paint_core_stroke_boundary (GimpPaintCore *core,
|
||||||
|
|
||||||
n_coords++;
|
n_coords++;
|
||||||
|
|
||||||
|
if (emulate_dynamics)
|
||||||
|
gimp_paint_core_stroke_emulate_dynamics (coords, n_coords);
|
||||||
|
|
||||||
if (initialized ||
|
if (initialized ||
|
||||||
gimp_paint_core_start (core, drawable, paint_options, &coords[0],
|
gimp_paint_core_start (core, drawable, paint_options, &coords[0],
|
||||||
error))
|
error))
|
||||||
|
@ -262,7 +267,8 @@ gimp_paint_core_stroke_vectors (GimpPaintCore *core,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emulate_dynamics)
|
if (emulate_dynamics)
|
||||||
gimp_paint_core_stroke_emulate_dynamics (coords);
|
gimp_paint_core_stroke_emulate_dynamics ((GimpCoords *) coords->data,
|
||||||
|
coords->len);
|
||||||
|
|
||||||
if (initialized ||
|
if (initialized ||
|
||||||
gimp_paint_core_start (core, drawable, paint_options,
|
gimp_paint_core_start (core, drawable, paint_options,
|
||||||
|
@ -314,9 +320,10 @@ gimp_paint_core_stroke_vectors (GimpPaintCore *core,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_paint_core_stroke_emulate_dynamics (GArray *coords)
|
gimp_paint_core_stroke_emulate_dynamics (GimpCoords *coords,
|
||||||
|
gint len)
|
||||||
{
|
{
|
||||||
const gint pressure_length = coords->len / 3;
|
const gint pressure_length = len / 3;
|
||||||
|
|
||||||
/* Calculate and create pressure ramp parameters */
|
/* Calculate and create pressure ramp parameters */
|
||||||
if (pressure_length > 0)
|
if (pressure_length > 0)
|
||||||
|
@ -327,27 +334,26 @@ gimp_paint_core_stroke_emulate_dynamics (GArray *coords)
|
||||||
/* Calculate pressure start ramp */
|
/* Calculate pressure start ramp */
|
||||||
for (i = 0; i < pressure_length; i++)
|
for (i = 0; i < pressure_length; i++)
|
||||||
{
|
{
|
||||||
g_array_index (coords, GimpCoords, i).pressure = i * step;
|
coords[i].pressure = i * step;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate pressure end ramp */
|
/* Calculate pressure end ramp */
|
||||||
for (i = coords->len - pressure_length; i < coords->len; i++)
|
for (i = len - pressure_length; i < len; i++)
|
||||||
{
|
{
|
||||||
g_array_index (coords, GimpCoords, i).pressure =
|
coords[i].pressure = 1.0 - (i - (len - pressure_length)) * step;
|
||||||
1.0 - (i - (coords->len - pressure_length)) * step;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate and create velocity ramp parameters */
|
/* Calculate and create velocity ramp parameters */
|
||||||
if (coords->len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
gdouble step = 1.0 / coords->len;
|
gdouble step = 1.0 / len;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
/* Calculate velocity end ramp */
|
/* Calculate velocity end ramp */
|
||||||
for (i = 0; i < coords->len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
g_array_index (coords, GimpCoords, i).velocity = i * step;
|
coords[i].velocity = i * step;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ gboolean gimp_paint_core_stroke (GimpPaintCore *core,
|
||||||
gboolean gimp_paint_core_stroke_boundary (GimpPaintCore *core,
|
gboolean gimp_paint_core_stroke_boundary (GimpPaintCore *core,
|
||||||
GimpDrawable *drawable,
|
GimpDrawable *drawable,
|
||||||
GimpPaintOptions *paint_options,
|
GimpPaintOptions *paint_options,
|
||||||
|
gboolean emulate_dynamics,
|
||||||
const BoundSeg *bound_segs,
|
const BoundSeg *bound_segs,
|
||||||
gint n_bound_segs,
|
gint n_bound_segs,
|
||||||
gint offset_x,
|
gint offset_x,
|
||||||
|
|
Loading…
Reference in New Issue