有我的代码,但绘图很慢:
int BlockWidth = 16
SourceBlueMap = new Bitmap(BlocksRect.Width, BlocksRect.Height);
Graphics Gpi = Graphics.FromImage(SourceBlueMap);
AlphaBlock block;
string strPath = @"C:\Users\Administrator\Desktop\Blocks";
BlockInfo blockinfo;
for (int x = 0; x < iXDim; x++)
{
for (int y = 0; y < iYDim; y++)
{
for (int z = 0; z < iZDim; z++)
{
block = Blocks.GetBlock(x, y, z);
rect.X = x * BlockWidth;
rect.Y = z * BlockWidth;
if (BlockInfoList.Exists(info =>
info.ID == block.ID && info.Data == block.Data))
{
blockinfo = BlockInfoList.Find(info =>
info.ID == block.ID && info.Data == block.Data);
if (File.Exists(strPath + "\\" + blockinfo.Name + ".png"))
{
using (Bitmap bmp = new Bitmap(strPath + "\\" + blockinfo.Name + ".png"))
{
Gpi.DrawImage(bmp, rect);
}
}
}
}
}
}
Gpi.Dispose();
但其他程序使用平局超过1秒: http://www.diamondpants.com/spritecraft/PayPalDonate.aspx