microsoft / Win2D

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.
http://microsoft.github.io/Win2D
Other
1.8k stars 284 forks source link

Support for ID2D1DeviceContext::DrawGdiMetafile in CanvasDrawingSession #815

Open Dan5783 opened 3 years ago

Dan5783 commented 3 years ago

Could you please add support for loading and drawing metafiles?

jschroedl commented 3 years ago

Yes, please. This would be very useful in our application.

ChewWorker commented 3 years ago

What exactly would you like to do with this? This functionality of D2D isn't directly supported in UWP so this isn't a straightforward change.

jschroedl commented 3 years ago

I'll answer for my app: we're not interested in UWP. I want to use Win2D with WinUI in a Desktop application and EMF is one of the formats we generate and consume with our current GDI+ impl which we're hoping to replace. So, I want to draw it to a XAML CanvasControl along w/ everything else.

Dan5783 commented 3 years ago

We support EMF images in our reporting engine. It works in WinForms, WPF, and UWP applications. Metafiles are loaded using ID2D1Factory1::CreateGdiMetafile and we draw them with ID2D1DeviceContext::DrawGdiMetafile on IVirtualSurfaceImageSourceNative or even to ID2D1CommandList for printing. It would be nice to migrate our reporting engine to Win2D in the future (currently it uses a fork of SharpDX).

ChewWorker commented 3 years ago

@jschroedl we'll consider this. Right now we're focused on fleshing out support for existing Win2D functionality for WinUI3 and desktop. Depending on our focus (UWP vs Desktop) it may be possible to expose this D2D functionality for desktop in the future.