copyArtifactGrid static method

void copyArtifactGrid(
  1. Artifact source,
  2. Artifact target,
  3. int offsetX,
  4. int offsetY,
)

Copies the contents of a source Artifact into a target Artifact, with an optional offset.

Implementation

static void copyArtifactGrid(
  final Artifact source,
  final Artifact target,
  final int offsetX,
  final int offsetY,
) {
  for (int y = 0; y < source.rows; y++) {
    for (int x = 0; x < source.cols; x++) {
      if (y + offsetY < target.rows && x + offsetX < target.cols) {
        if (source.cellGet(x, y)) {
          target.cellSet(x + offsetX, y + offsetY, true);
        }
      }
    }
  }
}