gimp r26293 - in trunk: . app/core app/paint



Author: neo
Date: Wed Jul 23 12:20:45 2008
New Revision: 26293
URL: http://svn.gnome.org/viewvc/gimp?rev=26293&view=rev

Log:
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().



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpchannel.c
   trunk/app/paint/gimppaintcore-stroke.c
   trunk/app/paint/gimppaintcore-stroke.h

Modified: trunk/app/core/gimpchannel.c
==============================================================================
--- trunk/app/core/gimpchannel.c	(original)
+++ trunk/app/core/gimpchannel.c	Wed Jul 23 12:20:45 2008
@@ -712,6 +712,7 @@
 
         retval = gimp_paint_core_stroke_boundary (core, drawable,
                                                   stroke_desc->paint_options,
+                                                  stroke_desc->emulate_dynamics,
                                                   segs_in, n_segs_in,
                                                   offset_x, offset_y,
                                                   error);

Modified: trunk/app/paint/gimppaintcore-stroke.c
==============================================================================
--- trunk/app/paint/gimppaintcore-stroke.c	(original)
+++ trunk/app/paint/gimppaintcore-stroke.c	Wed Jul 23 12:20:45 2008
@@ -34,7 +34,8 @@
 #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;
 
@@ -93,6 +94,7 @@
 gimp_paint_core_stroke_boundary (GimpPaintCore     *core,
                                  GimpDrawable      *drawable,
                                  GimpPaintOptions  *paint_options,
+                                 gboolean           emulate_dynamics,
                                  const BoundSeg    *bound_segs,
                                  gint               n_bound_segs,
                                  gint               offset_x,
@@ -162,6 +164,9 @@
 
       n_coords++;
 
+      if (emulate_dynamics)
+        gimp_paint_core_stroke_emulate_dynamics (coords, n_coords);
+
       if (initialized ||
           gimp_paint_core_start (core, drawable, paint_options, &coords[0],
                                  error))
@@ -262,7 +267,8 @@
             }
 
           if (emulate_dynamics)
-            gimp_paint_core_stroke_emulate_dynamics (coords);
+            gimp_paint_core_stroke_emulate_dynamics ((GimpCoords *) coords->data,
+                                                     coords->len);
 
           if (initialized ||
               gimp_paint_core_start (core, drawable, paint_options,
@@ -314,9 +320,10 @@
 }
 
 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 */
   if (pressure_length > 0)
@@ -327,27 +334,26 @@
       /* Calculate pressure start ramp */
       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 */
-      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 =
-            1.0 - (i - (coords->len - pressure_length)) * step;
+          coords[i].pressure = 1.0 - (i - (len - pressure_length)) * step;
         }
     }
 
   /* 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;
 
       /* 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;
         }
     }
 }

Modified: trunk/app/paint/gimppaintcore-stroke.h
==============================================================================
--- trunk/app/paint/gimppaintcore-stroke.h	(original)
+++ trunk/app/paint/gimppaintcore-stroke.h	Wed Jul 23 12:20:45 2008
@@ -29,6 +29,7 @@
 gboolean   gimp_paint_core_stroke_boundary (GimpPaintCore     *core,
                                             GimpDrawable      *drawable,
                                             GimpPaintOptions  *paint_options,
+                                            gboolean           emulate_dynamics,
                                             const BoundSeg    *bound_segs,
                                             gint               n_bound_segs,
                                             gint               offset_x,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]