changeset 177:6880934d11bf trunk

[svn] - add "Clear Surface" instruction.
author nenolod
date Wed, 01 Nov 2006 01:11:20 -0800
parents c93118f6ef27
children 62b4e23cb333
files ChangeLog src/paranormal/builtins.c src/paranormal/general.c
diffstat 3 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 01 01:03:30 2006 -0800
+++ b/ChangeLog	Wed Nov 01 01:11:20 2006 -0800
@@ -1,3 +1,11 @@
+2006-11-01 09:03:30 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [352]
+  - update Mosaic effect helptext.
+  
+  trunk/src/paranormal/general.c |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2006-11-01 09:00:19 +0000  William Pitcock <nenolod@nenolod.net>
   revision [350]
   - make mosaic sizable.
--- a/src/paranormal/builtins.c	Wed Nov 01 01:03:30 2006 -0800
+++ b/src/paranormal/builtins.c	Wed Nov 01 01:11:20 2006 -0800
@@ -58,6 +58,7 @@
   &builtin_general_fade,
   &builtin_general_blur,
   &builtin_general_mosaic,
+  &builtin_general_clear,
   /* **************** wave **************** */
   &builtin_wave_horizontal,
   &builtin_wave_vertical,
--- a/src/paranormal/general.c	Wed Nov 01 01:03:30 2006 -0800
+++ b/src/paranormal/general.c	Wed Nov 01 01:11:20 2006 -0800
@@ -21,8 +21,7 @@
 general_fade_exec (const struct pn_actuator_option *opts,
 	   gpointer data)
 {
-  int amt = opts[0].val.ival > 255 || opts[0].val.ival < 0 ?
-    3 : opts[0].val.ival;
+  int amt = opts[0].val.ival > 255 || opts[0].val.ival < 0 ? 3 : opts[0].val.ival;
   int i, j;
 
   for (j=0; j<pn_image_data->height; j++)
@@ -113,7 +112,7 @@
   register guchar *srcptr = pn_image_data->surface[0];
   register guchar *destptr = pn_image_data->surface[1];
   register int sum;
-  int radius = opts[0].val.ival;
+  int radius = opts[0].val.ival > 255 || opts[0].val.ival < 0 ? 6 : opts[0].val.ival;
 
   for (j=0; j<pn_image_data->height; j += radius)
     for (i=0; i<pn_image_data->width; i += radius)
@@ -147,3 +146,20 @@
   0, general_mosaic_opts,
   NULL, NULL, general_mosaic_exec
 };
+
+/* **************** general_clear **************** */
+static void
+general_clear_exec (const struct pn_actuator_option *opts,
+	   gpointer data)
+{
+   memset(pn_image_data->surface[0], '\0',
+	  (pn_image_data->height * pn_image_data->width));
+}
+
+struct pn_actuator_desc builtin_general_clear =
+{
+  "general_clear", "Clear Surface", "Clears the surface.",
+  0, NULL,
+  NULL, NULL, general_clear_exec
+};
+