iPlug2 Forum

Can resizer control scale range be overriden?

The UI resizing feature in IPlug2 is really nice but, as with any photo editor, bitmaps tend to get fuzzy/blurry when upscaled (but remain sharp when downscaled). Therefore, it seems it would be best to source bitmaps at the largest size and then only scale downward - i.e., with a resizer range of say 30% -100% rather than 60% -200%. The default load size (“middle/default scale”) would also have to change accordingly, goal being to only resize downwards.

I’ve searched through the code but I don’t see what is controlling the resizer scale factors. Is that range hard-coded/fixed - or can it be overridden? If so, how?

In config.h, change #define PLUG_HOST_RESIZE 0 to #define PLUG_HOST_RESIZE 1

Just tried what you suggested but it didn’t have any effect. Same sizes and scales as when set to “0”.

that is unrelated. That means that the app-wrapper window is resizeable.

#define PLUG_MIN_WIDTH 100
#define PLUG_MIN_HEIGHT 100
#define PLUG_MAX_WIDTH 8192
#define PLUG_MAX_HEIGHT 8192

in config.h ?

you definitely need to include high res bitmaps

I tried this - at all different values - with no effect either. Dragging the corner sizer still seems to range +200/-50% from size specified in #define PLUG_WIDTH / #define PLUG_HEIGHT

IGraphics::SetScaleConstraints() is the method you want to set the constraints for the scaling.

As Oli mentions you need to supply high res bitmaps to avoid fuzziness - see the IPlugControls example to see examples of how to name. If you supply a x2 bitmap it should get used at a scale of 200%.

Yes, question about @2x.png files - I understand that this will load the 2x bitmap in Retina displays - but what happens to the position of those bitmaps on the plugin GUI? Do the x2 bitmaps load in their x1 positions or do their X/Y coordinates also get scaled by x2 so that everything scales up proportionately?

I don’t have a Retina display so I can’t see how this works. Any way to test it on an HD display?

Everything is scaled correctly - you specify things in IGraphics pixels, which are then scaled to the display size.

Oh, I see. So that’s why we should use “const IRECT& bounds” rather than the “float x, float y” overload of IBKnobControl, for example? “Bounds” is dynamic whereas “X/Y” is static?

I am working to bring all of my plugins over from iPlug1 - which uses the “float x, float y” approach. In iPlug2 everything scales up/down properly but, as you might expect, the graphics get blurry at max scale (200%). So does the “const IRECT& bounds” approach with additional @2x bitmaps keep it sharp(er) throughout - or is that just applied for Retina displays? What happens on 4k displays?

Yes, I don’t know what I’m doing and I admit it! This whole UI sizing effort is new to me and quite a “challenge”. Is there something you can point me to that explains all of this?

Either way will scale. You could try just supplying x2 bitmaps and then they will get scaled down for 100% display if I recall correctly to make things less fuzzy.

I’m not sure how 4k is defined but high-res screens on windows or Mac will use the high-res bitmaps.