请教Graphics 半透明叠加方式
public void drawimage(Graphics ge,Bitmap b,float alpha)
{
float[][] ptsArray ={ new float[] {1, 0, 0, 0, 0}, new float[] {0, 1, 0, 0, 0}, new float[] {0, 0, 1, 0, 0}, new float[] {0, 0, 0, alpha, 0}, //注意:此处为0.5f,图像为半透明
new float[] {0, 0, 0, 0, 1}};
ColorMatrix clrMatrix = new ColorMatrix(ptsArray);
ImageAttributes imgAttributes = new ImageAttributes(); //设置图像的颜色属性
imgAttributes.SetColorMatrix(clrMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); //画图像
ge.DrawImage(b, new Rectangle(0, 0, b.Width, b.Height), 0, 0, b.Width, b.Height, GraphicsUnit.Pixel, imgAttributes);
}
网上找了个半透明显示图片的实例
但在Opengl中是可以选则叠加的方式的,就像PS里的层
具体说来 默认的叠加方式是线性叠加的,808080叠加 67% eeeeee 等于 ffffff
而我想实现减淡图片的叠加效果,如 ffffff 叠加一个70% ffffff 变成 B2b2b2 ,ffEE00叠加 60% 00ff00变成 ff8e00
gdi c# --------------------编程问答-------------------- 请问该如何实现?
OpenGl里可以这么设置
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
补充:.NET技术 , C#