Jump to content

Types of effects that can be called by complex plugins


MJW
 Share

Recommended Posts

I'm intrigued by the idea of plugins that call another effect, as discussed in BoltBait's tutorial on complex plugins. Can only built-in effects be called, or can user-written plugins also be called? I suspect it's only the built-in effects, but if not, can the effects be chained, so an effect can call an effect that also calls an effect? On a related note, which adjustments can be called as single-pixel operations? Is it limited to the built-in adjustments?

Link to comment
Share on other sites

To answer your questions:

 

1) You can call any installed effect in the same way you can call the built-in effects.

2) You can chain the effects together, but as I said in the tutorial... you only have 2 surfaces to work with (the source canvas and the destination canvas).  If you want more, you need to create them yourself.  This is not impossible.  Just be careful you don't run out of memory.

3) You may run as many single-pixel operations as you like.  You can also call as many blending operations as you like.

 

An example of calling external plugins can be found in this plugin: http://forums.getpaint.net/index.php?/topic/6091-scriptlab/

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

I have another question. Does a user plugin have to do something to allow the control parameters to be changed? Internally, the control variables for CodeLab plugins are called Amount#, and the only other reference to them is the label assigned in the user interface, assuming IndirectUI is used. So how can they be set by the calling plugin?

Link to comment
Share on other sites

I have another question. Does a user plugin have to do something to allow the control parameters to be changed? Internally, the control variables for CodeLab plugins are called Amount#, and the only other reference to them is the label assigned in the user interface, assuming IndirectUI is used. So how can they be set by the calling plugin?

 

Look at http://www.boltbait.com/pdn/CodeLab/help/tutorial3.asp

 

In the first section, it explains how to pass parameters to the called functions.  Look at the code samples where there is a "//fix" comment.

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

Thank you. I had read that tutorial, but somehow managed to miss that part.

 

Edit: Wait. Now I see why I was confused, though by looking at some compiled CodeLab code, my question is answered.

 

The code for Gaussian blur is

GaussianBlurEffect blurEffect = new GaussianBlurEffect();PropertyCollection bProps = blurEffect.CreatePropertyCollection();PropertyBasedEffectConfigToken bParameters = new PropertyBasedEffectConfigToken(bProps);bParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); // fixblurEffect.SetRenderInfo(bParameters, new RenderArgs(dst), new RenderArgs(src));// Call Gaussian BlurblurEffect.Render(new Rectangle[1] {rect},0,1);

The part that sets the Radius is:

bParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); 

I didn't see how the name "Radius" got associated with a value in the Gaussian blur plugin.

 

Looking at the compiled code, I see the Amount# variable names are listed in an enumeration called PropertyNames. So now I can see that the Amount# names are what are used in the call.

Edited by MJW
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...