Found the issue in case anyone else runs into the problem. I was using the wrong PixelFormat
when creating the bitmat from the pBuffer
. Instead of PixelFormat.Format32bppArgb
use PixelFormat.Format24bppRgb
.
Here's my working BufferCB for the DxLogo sample:
int ISampleGrabberCB.BufferCB( double SampleTime, IntPtr pBuffer, int BufferLen )
{
// Avoid the possibility that someone is calling SetLogo() at this instant
lock (this)
{
if (m_Bitmap != null)
{
Bitmap v;
v = new Bitmap(m_videoWidth, m_videoHeight, m_stride, PixelFormat.Format24bppRgb, pBuffer);
Graphics g = Graphics.FromImage(v);
g.DrawImage(m_Bitmap, 100, 100, m_Bitmap.Width, m_Bitmap.Height);
}
}
This solves the issue where the images colors would distort if repositioned and transparent backgrounds now work.