I have already implemented the Direct2D application for Windows applications for Windows using C ++, where I show graphical results (with dots, lines and ellipses) during the simulation. I keep a buffer for storing simulation values as long as the simulation remains on, and every time interval I just draw values. Right now, the situation, I am drawing directly on Hwnd ( ID2D1HwndRenderTarget ), for example
pRenderTarget->BeginDraw() for(values of simulation results) pRenderTarget->DrawLine(....) pRenderTarget->EndDraw()
Now I want to use visualization / drawing on the screen using a bitmap, since I need to save the bitmap as an image on a computer (which is equivalent to capturing / capturing a screenshot to store the simulation results). How should I work in this case (with / without Direct2D IWICBitmapFactory - for subsequent screen capture)?
create ID2D1HwndRenderTarget pHwndRenderTarget - using pD2DFactory->CreateHwndRenderTarget()
create ID2D1BitmapFactory pBitmapFactory - using pHwndRenderTarget->CreateCompatibleRenderTarget()
Create an empty ID2D1Bitmap ID2D1Bitmap pBmp raster map - using pBitmapFactory->CreateBitmap()
?? On this raster should I draw lines? if not, where should I draw lines
In the end, between BeginDraw() and EndDraw() , should I put a bitmap?
Later, at some point, I would take a screenshot from this bitmap. Without IWICBitmapFactory can I achieve this? Any code samples would be appreciated.
source share