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
8
votes
3 answers

How do I clear a Direct2D render target to fully transparent

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…
Saul
  • 992
  • 1
  • 13
  • 26
8
votes
1 answer

How to copy data from TDirect2DCanvas (Direct2D Rendertarget)?

I'm trying out the Direct2D RenderTarget property of C++ Builder's TDirect2DCanvas to benchmark bitmap manipulation using the GPU. This is most impressive compared to GDI. However, I cannot figure out how to get the result back into CPU memory so I…
Mike Versteeg
  • 1,615
  • 14
  • 28
8
votes
4 answers

What's the standard way for UI animations?

I'm working on a UI library powered by D2D, DWrite and Wic for (SDK API) Native C++ Desktop Applications (as in no XAML, no WinRT, just old school C++). I'm all set to write a windowless UI to give a more modern (as in this century look) to my C++…
CodeAngry
  • 12,760
  • 3
  • 50
  • 57
7
votes
3 answers

How to work with pixels using Direct2D

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…
Alex
  • 655
  • 1
  • 8
  • 16
7
votes
2 answers

Direct2D interface and blurry text issue

My new application will feature a rich interface which should be resizable on-the-fly uses transparent icons/images etc. For this application I'm trying to decide on using the new Direct2D API against the good old GDI. One of the downsides is of…
demorge
  • 1,097
  • 1
  • 7
  • 17
7
votes
2 answers

What exactly is "lightweight COM"?

While researching which COM apartment threading models are supported by Direct2D, I discovered that despite appearances and the fact that one can use the API from .NET using COM interoperability, Direct2D (like other DirectX APIs) is not actually a…
stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268
7
votes
2 answers

ID2D1HwndRenderTarget always having black background instead of transparent

I am trying to create a simple transparent window where I can draw with Direct2D. So far what I have done: Created window Set style to WS_EX_LAYERED Set alpha color key as #FFF Draw using Windows Graphics a white rectangle Now window is…
Mathew Kurian
  • 5,949
  • 5
  • 46
  • 73
6
votes
2 answers

How does one use a memory stream instead of files when rendering Direct2D images via SharpDX?

The setup Consider the given scratch program that uses SharpDX, a managed wrapper for Direct* libraries, to render a bitmap and save it as a PNG: namespace ConsoleApplication5 { using System; using System.Diagnostics; using System.IO; …
Nicholas Piasecki
  • 25,203
  • 5
  • 80
  • 91
6
votes
2 answers

Replace GDI+ DrawImage with PInvoked GDI and transparent PNG's

I've created an image service in C# which takes a base layer image (JPG), layers one more more transparent PNG's (32 bit), and then outputs a final JPG image. I'm trying to squeeze every last millisecond out of this function and my code is…
Dfaussio
  • 166
  • 2
  • 9
6
votes
1 answer

C# How to Improve Efficiency in Direct2D Drawing

Good morning, I have been teaching myself a bit of Direct2D programming in C#, utilizing native wrappers that are available (currently using d2dSharp, but have also tried SharpDX). I'm running into problems with efficiency, though, where the basic…
Anthony
  • 69
  • 1
  • 5
6
votes
1 answer

Per-monitor DPI-Aware: black window glitch with NVIDIA Optimus

I would like to make a Per-Monitor DPI-Aware Direct2D application. I have extended Microsoft's "First Direct2D Program" example to handle WM_DPICHANGED as explained in Kenny Kerr's MSDN article. This works when both monitors use one video card, but…
Lack
  • 1,625
  • 1
  • 17
  • 29
6
votes
3 answers

Unresolved external symbol

Main article there is a header file and a source file. After copying those two files and adding few headers: #include #include #pragma comment(lib, "d2d1") #include #include #include…
There is nothing we can do
  • 23,727
  • 30
  • 106
  • 194
6
votes
1 answer

Resizing a DXGI swap chain bound to a Direct2D render target

I have a Direct2D render target created with ID2D1Factory::CreateDxgiSurfaceRenderTarget. When I receive a WM_SIZE message, I try to resize the corresponding swap chain by calling IDXGISwapChain::ResizeBuffers, but it fails with…
user1610015
  • 6,561
  • 2
  • 15
  • 18
6
votes
1 answer

How do modern browsers do tiled rendering (particularly in Direct2D) efficiently?

This question has to do with how browsers render an entire page as tiled images (and is not about rendering images within pages.) I'm most interested in the memory costs. It is my understanding that a browser such as Chrome will layout the entire…
bright
  • 4,700
  • 1
  • 34
  • 59
6
votes
3 answers

Direct3D 11.1's target-independent rasterization (TIR) equivalent in OpenGL (including extensions)

Target-independent rasterization (TIR) is a new hardware feature in DirectX 11.1, which Microsoft used to improve Direct2D in Windows 8. AMD claimed that TIR improved performance in 2D vector graphics by some 500%. And there was some "war of words"…
Fizz
  • 4,782
  • 1
  • 24
  • 51
1
2
3
49 50