Index: trunk/psModules/src/camera/pmFPAMosaic.c
===================================================================
--- trunk/psModules/src/camera/pmFPAMosaic.c	(revision 13499)
+++ trunk/psModules/src/camera/pmFPAMosaic.c	(revision 13898)
@@ -22,4 +22,9 @@
 
 #define CELL_LIST_BUFFER 10             // Buffer size for cell lists
+
+#define BLANK_VALUE 0.0                 // Value for pixels that are blank in the mosaicked image (e.g., //
+                                        // between cells).
+                                        // XXX This should ultimately be set to NAN, but psphot doesn't like
+                                        // that (masking needs to be more thorough).
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -397,5 +402,5 @@
                     for (int x = 0; x < image->numCols; x++) { \
                         int xTarget = xTargetBase + xParity * x; \
-                        mosaic->data.TYPE[yTarget][xTarget] += image->data.TYPE[y][x]; \
+                        mosaic->data.TYPE[yTarget][xTarget] = image->data.TYPE[y][x]; \
                     } \
                 } \
@@ -416,5 +421,5 @@
                         for (int k = 0; k < xBinSource->data.S32[i]; k++) { \
                             int xTarget = (int)(xTargetBinBase + xParity * (float)k / (float)xBinTarget); \
-                            mosaic->data.TYPE[yTarget][xTarget] += image->data.TYPE[y][x]; \
+                            mosaic->data.TYPE[yTarget][xTarget] = image->data.TYPE[y][x]; \
                         } \
                     } \
@@ -504,5 +509,5 @@
     psTrace("psModules.camera", 3, "Spliced image will be %dx%d\n", (int)xSize, (int)ySize);
     psImage *mosaic = psImageAlloc((int)xSize, (int)ySize, type); // The mosaic image
-    psImageInit(mosaic, 0);
+    psImageInit(mosaic, unexposed);
 
     // Next pass through the images to do the mosaicking
@@ -524,5 +529,5 @@
             (yFlip->data.U8[i] == 0)) {
             // Let someone else do the hard work
-            psImageOverlaySection(mosaic, image, xTargetBase, yTargetBase, "+");
+            psImageOverlaySection(mosaic, image, xTargetBase, yTargetBase, "=");
             continue;
         }
@@ -723,5 +728,6 @@
                        int *xBinChip, int *yBinChip, // The binning in x and y, to be returned
                        const pmChip *chip, // Chip to mosaic
-                       const pmCell *targetCell // Cell to which to mosaic
+                       const pmCell *targetCell, // Cell to which to mosaic
+                       psMaskType blank // Mask value to give blank pixels
                       )
 {
@@ -804,7 +810,7 @@
     // Mosaic the images together and we're done
     if (allGood) {
-        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, NAN);
-        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, NAN);
-        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, 0xff);
+        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);
+        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, BLANK_VALUE);
+        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinChip, *yBinChip, x0, y0, blank);
     }
 
@@ -830,5 +836,6 @@
                       const pmFPA *fpa,  // FPA to mosaic
                       const pmChip *targetChip, // Chip to which to mosaic
-                      const pmCell *targetCell // Cell to which to mosaic
+                      const pmCell *targetCell, // Cell to which to mosaic
+                      psMaskType blank  // Mask value to give blank pixels
                      )
 {
@@ -937,7 +944,7 @@
     // Mosaic the images together and we're done
     if (allGood) {
-        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, NAN);
-        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, NAN);
-        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, 0xff);
+        *mosaicImage = imageMosaic(images, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);
+        *mosaicWeights = imageMosaic(weights, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, BLANK_VALUE);
+        *mosaicMask = imageMosaic(masks, xFlip, yFlip, xBin, yBin, *xBinFPA, *yBinFPA, x0, y0, blank);
     }
 
@@ -986,5 +993,5 @@
 // the mosaic image.
 
-bool pmChipMosaic(pmChip *target, const pmChip *source, bool deepCopy)
+bool pmChipMosaic(pmChip *target, const pmChip *source, bool deepCopy, psMaskType blank)
 {
     // Target exists, and has only a single cell
@@ -1039,5 +1046,5 @@
         // Case 2 --- we need to mosaic by cut and paste
         psTrace("psModules.camera", 1, "Case 2 mosaicking: cut and paste.\n");
-        if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source, targetCell)) {
+        if (!chipMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source, targetCell, blank)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to mosaic cells.\n");
             return false;
@@ -1217,5 +1224,5 @@
 
 
-bool pmFPAMosaic(pmFPA *target, const pmFPA *source, bool deepCopy)
+bool pmFPAMosaic(pmFPA *target, const pmFPA *source, bool deepCopy, psMaskType blank)
 {
     // Target exists, and has only a single chip with single cell
@@ -1260,5 +1267,5 @@
         psTrace("psModules.camera", 1, "Case 2 mosaicking: cut and paste.\n");
         if (!fpaMosaic(&mosaicImage, &mosaicMask, &mosaicWeights, &xBin, &yBin, source,
-                       targetChip, targetCell)) {
+                       targetChip, targetCell, blank)) {
             psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chips.\n");
             return false;
