Large images with Direct2D

前端 未结 1 1574
独厮守ぢ
独厮守ぢ 2021-01-06 08:51

Currently I am developing application for the Windows Store which does real time-image processing using Direct2D. It must support various sizes of images. The first problem

相关标签:
1条回答
  • 2021-01-06 09:30

    You are correct that images larger than the texture limit must be handled in software.

    However, the question to ask is whether or not you need that entire image every time you render.

    You can use the hardware accel to render a portion of the large image that is loaded in a software target.

    For example,

    • Use ID2D1RenderTarget::CreateSharedBitmap to make a bitmap that can be used by different resources.
    • Then create a ID2D1BitmapRenderTarget and render the large bitmap into that. (making sure to do BeginDraw, Clear, DrawBitmap, EndDraw). Both the bitmap and the render target can be cached for use by successive calls.
    • Then copy from that render target into a regular ID2D1Bitmap with the portion that will fit into the texture memory using the ID2D1Bitmap::CopyFromRenderTarget method.
    • Finally draw that to the real render target, pRT->DrawBitmap
    0 讨论(0)
提交回复
热议问题