xBRZ for runtime upscale of icons/images of High DPI aware applications
This XP compatible DLL is a better upscaling solution for VB6 LOB applications which need to scale their 16x16 icons at runtime for High DPI screens.
xBRZ is a pixel-art scaling algorithm which can be used to upscale application icons and images for modern High DPI aware applications.
https://www.vbforums.com/images/ieimages/2025/05/2.png
The xBRZ upscaler seems to be especially successful with 16x16 icons and produces much better upscaled High DPI icons (esp. x2 and x3 factors) compared to bicubic interpolation.
The ScalePicture procedure resizes to 150% by first upscaling x2 with xBRZ to 200% and then downsampling to 150% using WIC for bicubic interpolation.
cheers,
</wqw>
p.s. xBRZ name apparently comes from "xScale By Rules" (the original idea of xBR algorithm on GPU) and Zenju (the author of CPU based implementation).
p.p.s. Implementing the algorithm in pure VB6 is to be done.
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Example crashes the IDE and screws up Windows itself for a few minutes here. Win10/manifested IDE. (Yes VB6 lol, I saw the VB.IDE ref)
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Quote:
Originally Posted by
fafalone
Example crashes the IDE and screws up Windows itself for a few minutes here. Win10/manifested IDE. (Yes VB6 lol, I saw the VB.IDE ref)
Weird. Just needed some 16x16 icons to upscale so tried to "extract" these from VBIDE's CommandBars.
Edit: Just pushed 349bd04 a cleanup for the test project to enumerate only first 4 built-in command bars.
cheers,
</wqw>
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Fascinating project. When it is stable - and there are some instructions and a sample project in VB6 using the DLL - I'll have a deeper look. Could be useful.
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Here is how the main toolbar turned out in one of our LOB apps.
https://www.vbforums.com/images/ieimages/2025/05/1.gif
Animation steps in 100% DPI to 225% DPI on a Win11 box. App in standard (non-darkmode) color theme.
The app supports Large Icons option which upscales images +8 px i.e. with option turned on the icons upscale once more 16 -> 24 px, 24 -> 32 px, 32 -> 40 px, etc. depending on current DPI screen settings.
The buttons in screenshot are resized using ScalePicture function linked above.
cheers,
</wqw>
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
That's really good, future proofing your older apps, VB6 and otherwise, always leaves the smaller icons lagging behind. In my programs I have been looking at resize ratio and then dynamically loading larger versions of JPGs as required, that works to an extent but as screen sizes grow you find find yourself regularly having to add increasingly larger images.
Can it operate only on standalone ICO files or does it manage to extract embedded icons with DLLs/RES/binaries. Does it operate on other standalone image types, JPGs for example?
The functionality is really appreciated but it would be nice if you could make that DLL a fully native VB6 app. I know that may be a lot of work.
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
ScalePicture function works on StdPictures i.e. after ICO/JPG is loaded from file or resource.
> . . . it would be nice if you could make that DLL a fully native VB6 app. I know that may be a lot of work.
Yes, the algorithm and original C++ implementation look complicated but I found out there are Java, .Net and JS ports so it seems more doable now.
The weirdest thing I found out during this project is that at present there is no C++17 (or C++20 and beyond) compiler which emits 32-bit XP compatible binaries. Had to backport original xBRZ sources to C++14 and managed to trip on a landmine in VS2015 runtime with *documented* XP incompatibility on global state initialization vs threading.
cheers,
</wqw>
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Quote:
Originally Posted by
wqweto
ScalePicture function works on StdPictures i.e. after ICO/JPG is loaded from file or resource.
Understood
Quote:
Originally Posted by
wqweto
Yes, the algorithm and original C++ implementation look complicated but I found out there are Java, .Net and JS ports so it seems more doable now.
I look forward to seeing that and it will make it much more likely to end up in all our apps if that;s the case.
Quote:
Originally Posted by
wqweto
The weirdest thing I found out during this project is that at present there is no C++17 (or C++20 and beyond) compiler which emits 32-bit XP compatible binaries.
That is a bit rubbish, what's the point of emitting 32bit binaries if not for running on XP?
1 Attachment(s)
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Demo doesn't work for me...
Attachment 196228
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Quote:
Originally Posted by
fafalone
Demo doesn't work for me...
Try clicking on the icons to see them upscaled but you'll need compiled xbrz.dll placed somewhere loadable.
Btw, I've just updated the test project to use pure VB6 implementation instead (original DLL calls left behind #Const ImplUseExternalXbrz = 0).
cheers,
</wqw>
2 Attachment(s)
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
I've made a version of this project for twinBASIC that supports 64bit via switching to my standard Windows Development Library package, replacing the VBIDE-dependent demo form with something much less fancy but still getting the idea across.
Excellent work wqweto!
Attachment 196229
(PS- Got the original working, thanks)
Re: xBRZ for runtime upscale of icons/images of High DPI aware applications
Btw, you do realize the VB6 port is 100% Claude generated. First I used sonette 4.6 for inital implementation and then told opus 4.8 to just fix the bugs compared to original C/C++ version which was weird it actually found all bugs and it worked.