Function windows

ImageWindowRange factory function

ImageWindowRange windows (
  SuperImage img,
  uint width,
  uint height
);

Examples

// Convolution with emboss kernel

float[3][3] kernel = [
    [-1, -1,  0],
    [-1,  0,  1],
    [ 0,  1,  1],
];

foreach(window, x, y; inputImage.windows(3, 3))
{
    Color4f sum = Color4f(0, 0, 0);
    foreach(ref Color4f pixel, x, y; window)
        sum += pixel * kernel[y][x];
    outputImage[x, y] = sum / 4.0f + 0.5f;
}