setPixelsRectFrom method

void setPixelsRectFrom(
  1. PCanvasPixels src,
  2. int srcX,
  3. int srcY,
  4. int dstX,
  5. int dstY,
  6. int width,
  7. int height,
)

Implementation

void setPixelsRectFrom(PCanvasPixels src, int srcX, int srcY, int dstX,
    int dstY, int width, int height) {
  _checkSameFormat(src);

  final srcPixels = src.pixels;

  for (var y = 0; y < height; ++y) {
    var srcIndex = src.pixelIndex(srcX, srcY + y);
    var dstIndex = pixelIndex(dstX, dstY + y);

    for (var x = 0; x < width; ++x) {
      pixels[dstIndex + x] = srcPixels[srcIndex + x];
    }
  }
}