docs: function (image, old) {
          var data1 = old.data,
              data2 = image.data,
              w1 = old.width,
              w2 = image.width,
              px1 = old.globalOffset.x,
              py1 = old.globalOffset.y,
              px2 = image.globalOffset.x,
              py2 = image.globalOffset.y,
              b1 = old.bounds,
              b2 = image.bounds,
              px = Math.min(b1.minX + px1, b2.minX + px2), // global offset for new image (by min in bounds)
              py = Math.min(b1.minY + py1, b2.minY + py2),
              b = { // bounds for new image include all of the pixels [0,0,width,height] (reduce to bounds)
                  minX: 0,
                  minY: 0,
                  maxX: Math.max(b1.maxX + px1, b2.maxX + px2) - px,
                  maxY: Math.max(b1.maxY + py1, b2.maxY + py2) - py,
              },
              w = b.maxX + 1, // size for new image
              h = b.maxY + 1,
              i, j, k, k1, k2, len;
  
          var result = new Uint8Array(w * h);
  
          // copy all old image
          len = b1.maxX - b1.minX + 1;
          i = (py1 - py + b1.minY) * w + (px1 - px + b1.minX);
          k1 = b1.minY * w1 + b1.minX;
          k2 = b1.maxY * w1 + b1.minX + 1;
          // walk through rows (Y)
          for (k = k1; k < k2; k += w1) {
              result.set(data1.subarray(k, k + len), i); // copy row
              i += w;
          }
  
          // copy new image (only "black" pixels)
          len = b2.maxX - b2.minX + 1;
          i = (py2 - py + b2.minY) * w + (px2 - px + b2.minX);
          k1 = b2.minY * w2 + b2.minX;
          k2 = b2.maxY * w2 + b2.minX + 1;
          // walk through rows (Y)
          for (k = k1; k < k2; k += w2) {
              // walk through cols (X)
              for (j = 0; j < len; j++) {
                  if (data2[k + j] === 1) result[i + j] = 1;
              }
              i += w;
          }
  
          return {
              data: result,
              width: w,
              height: h,
              bounds: b,
              globalOffset: {
                  x: px,
                  y: py,
              }
          };
      }