locked
Problem with saving ID2D1Bitmap1 to a file

    Question

  • The result is: all zeros.

    I do (apparently) the same as the "Direct2D save to image file sample" (I failed to find the difference). The sample works. My program doesn't.

    The only difference that may be meaningful is that my program is multithreaded (parallel tasks) and the operation is initiated (OpenFileAsync) from a background task.

    Anyway, there are no error messages in debug output, no exceptions. The output file is created normally, but filled with zeros instead of real data.

    What should I look at?

    Thank you.

    Tuesday, January 22, 2013 12:56 PM

All replies

  • Hello,

    Would you please provide us the whole codes to reproduce this issue,

    You can upload your project to SkyDrive
    http://skydrive.live.com/

    It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

    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 23, 2013 7:54 AM
  • Thank you for response. Sorry for delay. I have been busy.

    Now I have made the test project -Windows Store app from blank template with button.

    When that button is pressed, the file is created with fixed name "testfile.bmp" in folder

    Windows::Storage::ApplicationData::Current->LocalFolder.

    The file is created successfully but is empty bitmap as far as I can see. Here is the link to the skydrive: http://sdrv.ms/Vt8niZ.

    Friday, February 01, 2013 7:02 PM
  • Hi Яков

    The problem is with your DirectX.

    Your DirectX code doesnt actually draw in to the canvas.

    Please use a SwapChainPanel to draw your changes and then try the Save action.

    _Sujith

    • Proposed as answer by _Sujith Tuesday, February 26, 2013 9:51 AM
    • Unproposed as answer by Яков Tuesday, February 26, 2013 1:02 PM
    Tuesday, February 26, 2013 9:51 AM
  • Could you please provide more details? Without them I can't agree that your post ansers my question.

    What exactly is wrong with my code?

    Why does DirectX return success at all stages?

    How exactly should I use the SwapChainPanel?

    Tuesday, February 26, 2013 1:05 PM