locked
D2D1_BITMAP_OPTIONS_CANNOT_DRAW confusing

    Question

  • Why use D2D1_BITMAP_OPTIONS_CANNOT_DRAW when create render target bitmap?  Is it faster?

    And the docuemnt is confusing: http://msdn.microsoft.com/en-us/library/windows/desktop/hh446984(v=vs.85).aspx

    D2D1_BITMAP_OPTIONS_CANNOT_DRAW must be specified in conjunction with D2D1_BITMAP_OPTIONS_TARGET or D2D1_BITMAP_OPTIONS_CPU_READ. The bitmap can be used a target but, it cannot be drawn from. Attempting to draw with a bitmap that has this flag set will result in the device context being put into an error state with D2DERR_BITMAP_CANNOT_DRAW. 
    
    D2D1_BITMAP_OPTIONS_CANNOT_DRAW must be specified in conjunction with D2D1_BITMAP_OPTIONS_TARGET. If specified, the bitmap can be used as a target but it cannot be drawn from. Attempting to draw with a bitmap that has this flag set will result in the device context returning the error D2DERR_BITMAP_CANNOT_DRAW.
    I think the second line should be deleted.

    • Edited by Raptor K Wednesday, July 11, 2012 12:54 PM
    Wednesday, July 11, 2012 12:52 PM

All replies

  • Hi, I don't know if it's an optimization flag but when you create a bitmap from a DXGI surface the bitmap options must be compatible with the DXGI surface.. For example, when you create a bitmap from the swap chain back buffer it must be marked as D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW.
    Wednesday, July 11, 2012 2:15 PM
  • If for compatible reason, why can not be AUTO set , like setting PixelFormat to DXGI_FORMAT_UNKNOWN

    C++ DX11

    Wednesday, July 11, 2012 5:10 PM