[gegl: 50/55] Noise-Pick Operation add random seed



commit cfc88c6ccc5f466ac7e8f1740a8c952e2d16f9ad
Author: Maxime Nicco <maxime nicco gmail fr>
Date:   Wed Aug 15 19:15:29 2012 +0200

    Noise-Pick Operation add random seed
    
    add random seed functionality

 operations/common/noise-pick.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/operations/common/noise-pick.c b/operations/common/noise-pick.c
index 1fd8b52..d0772f7 100644
--- a/operations/common/noise-pick.c
+++ b/operations/common/noise-pick.c
@@ -19,7 +19,7 @@
 
 /*
  *  PICK Operation
- *     We pick a pixel at random from the neighboring of the current pixel.
+ *     We pick a pixel at random from the neighborhood of the current pixel.
  */
 
 #include "config.h"
@@ -27,7 +27,9 @@
 
 #ifdef GEGL_CHANT_PROPERTIES
 
-//gegl_chant_int (random_seed, _("Random seed"),   1, 8, 2, _("Random seed"))
+gegl_chant_boolean (random_seed, _("Random Seed "), FALSE, _("to get a random seed"))
+
+gegl_chant_seed (seed, _("Seed"), _("Random seed"))
 
 gegl_chant_double (pct_random, _("Randomization (%)"),   0.0, 100.0, 3.0, _("Radomization"))
 
@@ -82,7 +84,11 @@ process (GeglOperation       *operation,
   gint k, b, i;
   gint total_pixels;
 
-  gr = g_rand_new ();
+  if (o->random_seed)
+    gr = g_rand_new();
+  else
+    gr = g_rand_new_with_seed (o->seed);
+
   tmp = gegl_buffer_new(result, babl_format ("RGBA float"));
 
   src_rect.x      = result->x - op_area->left;



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