direct2d

Large images with Direct2D

别说谁变了你拦得住时间么 提交于 2019-12-19 03:59:30
问题 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 I have faced is how to handle the situations when the image is larger than the maximum supported texture size. After some research and documentation reading I found the VirtualSurfaceImageSource as a solution. The idea was to load the image as IWICBitmap then to create render target with CreateWICBitmapRenderTarget (which

How to work with pixels using Direct2D

风流意气都作罢 提交于 2019-12-18 11:36:31
问题 Could somebody provide an example of an efficient way to work with pixels using Direct2D? For example, how can I swap all green pixels ( RGB = 0x00FF00 ) with red pixels ( RGB = 0xFF0000 ) on a render target? What is the standard approach? Is it possible to use ID2D1HwndRenderTarget for that? Here I assume using some kind of hardware acceleration. Should I create a different object for direct pixels manipulations? Using DirectDraw I would use BltFast method on the IDirectDrawSurface7 with

Can't create Direct2D DXGI Surface

夙愿已清 提交于 2019-12-18 09:23:53
问题 I'm calling this method: http://msdn.microsoft.com/en-us/library/dd371264(VS.85).aspx The call fails with E_NOINTERFACE . The documentation is especially unhelpful as to why this may happen. I've enabled all of the DirectX 11 debug stuff and that's the best I got. I know that I have a valid IDXGISurface1* (also tried IDXGISurface ) and the other parameters are set correctly. Any ideas as to why this call may fail? Edit: I also am having problems creating D3D11 devices. If I pass nullptr as

How initialize Direct2D renderer into GDI context from managed code for older version of .NET Framework

有些话、适合烂在心里 提交于 2019-12-13 20:19:31
问题 Given a legacy desktop application in Windows Form , managed code (a mix of C# and VB projects) running on .NET Framework 3.5 (which can't be migrated to newer .NET for reasons beyond the scope of this question), how GRADUALLY transition the code from GDI+ to Direct2D ? Or possibly to Direct3D? Another constraint is that the resulting application work on Windows 7 , but we will migrate to Windows 8 or Windows 10 if that is the only way to get this to work. (The impetus is bugs in GDI+

DirectWrite RegisterFontFileLoader :create a font file loader and register it in Delphi without access violation

為{幸葍}努か 提交于 2019-12-13 18:40:07
问题 I am trying to register a DirectWrite (Windows 7, Windows 8) API based font file loader, and recreate in Delphi, the CustomFont demo from the Windows 7 SDK that shows how to use DirectWrite APIs with a custom font collection. This allows DirectWrite to use fonts you loaded yourself from inside your application resources that are not globally registered in the Windows font system. I am stuck with an access violation. A minimal sample is below. First a doubt I have about the Delphi Direct2D

How can I create a random number of D2D shapes (rectangles and ellipses) and refer to them as an array while drawing?

余生颓废 提交于 2019-12-13 04:25:47
问题 Let me elaborate. I define a D2D Rectangle like so: D2D1_RECT_F rect1 = D2D1::RectF(5, 0, 150, 150); and an ellipse as: D2D1_ELLIPSE ellipse1 = D2D1::Ellipse(D2D1::Point2F(75.f, 75.f), 75.f, 75.f); To draw these shapes, I first transform them and pass them to the rendertarget: m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Translation(D2D1::SizeF(200, 50))); m_pRenderTarget->FillRectangle(&rect1, m_pLinearGradientBrush); I'd like a way to create a random number of rectangles and ellipses,

How to save the content of a ID2D1RenderTarget to a file

落花浮王杯 提交于 2019-12-13 04:18:14
问题 I have an existing component that draws Direct2D content to an ID2D1RenderTarget and I would like to save that drawing to an image file. The questions here, here and here, although they helped me, did not provide a clear answer as how to do it. My nullth idea was to try the official MSDN method. Unfortunately, it is not available in Win7. My first idea was to modify the drawing routine to make it accept the RenderTarget as a parameter and use ID2D1Factory::CreateWicBitmapRenderTarget to draw

Memory increases every time I resize the window

我的梦境 提交于 2019-12-12 05:26:10
问题 I have created a simple Win32 Application and try to fill the Client Area with a Color. When the line "Clear RenderTarget" is included I see that the memory increases a few KB every time I resize the window. My WindowProc: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_SIZE: { if (pRenderTarget != NULL) { RECT rc; GetClientRect(globalWindowHandle, &rc); D2D1_SIZE_U size = D2D1::SizeU(rc.right, rc.bottom); pRenderTarget->Resize(size);

How to scroll window contents using Direct2D api?

 ̄綄美尐妖づ 提交于 2019-12-12 00:36:38
问题 I would like to scroll window contents in which drawing is performed with Direct2D api through ID2D1RenderTarget. In GDI I could create a buffer with CreateCompatibleDC and later scroll its contents with ScrollDC, redraw exposed area and BitBlt the buffer to window. I cannot see any necessary API in Direct2D to perform the same operations. How can I achieve the same functionality without using GetDC (and GDI), and without using own third buffer? 回答1: There is no Scroll API in Direct2D. Your

Direct2D - preserve the existing content and overwrite the new values

核能气质少年 提交于 2019-12-11 10:34:30
问题 I am planning to develop a XY Plotter for my application. To give some basic idea, how it should look like (of course the implementation would be different), please refer here and here. During the simulation (let's assume, it takes 4 hours to complete the simulation), on a fixed X axis, the new Y values should be (over)written. But, the problem with Direct2D is that, every time pRenderTarget->BeginDraw() is called, the existing Drawing(/Plot/BitMap/Image, etc) is deleted and a new image is