Ego Eram Reputo Posted August 27, 2008 Share Posted August 27, 2008 I would like to call an effect from within a Codelab *.dll. Say for example I wanted to call the CloudsEffect first, and then render something else over the top of that. Is this possible? Can anyone share some code to point me in the right direction? Many thanks, 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 Link to comment Share on other sites More sharing options...
BoltBait Posted August 27, 2008 Share Posted August 27, 2008 I'm writing a page to describe how to write complex effects with CodeLab ("complex" meaning effects that call other effects). Here's the script I plan on using: #region UICode int Amount1=10; // [0,100] Blur Amount #endregion // Setup for using a specific blend op private UserBlendOps.DarkenBlendOp darkenOp = new UserBlendOps.DarkenBlendOp(); unsafe void Render(Surface dst, Surface src, Rectangle rect) { // Setup for calling the Gaussian Blur effect GaussianBlurEffect blurEffect = new GaussianBlurEffect(); PaintDotNet.PropertySystem.PropertyCollection blurProps; // Call the Gaussian Blur function blurProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(dst), new RenderArgs(src)); blurEffect.Render(new Rectangle[1] {rect},0,1); // Now in the main render loop, the dst canvas has a blurred version of the src canvas for (int y = rect.Top; y { ColorBgra* srcPtr = src.GetPointAddressUnchecked(rect.Left, y); ColorBgra* dstPtr = dst.GetPointAddressUnchecked(rect.Left, y); for (int x = rect.Left; x { ColorBgra CurrentPixel = *srcPtr; // TODO: Add additional pixel processing code here CurrentPixel = darkenOp.Apply(*dstPtr, CurrentPixel); *dstPtr = CurrentPixel; srcPtr++; dstPtr++; } } } Perhaps, you can get something out of the sample code without all of my flowery speech... I think you're really going to like the next version of CodeLab Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 27, 2008 Author Share Posted August 27, 2008 Thank you :!: I was looking at something that Simon Brown wrote here: http://paintdotnet.forumer.com/viewtopic.php?p=170913#p170913, but I just couldn't get it to work in CodeLab. Your source will help me an awful lot. I think you're really going to like the next version of CodeLab You keep doing this to me . I dream up something and ask about it, and you say "Hang on, I'll make Codelab do that for you". Marvelous! Thank you! 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 Link to comment Share on other sites More sharing options...
heythere Posted August 28, 2008 Share Posted August 28, 2008 Something like Macros? Where like I want to make a tutorial, so I define a set of instructions for the user, and it does it step by step? Quote 01010000 01100001 01101001 01101110 01110100 00101110 01001110 01000101 01010100 Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 28, 2008 Author Share Posted August 28, 2008 Hey there, heythere (sorry ) Macros? Not exactly. I want to call (use) an existing PDN effect from within my new effect. Lets say I wanted to create a "snowstorm" effect to apply to photos (I don't - but now that I think about it..., :wink: ). I might use the effects "Add Noise" + "Blur"/"Motion Blur" to get the basic snow blobs on the canvas, before doing some other very cool stuff with these basic building blocks. I just wanted to know if this was achievable (it is) and how its done in CodeLab (see BoltBaits code - which uses GaussianBlurEffect). 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 Link to comment Share on other sites More sharing options...
heythere Posted August 28, 2008 Share Posted August 28, 2008 Hey there, heythere (sorry ) That's the exact reason I gave myself that name. You were the first to figure it out. Now, back on topic. Oh, well it looks fairly simple to implement. But the macros thing may be an idea for a feature suggestion. Or is that what ScriptLab does? I think you're really going to like the next version of CodeLab So when's it coming? :wink: Quote 01010000 01100001 01101001 01101110 01110100 00101110 01001110 01000101 01010100 Link to comment Share on other sites More sharing options...
BoltBait Posted August 28, 2008 Share Posted August 28, 2008 I think you're really going to like the next version of CodeLab So when's it coming? :wink: Well, everything's ready on my end. However, Curtis was working on the text editor itself and and added some pretty cool features, however it is in a pretty bad shape right now. I have some bugs to track down in that space before I can release CodeLab v1.3. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Simon Brown Posted August 28, 2008 Share Posted August 28, 2008 Well, everything's ready on my end. However, Curtis was working on the text editor itself and and added some pretty cool features, however it is in a pretty bad shape right now. I have some bugs to track down in that space before I can release CodeLab v1.3. Off-topic: I have found an article on TheCodeProject that may help you implement auto-complete (remember that you should call it this in the feature list, rather than a Microsoft trademark) in CodeLab: http://www.codeproject.com/KB/cs/diy-intellisense.aspx. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted August 28, 2008 Share Posted August 28, 2008 Ugh! Just what I need... more features when I haven't even debugged the current features yet! :evil: Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
BoltBait Posted September 14, 2008 Share Posted September 14, 2008 FYI, forget what I said above... there is no good way to call other effects from a CodeLab script the way CodeLab works today. I'm working on a redesign of CodeLab, but I don't know when it will be ready. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
xmario Posted July 9, 2010 Share Posted July 9, 2010 (edited) Help please... Сan I call two effects from the CodeLab script. Two effects should be run sequentially. If I use a second time. blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(dst), new RenderArgs(dst)); This does not work. Thanks in advance! Edited July 9, 2010 by xmario Quote Russian paint.net community Link to comment Share on other sites More sharing options...
BoltBait Posted July 9, 2010 Share Posted July 9, 2010 Help please... Сan I call two effects from the CodeLab script. Two effects should be run sequentially. Thanks in advance! Read this: How to write an effect plugin (part 3 of 4) It explains that it is only possible if one of the two desired effects is a Unary Pixel Operation. Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
xmario Posted July 9, 2010 Share Posted July 9, 2010 Thank you! It is unfortunate that I cannot call two effects sequentially ... but I can call them parallel! Thanks for the idea ... Quote Russian paint.net community 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.