locked
Does Media Foundation support PNG transparency RRS feed

  • Question

  • Hello,

    I've posted a couple of threads concerning PNGs and Images over video and I have figured those problems however I'm running into another problem.

    I'm trying to display a full screen image over a video that contains the images that I want over top of the video while it's playing. I have done this by starting with a byte buffer that is the size of the window. I then zero out all of the bytes and then memcpy the bytes of the images into this buffer in the position where I want them. When I got this working I found that everything that isn't the images I added is black (which is understandable).

    I then tried to get a PNG is one large transparent image that I loaded into the buffer and then put the images over this hoping to have the video showing beneath the images. However, this just causes everything that isn't image to be white. This makes me ask the question if MF supports transparency with PNGs. Am I missing something?

    I'm using the SetAlphaBitmap function from the IMFVideoMixerBitmap Interface, and to get the HBITMAP from the PNG I am using WIC. There is a sample provided from within the WIC documentation that uses an HBITMAP at one point and I'm just using that to input into the SetAlphaBitmap.

    Thanks for any help you can provide.

    Monday, June 13, 2011 8:44 PM

Answers

  • hi there,

     

    well i guess SetAlphaBitmap is not capable of directly dealing with PNG´s alpha channels. as far as i know you can only specify a single alpha color (MFVideoAlphaBitmapParams.clrSrcKey) to be transparent when using bitmaps as overlays.

    • Marked as answer by apipher Tuesday, June 14, 2011 1:58 PM
    Tuesday, June 14, 2011 7:04 AM

All replies

  • hi there,

     

    well i guess SetAlphaBitmap is not capable of directly dealing with PNG´s alpha channels. as far as i know you can only specify a single alpha color (MFVideoAlphaBitmapParams.clrSrcKey) to be transparent when using bitmaps as overlays.

    • Marked as answer by apipher Tuesday, June 14, 2011 1:58 PM
    Tuesday, June 14, 2011 7:04 AM
  • Thanks! That did it. Wasn't setting that parameter.
    Tuesday, June 14, 2011 1:59 PM