public static void SelectChunks(Bitmap b, Color selectionColor)
{
using (Graphics g = Graphics.FromImage(b))
{
g.SetClip(CLIP);
Brush brush = new SolidBrush(selectionColor);
for (int chunkX = 0; chunkX < 32; chunkX++)
{
for (int chunkZ = 0; chunkZ < 32; chunkZ++)
{
bool shouldSelect = false;
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
{
if (b.GetPixel(OFFSETX + chunkX * 16 + x, OFFSETY + chunkZ * 16 + z).ToArgb() == selectionColor.ToArgb())
{
shouldSelect = true;
break;
}
}
if (shouldSelect)
break;
}
if (shouldSelect)
g.FillRectangle(brush, OFFSETX + chunkX * 16, OFFSETY + chunkZ * 16, 16, 16);
}
}
}
}