MJW Posted December 2, 2013 Posted December 2, 2013 Is there any way for a plugin to complete part of the rendering process, display the results, then continue rendering? For example, a plugin which renders into an axillary surface might complete a number of rendering phases, and as each phase is completed, move the results from the aux. surface into the dst surface. For plugins that take a long time to complete, that might be interesting and useful. Quote
Rick Brewster Posted December 2, 2013 Posted December 2, 2013 Nope Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
MJW Posted December 3, 2013 Author Posted December 3, 2013 (edited) Too bad. It seems pretty simple to implement. Just cause a re-render as if a control changed and have the render routine structured as a state machine. That presupposes the actual rendering is done in OnSetRenderInfo and Render just copies the result into dst. Edited December 3, 2013 by MJW Quote
Ego Eram Reputo Posted December 3, 2013 Posted December 3, 2013 Too bad. It seems pretty simple to implement. Don't make the mistake of assuming you know how this could be done. You probably don't have an inkling of how the pdn system is structured. A programmer like Rick will generally find it quite offensive if you say things like this. Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker
Rick Brewster Posted December 3, 2013 Posted December 3, 2013 Yeah man. That's something you shouldn't say. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html
MJW Posted December 4, 2013 Author Posted December 4, 2013 For your amusement, and perhaps edification, here's a version of Red ochre's Scribble plugin that shows intermediate rendering steps. This is just a demonstration, NOT a released plugin. It has absolutely no guarantees! It hasn't been tested on a multicore system -- or tested much at all, actually. Many thanks to Red ochre for allowing me to (mis)appropriate his code. The plugin: ScribbleIntermediate.zip The VS project: ScribbleIntermediate.zip Quote
Red ochre Posted December 5, 2013 Posted December 5, 2013 Hi MJW, Just tried the .dll - that is fun! (Haven't had a chance to look at the code yet.) Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings
MJW Posted December 5, 2013 Author Posted December 5, 2013 (edited) Thanks, Red ochre! There's a comment in ScribbleConfigDialog.cs that explains the basic idea: // Cause a retraversal to continue rendering by calling FinishTokenUpdate // This is quite complicated, but I don't know how to do it a simpler way. // I want to call FinishTokenUpdate on the thread that created the controls. // To do so, I create a fake label control (with a null label) along with the // other controls. I toggle the visibility using the asynchronous BeginInvoke method. // That method somehow -- I wish I knew the details -- runs in the control-creating // thread, which is necessary since controls can only be accessed from that thread. // Changing the visibility causes the VisibleChanged event handler for that control // to run, which calls FinishTokenUpdate. When FinishTokenUpdate is called for other // reasons, I set the restartTraversal flag. That's to avoid remaining permanently // out of sync should one of the attempts to cause a retraversal fail to cause one. Edited December 5, 2013 by MJW Quote
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.