Slighty blurry GUI witch certain zoom-factors

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
Post Reply
MarkusK
Posts: 53
Joined: Thu Oct 22, 2020 9:11 am

Slighty blurry GUI witch certain zoom-factors

Post by MarkusK »

Sizes from 100% to 149% use the 1X image for the backround.
Sizes over 150% use the 2X image for the backround.

On 150% the image looks sharp since 2x is used.
On 149% it looks blurry since 1x is used.

I would prefer to use the 2x image to scaling factors down to around 125%. The most part of the aliasing should be compansated by the linear interpolation and the image would look sharper.

Is there a setting in VSTGUI where i can define or change this?

Thank you,
Markus

Arne Scheffler
Posts: 417
Joined: Mon Jun 20, 2016 7:53 am

Re: Slighty blurry GUI witch certain zoom-factors

Post by Arne Scheffler »

No, but you can provide your own scaled variants for any factor (1.25x, 1.5x, 1.75x etc).

MarkusK
Posts: 53
Joined: Thu Oct 22, 2020 9:11 am

Re: Slighty blurry GUI witch certain zoom-factors

Post by MarkusK »

Nice. I thought only 1x, 2x, 3x would be possible.

Is this the correct synthax to change the .uidesc file ?

<bitmap name="background" path="background.png"/>
<bitmap name="background#1.5x" path="background_1.5x.png" scale-factor="1.5"/>
<bitmap name="background#2x" path="background_2.0x.png" scale-factor="2"/>

Arne Scheffler
Posts: 417
Joined: Mon Jun 20, 2016 7:53 am

Re: Slighty blurry GUI witch certain zoom-factors

Post by Arne Scheffler »

Yes, I think so.

ray
Posts: 104
Joined: Fri Sep 02, 2016 9:37 am

Re: Slighty blurry GUI witch certain zoom-factors

Post by ray »

Hi Markus,

I don't use the ui-description feature to build my GUIs, but here's is how I achieve what you're trying to do, programatically.

My graphics are provided in 2x resolution for all scale factors. I use a simple CBitmap extension to communicate the scale factor like this:

Code: Select all

class MyBitmap : public CBitmap
{
public:
    MyBitmap(const CResourceDescription &desc, double dpi_scale = 2.0) : CBitmap(desc)
    {
        auto platformBitmap = getPlatformBitmap();
        if(platformBitmap)
        {
            platformBitmap->setScaleFactor(dpi_scale);
        }
    } 
};
Additionally, you can use CFrame::setBitmapInterpolationQuality() in order to set different interpolation modes. Maybe that helps.

Best,
Ray

MarkusK
Posts: 53
Joined: Thu Oct 22, 2020 9:11 am

Re: Slighty blurry GUI witch certain zoom-factors

Post by MarkusK »

Thank you Ray.
I also already thought about the possiblity to provide 2x scale only.

I was able to solve the brury images on PC with this little hack:

cbitmap.cpp

Code: Select all

auto CBitmap::getBestPlatformBitmapForScaleFactor (double scaleFactor) const -> PlatformBitmapPtr
{
	if (bitmaps.empty ()) return nullptr;
	auto bestBitmap = bitmaps[0];
	const double scaleWrap=1.2;//ist das auf 1 wird zwischen 100% und 149% Zoom noch das 1x bitmap verwendet, was aber unscharf ist. Wertbereich : 1 bis 1.49
	double bestDiff = std::abs (scaleFactor * scaleWrap - bestBitmap->getScaleFactor ());
	for (const auto& bitmap : bitmaps)
	{
		if (bitmap->getScaleFactor () == scaleFactor) return bitmap;
		else if (std::abs (scaleFactor * scaleWrap - bitmap->getScaleFactor ()) <= bestDiff && bitmap->getScaleFactor () > bestBitmap->getScaleFactor ())
		{
			bestBitmap = bitmap;
			bestDiff = std::abs (scaleFactor * scaleWrap - bitmap->getScaleFactor ());
		}
	}
	return bestBitmap;
}

ab3787
Posts: 1
Joined: Mon Oct 26, 2020 7:03 am

Re: Slighty blurry GUI witch certain zoom-factors

Post by ab3787 »

Thanks for the update :) online casino singapore dollars

Post Reply