private void PopulateFromPixelOrder(PixelOrders pixelOrder)
{
int pos = 0;
var populate = new Action<int, int, int>((x, y, p) =>
{
this.lookupX[p] = x;
this.lookupY[p] = y;
this.lookupXY[x, y] = p;
});
if (pixelOrder == PixelOrders.HorizontalLineTopLeft)
{
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
{
populate(x, y, pos);
pos++;
}
}
else
if (pixelOrder == PixelOrders.HorizontalSnakeTopLeft)
{
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
populate(x, y, pos);
pos++;
}
if (++y < height)
{
for (int x = width - 1; x >= 0; x--)
{
populate(x, y, pos);
pos++;
}
}
}
}
else
throw new NotImplementedException();
}