日期:2014-05-17 浏览次数:20818 次
/// <summary>
/// 位图叠加
/// </summary>
/// <param name="bitmapDown">底层位图</param>
/// <param name="bitmapUp">要叠加的位图</param>
/// <returns>合成的新位图</returns>
public Bitmap AddBitmap(Bitmap bitmapDown, Bitmap[] bitmapUp)
{
Graphics g = Graphics.FromImage(bitmapDown);
for (int i = 0; i < bitmapUp.Length; i++)
{
bitmapUp[i].MakeTransparent();
g.DrawImage(
bitmapUp[i],
new Rectangle(0, 0, bitmapDown.Size.Width, bitmapDown.Size.Height),
0,
0,
bitmapUp[i].Size.Width,//bitmapDown
bitmapUp[i].Size.Height,//bitmapDown
GraphicsUnit.Pixel,
null);
}
return bitmapDown;
}