/用到的命名空间
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
/两张图片叠加,float fImage(0—1)透明度///
private void getMixImage(float fImage, string strFrontImage, string strBackImage)
{
this.m_image.Dispose();
Bitmap background = new Bitmap(strBackImage);
Bitmap frontImage = new Bitmap(strFrontImage);
int iwidth = background.Width > frontImage.Width ? background.Width : frontImage.Width;
int iheight = background.Height > frontImage.Height ? background.Height : frontImage.Height;
Bitmap mixImage2 = new Bitmap(iwidth, iheight);
//this.mixImage.Width = iwidth;
//this.mixImage.Height = iheight;
Graphics g = Graphics.FromImage(mixImage2);
float[][] colormatrix ={
new float[]{1,0,0,0,0},//代表了R
new float[]{0,1,0,0,0},//代表了G
new float[]{0,0,1,0,0},//代表了B
new float[]{0,0,0,fImage,0},//代表了A
new float[]{0,0,0,0,1}
};
ColorMatrix cm = new ColorMatrix(colormatrix);
ImageAttributes imageAtt = new ImageAttributes();
imageAtt.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
g.DrawImage(background, new Point(0, 0));
g.DrawImage(frontImage, new Rectangle(0, 0, frontImage.