-2

Context

Since Windows 10 version 2004 update, the Magnifier windows application was updated. And as with every update, there are some issues with it.

Since those issues might take a long time to fix, I've decided to implement my own small project full screen magnifier.

I've been developing in c#, .Net 4.6 using the Magnification API from windows magnification.dll . All went good and well, and the main functionality is now implemented. One thing is missing though, a smoothing Mode for pixelated content... Windows Magnifier implements an anti aliasing/ smoothing to the Zoomed in content.

I've checked and the Magnification API, doesn't seem to provide that option.

how do i add smoothing mode to magnifier on windows magnification API?

I'm aware of pixel smoothing methods, but not familiar with win32 API to know where to hook the smoothing method to, before the screen refreshes.

EDIT:

Thanks to @IInspectable answer, after a small search i found this call to the Magnification API in a python project.

Based on that, I wrote this snippet in my C# application , and it works as intended!

[DllImport("Magnification.dll")]
private static extern bool MagSetFullscreenUseBitmapSmoothing(bool useSmoothing);

...

var isMagnifierInitialized = MagInitialize();
var isSmoothingActive = MagSetFullscreenUseBitmapSmoothing(true);
  • please do not tag irrelevant languages. c# or c++ - _which is it_? i recommend [taking the tour](https://stackoverflow.com/tour), as well as reading [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and [what's on topic](https://stackoverflow.com/help/on-topic). – Franz Gleichmann Jun 15 '21 at 14:49
  • Odd, I never noticed, that the Magnifier application (apparently) post-processes the zoomed-in image. The interesting part is, that it neither applies multi-sampling nor any other smoothing. It looks like it derives a signed distance field from the source image and renders a rendition of that at a higher scale. At any rate, the *magnify.exe* module appears to import the (undocumented) `MagSetLensUseBitmapSmoothing` API, so that's probably part of the answer. – IInspectable Jun 15 '21 at 15:57
  • @fra The OP might not care. They are fine with a managed export they can immediately use from C#, but if there isn't they won't shy away from P/Invoking into the C API. So yes, C might be more appropriate a tag than C++, but there's really nothing wrong with both tags being there. – IInspectable Jun 15 '21 at 17:07

1 Answers1

0

There is no public interface in the Magnification API that allows clients to apply filtering (other than color transforms). This used to be possible, but the MagSetImageScalingCallback API was deprecated in Windows 7:

This function works only when Desktop Window Manager (DWM) is off.

Even if it is still available, it will no longer work as designed. From Desktop Window Manager is always on:

In Windows 8, Desktop Window Manager (DWM) is always ON and cannot be disabled by end users and apps.

With that, you're pretty much out of luck trying to replicate the results of the Magnifier application's upscaler using the Magnification API.


The Magnifier application appears to be using undocumented API calls to accomplish the upscaling effects. Running dumpbin /IMPORTS magnify.exe | findstr "Mag" lists some of the public APIs, as well as the following:

  • MagSetLensUseBitmapSmoothing
  • MagSetFullscreenUseBitmapSmoothing

Unless you are willing to reverse-engineer those API calls, you're going to have to spend your time on another project, or look into a different solution.


A note on the upscaling algorithm: If you look closely you'll notice that the upscaled image doesn't exhibit any of the artifacts associated with smoothing algorithms.

Upscaled image

The image isn't blurred in any way. Instead, it shows sharp edges everywhere. I don't know what upscaling algorithm is at work here. Wikipedia's entry on Pixel-art scaling algorithms lists some that have very similar properties. It might well be one of those, or a modified version thereof.

IInspectable
  • 46,945
  • 8
  • 85
  • 181
  • Thank you very much for the deep and detailed answer! ExactIy what i was looking for. will try and check out how they call those API's. Thank you! – Ricasdo Freitas Jun 15 '21 at 19:49