direct2d

Are there any performance tests available re Direct2D?

I'm particularly interested in drawing primitives performance (CAD, GIS, etc.) but any speed comparison with GDI/GDI+ would be very interesting. ...

SetLineSpacing() does not work in DirectWrite - why?

I'm rendering text in Direct2D/DirectWrite, but calling SetLineSpacing() on either TextFormat or TextLayout seems to have no effect. Does anyone know why? ...

What's the best method for drawing overlay graphics on Windows?

I'm working with a Win32 application that needs to create a variety of custom window types. In particular, these windows are often non-rectangle, have shadows, or are mostly transparent. I'm currently using WS_EX_LAYERED with UpdateLayeredWindow to create transparent windows that I can then draw my arbitrary graphics on. However, I fin...

Direct2D fallback to GDI in XP

I'd like to use Direct2D for my .Net application using the Windows Code pack. Since some of my users are using XP, I need to provide a GDI+ fallback. I wonder how people usually do this kind of fallback. Do they abstract/interface all the necessary graphics feature into some custom generic library? If so, is there any open-source librar...

Learning Direct2D

I have some experince creating windows controls in GDI and now I'm looking for good resources (APIs, samples & good practices) to start learning about Direct2d. ...

rubber band in Direct2D

Hello, In GDI, I can use ROPs (XOR pens) to achieve high-performance rubber banding. Is this possible in Direct2D? I have a lot of elements drawn onto my canvas and I would prefer not to have to re-draw them all on every mouse move. -- Thank you ...

Direct2D (C#), how to use transformation matrices?

I'm using Direct2D in C#, and I've seen some examples on MSDN (in C++), that use operator * to multiply matrices (Matrix3x2F). However, in C#, not only is operator* not overloaded, but there's no method that allows me to do this, so I can't "accumulate transformations". Am I missing something? Are there any helper methods for this? I've ...

How do I clear a Direct2D render target to fully transparent

Hi all, I'm trying to draw semi-transparent rectangles on an invisible HWND. However, clearing the window with ID2D1HwndRenderTarget::Clear just makes the entire window black, so when I draw rectangles on top, they look semi-black. If I don't Clear() and don't draw, then the window is invisible, as it should be. Clear() is the culprit ...

Direct2D window black when not in focus

Hi all, I have a Direct2D window which paints fine when in focus; however, when focus moves to another window (same application or another), the entire window goes black. I pinned the issue down to the use of ID2D1HwndRenderTarget::Clear. This function is vital to my application as without it, painting becomes rather... weird. Is there...

Win32: Is there a replacement GDI32.dll that uses hardware acceleration?

Has anyone out there created a version of GDI32.dll that takes advantage of hardware acceleration available on the machine? gdiplus.dll? Starting with Windows Vista, GDI is no longer hardware accelerated. (GDI+ was never hardware accelerated). Without Microsoft fixing GDI (and GDI+) to be able to run well on the computer: native applica...

How can I provide a different rendering target to Direct2D?

I'm using Direct2D in C# to render a small gui framework for my research project. I'm not very used to working on Windows or with DirectX. I'm using a Windows Forms control to create a render target, and msdn warns that since it uses BindDC, a the larger the rendering target, the worse the performance will be (which turned out to be a dr...

Windows Programming: ID2D1Bitmap Interface - Getting the Bitmap Data

I've been writing my own library of functions to access some of the new Direct2D Windows libraries. In particular, I've been working on the ID2D1Bitmap interface. I wanted to write a function to return a pointer to the start of the bitmap data (for the editing of particular pixels, or custom encoding or whatever else I might wish for in ...

Why don't Direct2D and DirectWrite use traditional COM objects?

I'm toying with a little 2D game engine in C# and decided to use Direct2D and DirectWrite for rendering. I know there's the Windows API Code Pack and SlimDX, but I'd really like to dig in and write an interface from scratch. I'm trying to do it without Managed C++, but Direct2D and DirectWrite don't appear to use traditional COM objects....

Per-pixel per-component alpha blending in GDI

I have a 24-bit bitmaps with R, G, B color channels and a 24-bit bitmap with R, G, B alpha channels. I want to alpha blend the first bitmap to a HDC in GDI or RenderTarget in Direct2D with the alpha channels respectively. For example, suppose for one pixel, the bitmap color is (192, 192, 192), the HDC color is (0, 255, 255) and the alpha...

Fullscreen not working in Direct2D (slimdx)

Hi, I'm having a strange problem when switching to fullscreen (alt+enter or swapchain->SetFullscreenState(...)), the application enters fullscreen en i can see a black screen but it's still rendering in a window behind the black screen. And after a couple of seconds the black screen disappears. The thing is the window changed it's size ...

Unresolved external symbol.

Guys in this Main article there is a header file and a source file. After copying those two files and adding few headers: #include <Windows.h> #include <d2d1.h> #pragma comment(lib, "d2d1") #include <dwrite.h> #include <d2d1helper.h> #include "SafeRelease.h" //Safe realease file template<class Interface> inline void SafeRelease( ...

How do I solved Linker errors that go "Unresolved external symbol..."

I am trying to download and build the 'WIC Image Viewer usign Direct2D' from here, but when I build my solution, I am slapped with 56 errors that look like: Error 1 error LNK2019: unresolved external symbol _imp_CoUninitialize@0 referenced in function _wWinMain@16 WICViewerD2D.obj Error 2 error LNK2019: unresolved external ...

How do I extract channel information from a Direct2D Bitmap?

So I have an image that I load using the CreateDecoderFromFilename method of the IWICImagingFactory I just created. It's easy enough to cast this to a Bitmap, but I want to extract the R-G-B-A channels independently so I can compare them to the values from a previous image, and calculate the error. From the MSDN website... IWICBitm...

How do I calculate fps in a simple Direct2D app?

Hey guys, and thanks for looking. I have built the simple D2D app from MSDN, available here. Now, I want to draw some primitives and add an fps counter. I have an OnRender() event, where I draw the rectangles and so on. I also have a call to RenderTextInfo() where I call RenderTarget->DrawText. Where do I add the logic for counting the ...

Direct2D / GDI+ and slow Windows forms drawing - What can be done?

Hey, I'm working a lot with Visual Studio 2008, .NET C# 2.0-3.5 and Windows Forms and I have noticed, like many before me, that GDI+ is extremely slow in drawing Controls. Note that I do not deal with images (JPG, GIF etc) very much. Images are only as icons in certain places. This is actually Controls/Forms/etc that are slow to draw. ...