Questions tagged [direct2d]

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.

738 questions
4
votes
1 answer

How do I rework an existing Direct2D-based library to function accessed from multiple threads at once?

I am using an existing graphics library, one implementation of which uses Direct2D. (It can also use GDI+, Quartz, etc.) It has bitmap objects, pens, brushes etc, all implemented as wrapper code around Direct2D objects. The library is closed source…
David
  • 13,360
  • 7
  • 66
  • 130
4
votes
0 answers

Direct2D Debug - An interface [x] was created but not released

I have the Direct2D debug layer turned on. When my application exits, I get the following output: D2D DEBUG ERROR - An interface [x] was created but not released. Use 'dps x' to view its allocation stack. Where x is an address. What is dps and how…
4
votes
2 answers

EndDraw() takes 80 % of working time in Direct2D

I face one critical Performance problem in my Direct2D application. I make use of Direct2D to draw my graph using PathGeometry to get better performance and to achieve the clean rendering in Windows 8.1. While creating the DeviceResources, i create…
David Bekham
  • 2,175
  • 3
  • 27
  • 56
4
votes
2 answers

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…
gilbertc
  • 1,049
  • 1
  • 10
  • 19
4
votes
2 answers

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…
Daniel Jette
  • 913
  • 1
  • 9
  • 23
4
votes
6 answers

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?
Dmitri Nesteruk
  • 23,067
  • 22
  • 97
  • 166
4
votes
1 answer

Large images with Direct2D

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…
4
votes
0 answers

how to save bitmap to file using direct2d and ID2D1HwndRenderTarget

How to save ID2D1Bitmap to PNG file did not help me. I'm working with Direct2D. I want to save a ID2D1**Hwnd**RenderTarget *m_pRenderTarget to file as bmp or png etc. But the sample I found on MSDN use ID2D1RenderTarget. In my case I drawn my figure…
hughes
  • 177
  • 1
  • 5
  • 11
4
votes
1 answer

How do I get the text extent when using ID2D1RenderTarget::DrawText

With Direct2D, I can use ID2D1RenderTarget::DrawText to draw text, but how can I get the text extent before I draw? Note that I wish to do this under Windows 8 RT. Thanks
John Gaby
  • 1,500
  • 3
  • 19
  • 33
4
votes
1 answer

How to draw a circle with ID2D1PathGeometry

ID2D1PathGeometry::Open returns an ID2D1GeometrySink that supports adding lines, arcs, and curves. But is there a way to add a circle (ellipse), or at least simulate one somehow?
user1775315
4
votes
1 answer

Determine text boundary box with Direct2D/DirectWrite

ID2D1RenderTarget::DrawGlyphRun takes the following params: D2D1_POINT_2F baselineOrigin, __in CONST DWRITE_GLYPH_RUN *glyphRun, __in ID2D1Brush *foregroundBrush, DWRITE_MEASURING_MODE measuringMode /*= DWRITE_MEASURING_MODE_NATURAL */ Where…
vt.
  • 1,325
  • 12
  • 27
4
votes
3 answers

MeasureString in sharpDX

we are developing windows 8 metro app using SharpDX. Now we have to declare set of string within a Rectangle. For that we trying to find out the Font width and height using SharpDX.DrawingSizeF. for example: Windows.Graphics g; Model.Font…
Maniarasu
  • 362
  • 5
  • 15
4
votes
2 answers

Direct2D --- Why are Brush resources bound to individual Direct2D render targets?

Why did Microsoft decide to bind Brush resources to individual Direct2D render targets, rather than the overall Direct2D context. What should we do if we have a Direct3D texture, which is mapped to a Direct2D render target (for a HUD) which needs to…
bbosak
  • 5,353
  • 7
  • 42
  • 60
4
votes
1 answer

Save to png in SharpDx

I develop Metro-application with SharpDx under Direct2D. I drew some picture using deviceContext. How I can save my picture to png-file?
AndreyAkinshin
  • 18,603
  • 29
  • 96
  • 155
4
votes
1 answer

How to save ID2D1Bitmap to PNG file

I faced a problem when trying to save ID2D1Bitmap (that created from ID2D1HwndRenderTarget) to PNG File. The output image is just empty with white color. HRESULT returned from function call EndDraw() is -2003238894. Thanks for any help. Here is my…
Jacky Nguyen
  • 51
  • 1
  • 2