Index: trunk/Ohana/src/kapa2/doc/rainbow.cm
===================================================================
--- trunk/Ohana/src/kapa2/doc/rainbow.cm	(revision 38153)
+++ trunk/Ohana/src/kapa2/doc/rainbow.cm	(revision 38153)
@@ -0,0 +1,3 @@
+0.25 0.0 0.0 1.0
+0.50 0.0 1.0 0.0
+0.75 1.0 0.0 0.0
Index: trunk/Ohana/src/kapa2/doc/vista.cm
===================================================================
--- trunk/Ohana/src/kapa2/doc/vista.cm	(revision 38153)
+++ trunk/Ohana/src/kapa2/doc/vista.cm	(revision 38153)
@@ -0,0 +1,7 @@
+0.10 0.5 0.8 0.0
+0.28 0.0 1.0 0.2
+0.35 0.2 1.0 0.7
+0.45 0.0 0.0 1.0
+0.60 1.0 0.0 0.9
+0.75 0.6 0.0 0.0
+0.90 0.8 0.0 0.0
Index: trunk/Ohana/src/kapa2/src/DrawObjects.c
===================================================================
--- trunk/Ohana/src/kapa2/src/DrawObjects.c	(revision 38062)
+++ trunk/Ohana/src/kapa2/src/DrawObjects.c	(revision 38153)
@@ -248,5 +248,5 @@
   
   /* connect first point to second point */
-  sxa = sx0 - 0.5*(sx1 - sx0);
+  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
   sya = MAX (sy0, Y0);
   DrawLine (sx0, sy0, sxa, sy0);
@@ -254,5 +254,5 @@
   
   /* draw segment equal distance behind first point and down to x-axis */
-  sxa = 0.5*(sx0 + sx1);
+  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
   DrawLine (sx0, sy0, sxa, sy0);
   DrawLine (sxa, sy0, sxa, sy1);
@@ -269,5 +269,5 @@
     sx1 = MIN (MAX (sx1, X0), X1);
     sy1 = MAX (MIN (sy1, Y0), Y1);
-    sxa = 0.5*(sx0 + sx1);
+    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
     DrawLine (sx0, sy0, sxa, sy0);
     DrawLine (sxa, sy0, sxa, sy1);
@@ -278,5 +278,5 @@
   
   /* draw segment equal distance after last point and down to x-axis */
-  sxa = sx1 + 0.5*(sx1 - sxo);
+  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
   sya = MAX (sy1, Y0);
   DrawLine (sx1, sy1, sxa, sy1);
Index: trunk/Ohana/src/kapa2/src/InterpretKeys.c
===================================================================
--- trunk/Ohana/src/kapa2/src/InterpretKeys.c	(revision 38062)
+++ trunk/Ohana/src/kapa2/src/InterpretKeys.c	(revision 38153)
@@ -1,3 +1,4 @@
 # include "Ximage.h"
+# define FILTER_MODS 1
 
 int InterpretKeys (Graphic *graphic, XKeyEvent *event) {
@@ -32,19 +33,21 @@
     // skip the following keys: 
     if (name == NULL) goto skip_cursor;
-    if (!strcmp (name, "Shift_L")) goto skip_cursor;
-    if (!strcmp (name, "Shift_R")) goto skip_cursor;
-    if (!strcmp (name, "Control_L")) goto skip_cursor;
-    if (!strcmp (name, "Control_R")) goto skip_cursor;
-    if (!strcmp (name, "Alt_L")) goto skip_cursor;
-    if (!strcmp (name, "Alt_R")) goto skip_cursor;
-    if (!strcmp (name, "Super_L")) goto skip_cursor;
-    if (!strcmp (name, "Super_R")) goto skip_cursor;
-    if (!strcmp (name, "Caps_Lock")) goto skip_cursor;
-    if (!strcmp (name, "Pause")) goto skip_cursor;
-    if (!strcmp (name, "Continue")) goto skip_cursor;
-    if (!strcmp (name, "Num_Lock")) goto skip_cursor;
-    if (!strcmp (name, "Scroll_Lock")) goto skip_cursor;
-    if (!strcmp (name, "Print")) goto skip_cursor;
-    if (!strcmp (name, "(null)")) goto skip_cursor;
+    if (FILTER_MODS) {
+      if (!strcmp (name, "Shift_L")) goto skip_cursor;
+      if (!strcmp (name, "Shift_R")) goto skip_cursor;
+      if (!strcmp (name, "Control_L")) goto skip_cursor;
+      if (!strcmp (name, "Control_R")) goto skip_cursor;
+      if (!strcmp (name, "Alt_L")) goto skip_cursor;
+      if (!strcmp (name, "Alt_R")) goto skip_cursor;
+      if (!strcmp (name, "Super_L")) goto skip_cursor;
+      if (!strcmp (name, "Super_R")) goto skip_cursor;
+      if (!strcmp (name, "Caps_Lock")) goto skip_cursor;
+      if (!strcmp (name, "Pause")) goto skip_cursor;
+      if (!strcmp (name, "Continue")) goto skip_cursor;
+      if (!strcmp (name, "Num_Lock")) goto skip_cursor;
+      if (!strcmp (name, "Scroll_Lock")) goto skip_cursor;
+      if (!strcmp (name, "Print")) goto skip_cursor;
+      if (!strcmp (name, "(null)")) goto skip_cursor;
+    }
 
     Z = -1;
Index: trunk/Ohana/src/kapa2/src/PSObjects.c
===================================================================
--- trunk/Ohana/src/kapa2/src/PSObjects.c	(revision 38062)
+++ trunk/Ohana/src/kapa2/src/PSObjects.c	(revision 38153)
@@ -211,5 +211,5 @@
   
   /* connect first point to second point */
-  sxa = sx0 - 0.5*(sx1 - sx0);
+  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
   sya = MAX (sy0, Y0);
   DrawLine (sx0, sy0, sxa, sy0);
@@ -217,5 +217,5 @@
   
   /* draw segment equal distance behind first point and down to x-axis */
-  sxa = 0.5*(sx0 + sx1);
+  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
   DrawLine (sx0, sy0, sxa, sy0);
   DrawLine (sxa, sy0, sxa, sy1);
@@ -232,5 +232,5 @@
     sx1 = MIN (MAX (sx1, X0), X1);
     sy1 = MAX (MIN (sy1, Y0), Y1);
-    sxa = 0.5*(sx0 + sx1);
+    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
     DrawLine (sx0, sy0, sxa, sy0);
     DrawLine (sxa, sy0, sxa, sy1);
@@ -241,5 +241,5 @@
   
   /* draw segment equal distance after last point and down to x-axis */
-  sxa = sx1 + 0.5*(sx1 - sxo);
+  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
   sya = MAX (sy1, Y0);
   DrawLine (sx1, sy1, sxa, sy1);
Index: trunk/Ohana/src/kapa2/src/SetColormap.c
===================================================================
--- trunk/Ohana/src/kapa2/src/SetColormap.c	(revision 38062)
+++ trunk/Ohana/src/kapa2/src/SetColormap.c	(revision 38153)
@@ -166,4 +166,106 @@
     goto store_colors;
   }
+  /* anuenue */
+  if (!strcasecmp (name, "anuenue")) {
+    redRef   = 0.25*MaxValue*scale*4.0; // value at 0.0
+    greenRef = 0.50*MaxValue*scale*4.0;
+    blueRef  = 1.33*MaxValue*scale;
+    for (i = 0; i < (int)(0.50*MaxValue); i++) {  
+      SETVALUE (graphic[0].cmap[i].green, 0.0, 0, 0xffff); // red is a ramp from 0 to 0xffff
+      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
+    }
+    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) {  
+      SETVALUE (graphic[0].cmap[i].green, 4.0*i*scale - 0x20000, 0, 0xffff); // red is a ramp from 0 to 0xffff
+      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
+    }
+    for (i = (int)(0.75*MaxValue); i < MaxValue; i++) {  
+      SETVALUE (graphic[0].cmap[i].green, 0xffff, 0, 0xffff); // red is a ramp from 0 to 0xffff
+      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
+    }
+
+    for (i = 0; i < (int)(0.25*MaxValue); i++) {  
+      SETVALUE (graphic[0].cmap[i].red,  4*i*scale, 0, 0xffff);
+    }
+    for (i = (int)(0.25*MaxValue); i < (int)(0.50*MaxValue); i++) {  
+      SETVALUE (graphic[0].cmap[i].red,  0x20000 - 4*i*scale, 0, 0xffff);
+    }
+    for (i = (int)(0.50*MaxValue); i < MaxValue; i++) {  
+      SETVALUE (graphic[0].cmap[i].red,  2*i*scale - 0xffff, 0, 0xffff);
+    }
+
+    for (i = 0; i < (int)(0.50*MaxValue); i++) {  
+      SETVALUE (graphic[0].cmap[i].blue,  2*i*scale, 0, 0xffff);
+    }
+    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) {  
+      SETVALUE (graphic[0].cmap[i].blue,  0x30000 - 4*i*scale, 0, 0xffff);
+    }
+    for (i = (int)(0.75*MaxValue); i < MaxValue; i++) {  
+      SETVALUE (graphic[0].cmap[i].blue,  4*i*scale - 0x30000, 0, 0xffff);
+    }
+    goto store_colors;
+  }
+
+  /* anuenue */
+  if (!strncmp (name, "file:", 5)) {
+    FILE *f = fopen (&name[5], "r");
+    if (!f) {
+      fprintf (stderr, "failed to open colormap file %s\n", &name[5]);
+      return FALSE;
+    }
+    char line[1024];
+
+    int lastIndex = 0;
+    float lastRed = 0.0;
+    float lastBlue = 0.0;
+    float lastGreen = 0.0;
+
+    float fracIndex, fracRed, fracBlue, fracGreen;
+
+    while (scan_line_maxlen (f, line, 1024) != EOF) {
+      // file contains f R G B : f = 0.0 - 1.0, R,G,B = 0.0 - 1.0
+      int Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen);
+      if (Nscan != 4) continue;
+
+      int nextIndex = fracIndex * MaxValue;
+      if (nextIndex <= lastIndex) {
+	lastRed = fracRed;
+	lastBlue = fracBlue;
+	lastGreen = fracGreen;
+	continue;
+      }
+      float dRdI = (fracRed   - lastRed)   / (float) (nextIndex - lastIndex);
+      float dBdI = (fracBlue  - lastBlue)  / (float) (nextIndex - lastIndex);
+      float dGdI = (fracGreen - lastGreen) / (float) (nextIndex - lastIndex);
+      for (i = lastIndex; i < nextIndex; i++) {
+	float redValue   = 0xffff * (dRdI * (i - lastIndex) + lastRed);
+	float blueValue  = 0xffff * (dBdI * (i - lastIndex) + lastBlue);
+	float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen);
+	SETVALUE (graphic[0].cmap[i].red,   redValue,   0, 0xffff);
+	SETVALUE (graphic[0].cmap[i].blue,  blueValue,  0, 0xffff);
+	SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff);
+      }
+      lastRed = fracRed;
+      lastBlue = fracBlue;
+      lastGreen = fracGreen;
+      lastIndex = nextIndex;
+    }
+    fclose (f);
+
+    if ((int) (MaxValue*fracIndex) < MaxValue) {
+      float dRdI = (1.0 - lastRed)   / (float) (MaxValue - lastIndex);
+      float dBdI = (1.0 - lastBlue)  / (float) (MaxValue - lastIndex);
+      float dGdI = (1.0 - lastGreen) / (float) (MaxValue - lastIndex);
+      for (i = lastIndex; i < MaxValue; i++) {
+	float redValue   = 0xffff * (dRdI * (i - lastIndex) + lastRed);
+	float blueValue  = 0xffff * (dBdI * (i - lastIndex) + lastBlue);
+	float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen);
+	SETVALUE (graphic[0].cmap[i].red,   redValue,   0, 0xffff);
+	SETVALUE (graphic[0].cmap[i].blue,  blueValue,  0, 0xffff);
+	SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff);
+      }
+    }
+    goto store_colors;
+  }
+
   return (FALSE);
 
Index: trunk/Ohana/src/kapa2/src/bDrawObjects.c
===================================================================
--- trunk/Ohana/src/kapa2/src/bDrawObjects.c	(revision 38062)
+++ trunk/Ohana/src/kapa2/src/bDrawObjects.c	(revision 38153)
@@ -198,5 +198,5 @@
   
   /* connect first point to second point */
-  sxa = sx0 - 0.5*(sx1 - sx0);
+  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
   sya = MAX (sy0, Y0);
   DrawLine (buffer, sx0, sy0, sxa, sy0);
@@ -204,5 +204,5 @@
   
   /* draw segment equal distance behind first point and down to x-axis */
-  sxa = 0.5*(sx0 + sx1);
+  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
   DrawLine (buffer, sx0, sy0, sxa, sy0);
   DrawLine (buffer, sxa, sy0, sxa, sy1);
@@ -219,5 +219,5 @@
     sx1 = MIN (MAX (sx1, X0), X1);
     sy1 = MAX (MIN (sy1, Y0), Y1);
-    sxa = 0.5*(sx0 + sx1);
+    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
     DrawLine (buffer, sx0, sy0, sxa, sy0);
     DrawLine (buffer, sxa, sy0, sxa, sy1);
@@ -228,5 +228,5 @@
   
   /* draw segment equal distance after last point and down to x-axis */
-  sxa = sx1 + 0.5*(sx1 - sxo);
+  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
   sya = MAX (sy1, Y0);
   DrawLine (buffer, sx1, sy1, sxa, sy1);
