Results 1 to 10 of 10

Thread: xBRZ for runtime upscale of icons/images of High DPI aware applications

  1. #1

    Thread Starter
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,182

    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.



    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.

  2. #2
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,664

    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)

  3. #3

    Thread Starter
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,182

    Re: xBRZ for runtime upscale of icons/images of High DPI aware applications

    Quote Originally Posted by fafalone View Post
    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>

  4. #4
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    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.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  5. #5

    Thread Starter
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,182

    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.



    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>

  6. #6
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    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.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  7. #7

    Thread Starter
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,182

    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>

  8. #8
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    Re: xBRZ for runtime upscale of icons/images of High DPI aware applications

    Quote Originally Posted by wqweto View Post
    ScalePicture function works on StdPictures i.e. after ICO/JPG is loaded from file or resource.
    Understood

    Quote Originally Posted by wqweto View Post
    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 View Post
    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?
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  9. #9
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,664

    Re: xBRZ for runtime upscale of icons/images of High DPI aware applications

    Demo doesn't work for me...

    Name:  xbrz.jpg
Views: 12
Size:  8.9 KB

  10. #10

    Thread Starter
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,182

    Re: xBRZ for runtime upscale of icons/images of High DPI aware applications

    Quote Originally Posted by fafalone View Post
    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width