private void CropSelectedSprites(bool symettric)
{
List<Sprite> sprites = new List<Sprite>();
int width = 0, height = 0;
foreach (ListViewItem listItem in spriteList.Items)
{
if (listItem.Selected)
{
Sprite sprite = FindSpriteByNumber(Convert.ToInt32(listItem.Name));
if (sprites.Count > 0)
{
if ((sprite.Width != width) || (sprite.Height != height))
{
Factory.GUIController.ShowMessage("All sprites to be cropped must have the same dimensions. If you want to crop unrelated sprites, do them separately.", MessageBoxIcon.Warning);
return;
}
}
else
{
width = sprite.Width;
height = sprite.Height;
}
sprites.Add(sprite);
}
}
if ((sprites.Count > 0) && (Factory.NativeProxy.CropSpriteEdges(sprites, symettric)))
{
Factory.GUIController.ShowMessage("The selected sprites were cropped down to " + sprites[0].Width + " x " + sprites[0].Height + " successfully.", MessageBoxIcon.Information);
RefreshSpriteDisplay();
}
else
{
Factory.GUIController.ShowMessage("The selected sprites could not be cropped any further.", MessageBoxIcon.Information);
}
}