i am trying to overlay two bitmaps
I have 2 ARGB (Format32bppArgb) bitmaps. Bitmap "A" has some regions of pixels with an apha channel value of 0 (transparent) and others with a value ranging from ~200 - 255. Bitmap "B" pixels all have alpha channels of value 255. I am drawing each of them to a Graphic like so...
Bitmap OverlayBitmaps(Bitmap underlying, Bitmap overlaying)
{
Bitmap finalImage = new Bitmap(underlying.Width, underlying.Height,System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (Graphics graphics = Graphics.FromImage(finalImage))//get the underlying graphics object from the image.
{
graphics.DrawImage(underlying, new Rectangle(0,0, underlying.Width, underlying.Height));
graphics.DrawImage(overlaying, new Rectangle(0, 0, overlaying.Width, overlaying.Height));
finalImage.Save("C:\\test.bmp");
return finalImage;
}
}
Both "A" and "B" are the same format same height same width but when i save the image, it looks as though only "B" was drawn.
Is this because "B" alpha channel value dominates?
i thought that by drawing "B" first, then "A", "A"s pixels with alpha channels value ~200-250 would be on top of "B"
I must be missing something...Any suggestions?