See the question and my original answer on StackOverflow

An HWND Direct2D Render Target supports various pixel formats. When you create it like you do (passing D2D1::RenderTargetProperties()) you're implicitly using the DXGI_FORMAT_B8G8R8A8_UNORM + D2D1_ALPHA_MODE_IGNORE parameters.

So you can either change how you create the render target (you can use D2D1_ALPHA_MODE_PREMULTIPLIED) and don't change the bitmap's pixel format, or change the bitmap's pixel format to D2D1_ALPHA_MODE_IGNORE.

But the best is to just copy the render target's pixel format like this:

D2D1_BITMAP_PROPERTIES bitmapProperties{}; // use 0 for dpi means auto-adapt
bitmapProperties.pixelFormat = target->GetPixelFormat();