function injectMatrix(batch, state) {
  const buffer = this.data;
  const isEraser = batch.isEraser;
  const data = state ? batch.data : batch.reverse;
  const bw = batch.bounds.w | 0;
  const bx = (this.bounds.x) | 0;
  const by = (this.bounds.y) | 0;
  const dx = (batch.bounds.x - bx) | 0;
  const dy = (batch.bounds.y - by) | 0;
  const w = this.bounds.w | 0; const h = this.bounds.h | 0;
  const x = bx | 0; const y = by | 0;
  // loop given batch data and merge it with our main matrix
  for (let ii = 0; ii < data.length; ii += 4) {
    const idx = (ii / 4) | 0;
    const xx = (idx % bw) | 0;
    const yy = (idx / bw) | 0;
    const opx = ((yy * bw + xx) * 4) | 0;
    const npx = (opx + (yy * (w - bw) * 4) + (dx * 4) + ((dy * 4) * w)) | 0;
    const alpha = data[opx + 3] | 0;
    // erase pixel
    if (isEraser === true) {
      if (state === true && alpha > 0) {
        buffer[npx + 0] = buffer[npx + 1] = buffer[npx + 2] = buffer[npx + 3] = 0;
        continue;
      }
    }
    // ignore empty data pixels
    if (alpha <= 0 && state === true) continue;
    // only overwrite the reverse batch's used pixels
    if (state === false && alpha <= 0 && batch.data[opx + 3] <= 0) continue;
    // manual color blending
    if (buffer[npx + 3] > 0 && alpha < 255 && alpha > 0) {
      const src = buffer.subarray(npx, npx + 4);
      const dst = data.subarray(opx, opx + 4);
      // manual color blending
      if (state) {
        const src = buffer.subarray(npx, npx + 4);
        const dst = data.subarray(opx, opx + 4);
        const color = additiveAlphaColorBlending(src, dst);
        buffer[npx + 0] = color[0];
        buffer[npx + 1] = color[1];
        buffer[npx + 2] = color[2];
        buffer[npx + 3] = color[3];
        continue;
      // simply fill with reverse data
      } else {
        buffer[npx + 0] = data[opx + 0];
        buffer[npx + 1] = data[opx + 1];
        buffer[npx + 2] = data[opx + 2];
        buffer[npx + 3] = data[opx + 3];
        continue;
      }
    }
    // just fill colors with given batch data kind
    buffer[npx + 0] = data[opx + 0];
    buffer[npx + 1] = data[opx + 1];
    buffer[npx + 2] = data[opx + 2];
    buffer[npx + 3] = data[opx + 3];
  };
}
Merges given matrix
@param {Batch} batch
@param {Number} px - X-offset to merge at
@param {Number} py - Y-offset to merge at
@param {Boolean} state - Add or reverse