I want to keep my plugin window resizable but it causes some unwanted behavior. I have some PNGs and when I load the plugin for the first time it start drawing them from top-left side and extending them to their proper position. It takes less than one second or maybe 500ms but I can see that the pngs are moving. Is there any thing that I can do to prevent this ? Any technics to keep the window closed or invisible until everything is loaded properly ?
There must be a mistake in your code. Unless it’s some crappy android phone, there is no reason for a noticeable delay when displaying reasonably sized png.
Do you read from disk? Consider BinaryData…
How big are the pngs?
Do you scale in a massive scale like more than 100 times or a 100th part?
Or something else that triggers a lot of asynchronous repaint calls?
Several shots in the dark…
Hi Daniel, Sorry for two days of delay
All of my pngs are loaded as BinaryData.
I just use a simple method to keep everything resizable .
In my plugin editor, I am trying to keep all children components resizable by using the code below.
Rectangle<int> helpFrame (getWidth() * 20 / filterGuiWidth_float, getHeight() * 20 / filterGuiHeight_float); juce::Point<int> helpcentre (getWidth() * 153 / filterGuiWidth_float, getHeight() * 25.0 / filterGuiHeight_float);
Normally the default size of the filter component is 400x500. I want it to be resizable but it should have a fixed resizing ratio while it is being resized. This is the solution i could find for it. My main component is resizable and all other are depend on the main’s size.
I also use an image for my knobs. I have some knobs in my filter component and they are also resizable. Background and other pngs are working fine but knob’s images are doing that lagging. They are being drawn from 0,0 to their proper sizes. it is very fast but i still can see that movement.
We can’t tell what you’re using those calculations for, or even what function that code is in. But is it possible that your resized() code in some component is triggering another call to resized(), by resizing the component itself? Or that you’re resizing a component from a paint() call? Either of those could cause this kind of behavior.