locked
Use WIC to create image used in MFCopyImage

    Question

  • I want to use WIC to create an image through code, and then use this image for the Media Foundation funtion MFCopyImage to create an IMFMediaBuffer. There are some missing pieces of how to link this to each other.

    I found some sample code in order to create a IRandomAccessStream object containing the image from WIC by means of the IWICBitmapEncoder. On the other hande the MFCopyImage function needs an 'const BYTE *' type as a pointer to the image.

    How can I convert a IRandomAccessStream object to a 'const BYTE *' pointer? Or is there another route between a WIC and MFCopyImage.

    Thanks in advance!

    Ronald

    Monday, January 14, 2013 4:40 PM

Answers

  • Found it.

    IWICBitmapSource->CopyPixels was the missing piece.

    Ronald

    Tuesday, January 15, 2013 12:54 PM
  • Even better without copying pixels:

    IWICBitmap->Lock gives you lock

    IWICBitmapLock->GetDataPointer gives you pointer to the pixels which can be used in MFCopyImage

    Ronald


    Tuesday, January 15, 2013 7:41 PM

All replies

  • Found it.

    IWICBitmapSource->CopyPixels was the missing piece.

    Ronald

    Tuesday, January 15, 2013 12:54 PM
  • Even better without copying pixels:

    IWICBitmap->Lock gives you lock

    IWICBitmapLock->GetDataPointer gives you pointer to the pixels which can be used in MFCopyImage

    Ronald


    Tuesday, January 15, 2013 7:41 PM
  • Thanks for sharing the solution.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 16, 2013 2:18 AM