Toli

Toli's Effects (v2.0.2, 20 Jan. 2008)

Recommended Posts

I decided to make a separate post about all my effects and make some changes in order to be able to easily maintain them.

The effects are:
1. Mirror/Rotate
2. Mirror / Rotate Menu
3. Engrave/Emboss
4. Smooth

The links are for you to read the discussion about these effects, if you are interested.
However, you cannot download the effects from there any more. The only place from where you can download the effects is from below:
ToliEffects_v202.zip
The zip file contains:
1. IniFile.dll
This is a common required library, used by all my effects, which must be copied in the Effects folder if you want to use any or all the effects.
This library provides to my effects localization support (the effect in your language) and the ability to "remember" on-screen position and the options you selected.
Effect programmers, feel free to use IniFile.dll (ask me for technical support). Just don't credit yourselves for coding it.

2. MirrorRotate.dll
The Mirror / Rotate Effect

3. MirrorRotateMenu.dll
All 4 mirrors and 3 rotates from the previous plugin, now as MenuItems in a Mirror / Rotate Submenu
You should install either MirrorRotate.dll or MirrorRotateMenu.dll

4. EngraveEmboss.dll
The Engrave / Emboss Effect  MODERATORS NOTE:  This effect is incompatible with Paint.NET 4.0x

5. Smooth.dll
The Smooth Effect

6. MirrorRotate.ini
7. MirrorRotateMenu.ini
8. EngraveEmboss.ini
9. Smooth.ini
Language Ini Files used by my effects for localization.
You should copy them along with the corresponding effects to the Effects folder.
(this folder should usually be: "C:\Program Files\Paint.NET\Effects", without the quotes)

10. License.txt
GNU Public License

If someone would like a Setup (an Installer for the plugins), here it is:
ToliEffectsSetup_v202.zip
And this zip file contains the C# sources. It is for effect programmers only.
ToliEffectsSource_v202.zip
Enjoy!
Toli Cuturicu

Edited by Ego Eram Reputo
updated plugin links

Share this post


Link to post
Share on other sites
The only place from where you can download the effects is the link below:

*tearful absence of any download link*

Share this post


Link to post
Share on other sites

Note to effect programmers:

To use my IniFile.dll, you should:

1. In your project, add a refference to IniFile.dll

2. Add a using Toli; directive

3. In your class which inherits PaintDotNet.Effects.Effect, instantiate the class IniFile

ex: public static IniFile Ini = new IniFile();

4. In the Effect Constructor, instead of the Effect English name, put: Ini.PluginName

5. In your EffectConfigDialog use the same IniFile created before:

ex: private IniFile Ini = YourEffect.Ini;

6. Use it to retrieve localized Control.Text:

ex: this.Ini.GetResourceString(this.YourControl);

7. Use it to retrieve other strings:

ex: string YourString = this.Ini.GetResourceString(YourStringKey, YourStringDefault);

8. Use it to retrieve integers:

ex: int YourInteger = this.Ini.GetResourceInteger(YourIntegerKey, YourIntegerDefault);

9. Make the Form remember its Location:

9.1. Put in Form_Load: this.Ini.ReadFormLocation(this);

9.2. Put in Form_FormClosing: this.Ini.WriteFormLocation(this);

10. Make the Form remember its Size:

10.1. Put in Form_Load: this.Ini.ReadFormSize(this);

10.2. Put in Form_FormClosing: this.Ini.WriteFormSize(this);

... and so on.

Your initial Ini File should look like this:

YourEffect.ini

[Encoding]

CodePage=Your CodePage

[en]

PluginName=Your Plugin Name

YourControl=Your Control Text

...

[fr]

PluginName=Votre Plugin Nom

YourControl=Votre Control Texte

...

[de]

...

[and so on]

...

Share this post


Link to post
Share on other sites

Saving preferences in a sub-directory of Program Files is a very bad thing to do. That won't work in any non-Administrator account, such as Standard User in XP, or in Vista at all.

Share this post


Link to post
Share on other sites

1. That's right, but if the user doesn't have permission to write there, how on Earth did he put the *.dll there in the first place?

2. Ok, then. Where should I put the Ini Files?

Share this post


Link to post
Share on other sites

It doesn't matter how the file got there in the first place. The permissions you have when you place the file could be radically different than when you access it. Or it could be a completely different user, etc.

Place it somewhere in AppData, like in Environment.GetFolderPath(ApplicationData). Usually that's C:/Documents and Settings/username/Application Data, or C:/Users/username/AppData/Roaming. Localization should definitely be separate from per-user data. I have no idea why you're implementing INI stuff when the ResourceManager class is just fine.

Share this post


Link to post
Share on other sites

Because I don't know how to use ResourceManager (I can learn, though) and I know how to use Ini Files.

And I cannot write my own strings in Paint.NET *.resources files. So, what else can I do?

Anyway, I read for example OK and Cancel from Resources. But what about my own strings?

Share this post


Link to post
Share on other sites

I added a Setup for the plugins in the first post.

I don't want regular computer users to complain like "But how do I install the plugins?! :-("

Share this post


Link to post
Share on other sites

Not knowing something really isn't an excuse, like you said you can learn it just fine. Do not read strings from PdnResources. It is not meant for use by plugins, and will be removed in a future version. And then your plugins will break.

Share this post


Link to post
Share on other sites

Considering there are only 3 plugins in there, and the installer is only 355KB, it's ridiculously slow... Also, if you're gonna go with an installer, you should provide checkboxes so users can choose which plugins they want.

Share this post


Link to post
Share on other sites

Ok.

But... how can I know which of your public classes can I count on and which should I just ignore?

Only what is in PaintDotNet.Effects and PaintDotNet.Core?

Share this post


Link to post
Share on other sites

To: pyrochild

It certainly is slow. Blame Microsoft and Windows Installer for this!

I can add checkboxes and I probably will.

However, you can download ToliEffects_v200.zip, which has no setup, only the dlls to choose from.

Share this post


Link to post
Share on other sites
However, you can download ToliEffects_v200.zip, which has no setup, only the dlls to choose from.

That defeats the purpose of having an installer in the first place, doesn't it? ;)

Share this post


Link to post
Share on other sites

Ok, don't get upset on me.

You are right. I am tired and a bit pissed off for some other reason.

I will add the checkboxes when I have enough time.

I have to go now. It's 03.00 in my country.

Share this post


Link to post
Share on other sites
To: pyrochild

It certainly is slow. Blame Microsoft and Windows Installer for this!

I can add checkboxes and I probably will.

However, you can download ToliEffects_v200.zip, which has no setup, only the dlls to choose from.

Keep both, if users wanna download DLL, they can. If they want EXE, they also can. :)

Share this post


Link to post
Share on other sites

It takes a long time because a System Restore (System Protection in Vista) checkpoint is created every time before an MSI install or uninstall operation starts. This is a good thing. I do NOT recommend disabling System Restore.

Share this post


Link to post
Share on other sites

For your Engrave / Emboss plugin, Is it possible you can add "angle" option would be even better.

Thanks :)

Share this post


Link to post
Share on other sites

1. I know that the original Emboss Effect has the Angle parameter, but I really don't know why anyone should use other values than 45 and 135 degrees, which are in my implementation.

2. For larger Width values, the calculation involving trigonometry become awfully slow and almost unusable. I suppose that was the reason for which the original plugin was limited to Width = 1.

Share this post


Link to post
Share on other sites

Let's take them one by one:

1. Smooth doesn't have an UI at all (see SeamlessHelper as another example)

2. EngraveEmboss UI is similar to almost all the other plugins. It has two RadioButtons though, because the user needs to select one of two choices. And, of course, it remembers its on-screen position, user settings and uses localization (French and German available so far) if Paint.NET is started in one of these languages. These enhancements are there out of respect to the user.

3. MirrorRotate has the same enhancements and also a different UI. That's because the user has actually to choose between 7 (related) effects, so Trackbars, UpDowns or AngleSelectors won't work. Only Buttons would do the job. And, if I have Buttons, why not Images on them, showing the user what behaviour to expect from let's say "1st Diagonal Mirror".

The Cancel Button is the Top-Left-Most one and the OK Button is actually the other 7 Buttons, one for each effect.

However, you also have an on-screen preview of the effect when you hover the button.

Is this information satisfactory?

Share this post


Link to post
Share on other sites
Let's take them one by one:

1. Smooth doesn't have an UI at all (see SeamlessHelper as another example)

2. EngraveEmboss UI is similar to almost all the other plugins. It has two RadioButtons though, because the user needs to select one of two choices. And, of course, it remembers its on-screen position, user settings and uses localization (French and German available so far) if Paint.NET is started in one of these languages. These enhancements are there out of respect to the user.

3. MirrorRotate has the same enhancements and also a different UI. That's because the user has actually to choose between 7 (related) effects, so Trackbars, UpDowns or AngleSelectors won't work. Only Buttons would do the job. And, if I have Buttons, why not Images on them, showing the user what behaviour to expect from let's say "1st Diagonal Mirror".

The Cancel Button is the Top-Left-Most one and the OK Button is actually the other 7 Buttons, one for each effect.

However, you also have an on-screen preview of the effect when you hover the button.

Is this information satisfactory?

I think you misunderstood me. I'll explain it with pictures this time. Lets take the UI of your Emboss/Engrave plug-in, and then pyrochild's Outline Object UI.

file.php?id=423outlinegui.png

Now, ignore the theme change. How come your UI's are similar, to say the Colour/Layers...etc. windows, while the majority of the others have a normal windows box around them, like in pyrochild's plug-in?

Share this post


Link to post
Share on other sites

Oh... this is done with only a line of code in the YourEffectConfigDialog class:

this.BorderStyle = FormBorderStyle.FixedToolWindow

or whatever FormBorderStyle you preffer.

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