PaxonJollock

Official documentation

Recommended Posts

Where can I find the official plugin developer documentation, that shows exactly what API my DLL has to make available to PDN, and exactly what PDN objects are available for me to use? The description of all the data types? Also I'm interesting in developing every kind of plugin, not just effects plugins. Googling just leads me to tons of sites distributing unauthorized plugin packs.

Share this post


Link to post
Share on other sites
23 hours ago, BoltBait said:

This is an excellent resource about how to write an effects plugin using CodeLab, and I'm very grateful for it. However, while this is a great starting point, it only talks about using Visual Studio as an afterthought. And it doesn't describe the object model that PDN makes available nor the functions that can be written. And it doesn't mention the other two kinds of plugins at all.

Share this post


Link to post
Share on other sites

Such documentation doesn't exist. Perhaps it should, but few people like writing documentation.

 

Here's rough/simplified overview:

- To make an effect, you create a class that derives from the Effect class that's in the paint.net assemblies.

- When your effect class is invoked (when you open the plugin), it spawns an EffectConfigDialog class, and EffectToken class.

-- You can define your own EffectConfigDialog and EffectToken classes, or IndirectUI will do it for you (if you derive from PropertyBasedEffect instead of Effect)

- When you change something in the GUI (the EffectConfigDialog), the value from the GUI control gets bound to a property in the EffectToken.

- When the method in your effect executes, it fetches the values of the EffectToken properties, and uses them as the variables in your code that manipulates the image.

 

^^^^ I should really turn that into a nice chart.

 

Here are some of the Types you should be familiar with:

- ColorBgra - very similar to Color, but different structure, and provides some useful methods

- Surface - represents a collection of BgraColor pixels. Individual BgraColors in a Surface can be accessed like this MySurface[x, y]

- RenderArgs - Not really sure how to describe this one. It's like a container for Surfaces...

- PdnRegion - similar to a Region. Usually utilized to define the exact selection, as they can be complex sometimes.

  • Upvote 2

Share this post


Link to post
Share on other sites

Well, sorry, but my tutorials are about as official as you're going to get.  But, you're right, they are not complete.

 

I'm not part of the paint.net development team, but I started writing tutorials as I began understanding how plugins worked as a way to help others.  And, as there was no official documentation, I worked with the early plugin developers to understand the limits and capabilities of the plugin system.  (You can still read the CodeLab thread from the beginning to chart my progress.)

 

As for other types of plugins, I've never written a filetype plugin.  But, you can be sure that if I ever do, I'll be sure to write a tutorial on how to do it. :)

 

The only other type of plugin is "shapes" and you can find information on how to design and code custom shapes here:

 

Since you feel that the current set of documentation is lacking, you can write some yourself!  Play with paint.net, tinker, figure out how it works, then write down what you found!  That's what I did and you can do the same.  I'm sure there are many people who would benefit from any tutorial you care to write.

  • Upvote 1

Share this post


Link to post
Share on other sites

Here's a chart I made. It shows IndirectUI effect plugins, and also custom effect plugins.  Any Corrections are welcome and encouraged.

 

Blue Rectangles: Base Classes you derive from.

Black Ellipses: Classes you create

Green Ellipses: Classes IndirectUI creates "behind the scenes"

 

Blue Lines: Shows class derivation (show the base class)

Red Lines: Shows the flow of Token values

Black Lines: Shows Classes being invoked from other classes

 

effectChart.png

 

  • Upvote 2

Share this post


Link to post
Share on other sites
2 hours ago, Ego Eram Reputo said:

If you added the info from your previous post it the chart would be awesome

 

Add the info to the bottom of the chart, right?  (adding it inline doesn't make sense, or does it?)

Share this post


Link to post
Share on other sites

Here's the updated chart with explanations at the bottom. Hopefully more neat & clean too.

 

effectChartv3.png

 

EDIT: fixed cosmetic issues

Edited by toe_head2001
  • Upvote 2

Share this post


Link to post
Share on other sites
10 minutes ago, Ego Eram Reputo said:

This has real potential. I might have a play with it over the coming weekend.

Want the source file? It's a .odg file.

Or if you want, I can put it up on draw.io or something similar.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now