Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform high quality bitmap scaling in Direct2D?

I am trying to move an application from GDI+ to Direct2D for performance reasons.

Perviously I was using StretchBlt() in HALFTONE mode which gives great, but slow results.

Now I am drawing in Direct2D with RenderTarget->DrawBitmap() but it only has two modes, LINEAR and NEAREST_NEIGHBOR, neither which are very good. LINEAR is better but still produces awful artifacts.

Does Direct2D have any high quality scaling options? If not, am I better off sticking with GDI or is there another option? This is a Windows application running in a window with various Win32 controls.

like image 578
Ian Smith Avatar asked Jan 27 '13 21:01

Ian Smith


1 Answers

Direct2D 1.0 only supported linear and nearest-neighbor interpolation. Direct2D 1.1 adds four additional interpolation algorithms. These are available through the new device context render target (ID2D1DeviceContext) and its DrawBitmap and DrawImage methods. Have a look at the D2D1_INTERPOLATION_MODE enum:

http://msdn.com/library/hh447004.aspx

like image 97
Kenny Kerr Avatar answered Sep 28 '22 06:09

Kenny Kerr