Slighty blurry GUI witch certain zoom-factors

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

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

1 Like

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

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

Yes, I think so.

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:

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

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

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;
}

Thanks for the update :slight_smile: