Index: /trunk/Ohana/src/kapa2/src/Remap16.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Remap16.c	(revision 16390)
+++ /trunk/Ohana/src/kapa2/src/Remap16.c	(revision 16391)
@@ -1,3 +1,8 @@
 # include "Ximage.h"
+
+# define MY_SWAP_BYTE(W) { \
+  char tmp, *X; \
+  X = (char *) &W; \
+  tmp = X[0]; X[0] = X[1]; X[1] = tmp; }
 
 void Remap16 (Graphic *graphic, KapaImageWidget *image, Picture *picture, Matrix *matrix) {
@@ -13,12 +18,25 @@
   unsigned short *pixel, pixvalue;
   unsigned short back;
+  int swap_client, swap_server, swap_bytes;
 
   ALLOCATE (pixel, unsigned short, graphic[0].Npixels);
+
+# ifdef BYTE_SWAP
+  swap_client = 1;
+# else 
+  swap_client = 0;
+# endif  
+
+  swap_server = ImageByteOrder (graphic[0].display);
+  swap_bytes = !(swap_client ^ swap_server);
 
   // local array for pixel values (is this working??)
   for (i = 0; i < graphic[0].Npixels; i++) { /* set up pixel array */
     pixel[i] = 0xffff &  graphic[0].cmap[i].pixel;
+    if (swap_bytes) MY_SWAP_BYTE (pixel[i]);
   }
   back = 0xffff & graphic[0].back;
+  if (swap_bytes) MY_SWAP_BYTE (back);
+  // XXX not certain this is the correct solution...
 
   // set up expansions
Index: /trunk/Ohana/src/kapa2/src/Remap32.c
===================================================================
--- /trunk/Ohana/src/kapa2/src/Remap32.c	(revision 16390)
+++ /trunk/Ohana/src/kapa2/src/Remap32.c	(revision 16391)
@@ -1,3 +1,5 @@
 # include "Ximage.h"
+
+# define MY_SWAP_INT(A,B) { int tmp; tmp = A; A = B; B = tmp; }
 
 # define MY_SWAP_WORD(W) { \
@@ -66,6 +68,6 @@
   Picture_Upper (&i_end, &j_end, matrix, picture);
 
-  if (i_end < i_start) ISWAP (i_start, i_end);
-  if (j_end < j_start) ISWAP (j_start, j_end);
+  if (i_end < i_start) MY_SWAP_INT (i_start, i_end);
+  if (j_end < j_start) MY_SWAP_INT (j_start, j_end);
 
   // Ix,Iy are the first displayed image pixel
