changeset 181:156d6c875ef0 trunk

[svn] - add value invert filter
author nenolod
date Wed, 01 Nov 2006 13:19:36 -0800
parents 83d230421dfc
children 6048abdac7d1
files ChangeLog src/paranormal/builtins.c src/paranormal/general.c
diffstat 3 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 01 01:50:23 2006 -0800
+++ b/ChangeLog	Wed Nov 01 13:19:36 2006 -0800
@@ -1,3 +1,11 @@
+2006-11-01 09:50:23 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [360]
+  - take advantage of the ability to do nothing
+  
+  trunk/src/paranormal/presets/nenolod_-_branchscope.pnv |   20 +++++++++++++++--
+  1 file changed, 18 insertions(+), 2 deletions(-)
+
+
 2006-11-01 09:32:26 +0000  William Pitcock <nenolod@nenolod.net>
   revision [358]
   - NOOP instruction. What this does is basically takes a slot in a
--- a/src/paranormal/builtins.c	Wed Nov 01 01:50:23 2006 -0800
+++ b/src/paranormal/builtins.c	Wed Nov 01 13:19:36 2006 -0800
@@ -28,6 +28,7 @@
 DECLARE_ACTUATOR (general_mosaic);
 DECLARE_ACTUATOR (general_clear);
 DECLARE_ACTUATOR (general_noop);
+DECLARE_ACTUATOR (general_invert);
 
 /* **************** wave **************** */
 DECLARE_ACTUATOR (wave_horizontal);
@@ -62,6 +63,7 @@
   &builtin_general_mosaic,
   &builtin_general_clear,
   &builtin_general_noop,
+  &builtin_general_invert,
   /* **************** wave **************** */
   &builtin_wave_horizontal,
   &builtin_wave_vertical,
--- a/src/paranormal/general.c	Wed Nov 01 01:50:23 2006 -0800
+++ b/src/paranormal/general.c	Wed Nov 01 13:19:36 2006 -0800
@@ -178,3 +178,23 @@
   NULL, NULL, general_noop_exec
 };
 
+/* **************** general_invert **************** */
+static void
+general_invert_exec (const struct pn_actuator_option *opts,
+	   gpointer data)
+{
+  int i, j;
+
+  for (j=0; j < pn_image_data->height; j++)
+    for (i=0; i < pn_image_data->width; i++)
+      pn_image_data->surface[0][PN_IMG_INDEX (i, j)] =
+	255 - pn_image_data->surface[0][PN_IMG_INDEX (i, j)];
+}
+
+struct pn_actuator_desc builtin_general_invert =
+{
+  "general_invert", "Value Invert", "Performs a value invert.",
+  0, NULL,
+  NULL, NULL, general_invert_exec
+};
+