Direct2D is a hardware-accelerated, immediate-mode, 2-D graphics API that provides high performance and high-quality rendering for 2-D geometry, bitmaps, and text. The Direct2D API is designed to interoperate well with GDI, GDI+, and Direct3D.
Questions tagged [direct2d]
738 questions
23
votes
4 answers
Is TDirect2DCanvas slow or am I doing something wrong?
While looking for alternatives to replace GDI, I was trying to test Delphi's 2010 TDirect2DCanvas performance in Windows 7.
I tested it by drawing a huge polyline using Direct2D and the result was absurdly slow, even with 500 times less data than…

Trinidad
- 2,756
- 2
- 25
- 43
19
votes
4 answers
GDI versus Direct2D
I'm programming a simulation at the moment, and I want to port my application from using GDI to using Direct2D. But my Direct2D code is much slower than my GDI code.
I render a lot of ellipses on the screen. In my GDI application I draw to a memory…

roohan
- 731
- 3
- 8
- 15
15
votes
6 answers
Smooth window resizing in Windows (using Direct2D 1.1)?
It annoys me that the resizing of windows in Windows is not as "smooth" as it I'd like it to be (this is the case with Windows programs in general, not just my own. Visual Studio is a good example). It makes the OS and its programs feel "flimsy" and…

d7samurai
- 3,086
- 2
- 30
- 43
13
votes
6 answers
How to do exactly one render per vertical sync (no repeating, no skipping)?
I'm trying to do vertical synced renders so that exactly one render is done per vertical sync, without skipping or repeating any frames. I would need this to work under Windows 7 and (in the future) Windows 8.
It would basically consist of drawing a…

slazaro
- 254
- 4
- 8
12
votes
4 answers
Redirect Direct2D rendering to a WPF Control
I'm developing a drawing application in Visual C++ by means of Direct2D.
I have a demo application where:
// create the ID2D1Factory
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pDirect2dFactory);
// create the main window
HWND m_hwnd =…

Nick
- 10,309
- 21
- 97
- 201
12
votes
2 answers
Why is my Direct2D drawing performance so terrible?
I'm developing a Dotnet 4.0 application on Win7 that needs to perform mapping. As a mapping application it outputs crap loads of high resolution antialiased polygons. It currently supports two types of rendering output, GDI+ and Direct2D.
I'm…

Neutrino
- 8,496
- 4
- 57
- 83
12
votes
2 answers
Pixels in Direct2D
The dark gray lines are supposed to be black and 1 pixel wide:
pRT->DrawLine(Point2F(100, 120), Point2F(300, 120), blackbrush, 1);
The light gray lines are supposed to be black and 0.5 pixel wide:
pRT->DrawLine(Point2F(120, 130), Point2F(280,…

SemMike
- 1,433
- 1
- 15
- 23
11
votes
2 answers
Directwrite: Getting a font's height
My objective:
I want to get the height of an IDWriteTextFormat's font so I can calculate how many lines of text can fit in an IDWriteTextLayout of a certain height.
My problem:
Right now I'm using this code to calculate the visible number of…

kittykitty
- 221
- 2
- 7
11
votes
2 answers
Direct2D Depth Buffer
I need to draw a list of shapes and I am using Direct2D. I get the list of shapes from a file. The list is sorted and the order of the elements inside the file represents the order these shapes will be drawn. So, if for example the file specifies…

Nick
- 10,309
- 21
- 97
- 201
11
votes
0 answers
Direct2D/C++ - Offscreen Rendering using Bitmap
I already have implemented a Direct2D application for windows desktop application using C++, where I show the graphical results (with points, lines, and ellipses) during the simulation. I keep a buffer for storing the simulation values as long as…

m_drinks_coffee
- 436
- 8
- 24
10
votes
3 answers
Decompose 2D Transformation Matrix
So, I have a Direct2D Matrix3x2F that I use to store transformations on geometries. I want these transformations to be user-editable, and I don't want the user to have to edit a matrix directly. Is it possible to decompose a 3x2 matrix into scaling,…

laptou
- 6,389
- 2
- 28
- 59
10
votes
3 answers
Draw splines by using Direct2D
I have the data of a spline curve
Degree
Knots
Control points
Fit points
And I need to draw this curve by using Direct2D. At the moment I am using the ID2D1GeometrySink interface to draw geometries but it seems it does not implements a possible…

Nick
- 10,309
- 21
- 97
- 201
10
votes
3 answers
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).…

Ian Boyd
- 246,734
- 253
- 869
- 1,219
9
votes
1 answer
Using Direct2D in a Delphi VCL application affected by DPI scaling
I am investigating replacing GDI with Direct2D in some parts of my applications.
To this end, I read the official Embarcadero documentation and created this minimal Direct2D application:
unit Unit1;
interface
uses
Winapi.Windows,…

Andreas Rejbrand
- 105,602
- 8
- 282
- 384
8
votes
2 answers
Efficient Direct2D multithreading
I'm writing a ebook reader app for Windows Store. I'm using Direct2D + DXGI swap chains to render book pages on screen.
My book content sometimes is quite complex (geometry, bitmaps, masks, etc), so it can take up to 100 ms to render it. So I'm…

hweom
- 437
- 4
- 11