# Can resizer control scale range be overriden?

**URL:** <https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340>\
**Category:** Uncategorized\
**Created:** [10 March 2021 05:10 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340 "2021-03-10T05:10:39Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [10 March 2021 05:10 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/1 "2021-03-10T05:10:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![snfk](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/snfk/32/140_2.png) [@snfk](https://iplug2.discourse.group/u/snfk)\
**Post date:** [10 March 2021 12:58 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/2 "2021-03-10T12:58:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [10 March 2021 18:05 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/3 "2021-03-10T18:05:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [10 March 2021 20:48 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/4 "2021-03-10T20:48:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [10 March 2021 20:49 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/5 "2021-03-10T20:49:14Z")

</div>

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

```

in config.h ?

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [10 March 2021 20:49 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/6 "2021-03-10T20:49:57Z")

</div>

you definitely need to include high res bitmaps

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [10 March 2021 21:30 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/7 "2021-03-10T21:30:13Z")

</div>

> [@olilarkin](#):
>
> ```auto
> #define PLUG_MIN_WIDTH 100
> #define PLUG_MIN_HEIGHT 100
> #define PLUG_MAX_WIDTH 8192
> #define PLUG_MAX_HEIGHT 8192
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![AlexHarker](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@AlexHarker](https://iplug2.discourse.group/u/AlexHarker)\
**Post date:** [10 March 2021 21:53 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/8 "2021-03-10T21:53:31Z")

</div>

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%.

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [10 March 2021 23:07 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/9 "2021-03-10T23:07:53Z")

</div>

> [@AlexHarker](#):
>
> 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?

---

<div class="post-metadata">

**Author:** ![AlexHarker](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@AlexHarker](https://iplug2.discourse.group/u/AlexHarker)\
**Post date:** [11 March 2021 11:54 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/10 "2021-03-11T11:54:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [11 March 2021 16:35 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/11 "2021-03-11T16:35:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![AlexHarker](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@AlexHarker](https://iplug2.discourse.group/u/AlexHarker)\
**Post date:** [11 March 2021 19:54 UTC](https://iplug2.discourse.group/t/can-resizer-control-scale-range-be-overriden/340/12 "2021-03-11T19:54:26Z")

</div>

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.
