Vote count:
0
This code taken from HERE
using (Graphics gxSrc = Graphics.FromImage(constantAlphaImage)) { gxSrc.Clear(Color.Transparent);******//it do not work, it no is Transparent, is white******
if (checkBox1.Checked)
{
//On a Image Object I can draw a FillRectangle.
gxSrc.FillRectangle(new SolidBrush(Color.Green), (Corrimiento 15), (Corrimiento 15), 50,50);
}
IntPtr hdcDst = gxBuffer.GetHdc();
IntPtr hdcSrc = gxSrc.GetHdc();
BlendFunction blendFunction = new BlendFunction();
blendFunction.BlendOp = (byte)BlendOperation.AC_SRC_OVER;
blendFunction.BlendFlags = (byte)BlendFlags.Zero;
blendFunction.SourceConstantAlpha = (byte)vScrollBar1.Value;// Constant alpha factor
blendFunction.AlphaFormat = (byte)0; // Don't look for per pixel alpha
PlatformAPIs.AlphaBlend(hdcDst, 36, 36, 100, 100, hdcSrc, 0, 0, 128, 128, blendFunction);
POINT [] ArrayPoiter = new POINT[3];
gxBuffer.ReleaseHdc(hdcDst);
gxSrc.ReleaseHdc(hdcSrc);
}
Here is the file modificated from the website
Our problem is that by Alphablend we can draw square with alphablend the background of this drawing is not transparent. Or by ImagingImage we can load png with transparent background but we cant draw anything. Take a look to the example in the link above.
asked 33 secs ago
drawing with alpha blending on compactramework C#
Aucun commentaire:
Enregistrer un commentaire