pdn Posted August 31, 2010 Share Posted August 31, 2010 Can someone help with my project? I am trying to make a gradient blur plugin something like that, but I just can't make it faster. Do anyone have advices for me? I am using the pdn internal Gaussian Blur kernel. See the attached project. Quote Link to comment Share on other sites More sharing options...
Illnab1024 Posted September 1, 2010 Share Posted September 1, 2010 Remember that Render is called multiple times with many different arguments throughout the entire rendering process. You need to precalculate your surface so that you only calculate the path blur it on the first call of the render loop (after your dialog properties have changed). Also remember that this function can be called simultaneously on multiple threads, and there's usually no good way around that (by which I mean the workarounds tend to have more caveats than they're worth). Quote ~~ Link to comment Share on other sites More sharing options...
pdn Posted September 1, 2010 Author Share Posted September 1, 2010 thanks! but where should I place the calculation process so it will be called once only? Quote Link to comment Share on other sites More sharing options...
Illnab1024 Posted September 2, 2010 Share Posted September 2, 2010 As a get{} process for a public variable (with a private version solely for caching purposes), i.e.: private Surface _Dataz = new Surface; public Surface Dataz // Readonly, public variable; private _Dataz is read/writable. { get { if (NeedToRecalculate) // Where NeedToRecalculate represents a boolean value of whether or not we should recalculate; // i.e., if our EffectConfigToken has changed--and you need to set this NeedToRecalculate inside // the render loop to ensure that the ConfigToken values are pertinent. { // Calculate your surface, store it to _Dataz and return the Surface. // Be sure to use _Dataz as your surface when calculating this, as you will double your memory otherwise } else return _Dataz; } } And it's your job to figure out how to do this in VB.NET Quote ~~ Link to comment Share on other sites More sharing options...
pdn Posted September 2, 2010 Author Share Posted September 2, 2010 thanks! Quote Link to comment Share on other sites More sharing options...
pdn Posted September 2, 2010 Author Share Posted September 2, 2010 I have found a easy way to advoid the rendering process to be multi-threaded, I simply add "SingleThreaded" in the "Sub New": Public Sub New() MyBase.New(StaticName, StaticIcon, StaticSubMenuName, Effects.EffectFlags.Configurable Or Effects.EffectFlags.SingleThreaded) End Sub It really works! Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted September 5, 2010 Share Posted September 5, 2010 Or you could just put the one-time calculation stuff in OnSetRenderInfo. Using single-threaded mode is not going to help your performance problems in the least. On my system, your plugin would now be up to 6x slower! Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
pdn Posted September 5, 2010 Author Share Posted September 5, 2010 I think I have to study the plugin system of pdn first... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.