Sign in to follow this  
KrisVDM

Drop Shadow and other effects, KrisVDM's Plugin Pack (updated 2010-10-26)

Recommended Posts

Is there a mirror somewhere for this site?

Direct download at http://users.telenet.be/krisvandermotten.

Work's IT department simply will not "unblock" Internet sites that are not .com or .net because of their higher virus content and low "for business" usage.

This is the forth time over the years that I've had to get this plugin (I guess it gets overwritten with Paint.NET updates or it isn't compatible with newer versions), and the only way I am ever able to get the file is to download it from home on my slow dial-up and bring it to work.

Share this post


Link to post
Share on other sites

Kris, I am trying to write my own drop shadow effect (mainly for learning and my own project needs). Drawing the shadow itself is quite easy and I can do it really fast even for larger bitmaps with irregular shapes (in fact bitmap contents doesn't matter). But the real bottleneck is the "grow shadow" part. Users can achieve great results with it, but my algorithm is too damn slow. So, I was hoping to take a look at your "beautiful" source code but it seems that you don't provide it any more. Can you please at least share the idea behind your "grow shadow" routine?

My first approach was similar to the convolution filters. I was running second loop inside LockBits for the shadow bitmap and painted additional pixels if they were close enough to the source pixel. When I used the Pythagorean theorem to calculate the distance I got really nice, smooth edged expanded shadow (this way one pixel changes into round-shaped group of pixels). But It's too slow. So I decided to cheat and did the same thing you can do when you optimise the Gaussian filter, that is run the loop with two one-dimensional arrays (I'm sure you are familiar with that, so won't dwell into). That worked in terms of speed, but shape of the resulting shadows is rather poor - obviously I got squared edges. I'm able to compensate that a little when I make pixels a bit transparent if they are far from matrix centre. But that's still far away from perfectly shaped circles that I get with 2D matrix and Pythagorean theorem.

I know that I could probably speed things a little if I build my shadow map using byte array (shadow is in fact a transparency mask anyway) instead of bitmap, but I don't think that's going to get me closer to the speed you get :) So, is there any chance to see your code or at least have some guidelines?

Share this post


Link to post
Share on other sites

So, is there any chance to see your code or at least have some guidelines?

Hmm, it seems that if users selects "Keep original image", then you just skip invisible parts of the shadow - this speeds things dramatically. Is that correct?

Share this post


Link to post
Share on other sites

I tried to install this and it didn't work and now when I open PDN an error message pops up that says KrisVDM's plugin didn't work...

Do you think you could put Drop Shadow up so that it'll work, that was the main one that I wanted.

THANKS! boltbait.big_smile.png

Share this post


Link to post
Share on other sites

Hmm, it seems that if users selects "Keep original image", then you just skip invisible parts of the shadow - this speeds things dramatically. Is that correct?

Mostly. To be precise, when "keep original image" is on, I do an alpha blend of the original image over the shadow. The optimization is that I don't calculate the shadow if the alpha for the original pixel is 255, and just render the original pixel.

I spent a lot of time over the years optimizing this. Various techniques are used. I guess the most important one is that I use partial evaluation. Basically, the first step of the process is to calculate the algorithm that will be executed, based on the parameter values. Then I execute that algorithm.

For example, if the widening parameter is zero, the widening step isn’t in the algorithm being executed. The same is true for the blur step (and others). If widening and blur are both being used, I need what you could think of as an intermediate surface, but I need it only in that case. It simply isn’t there if at least one of those parameters is zero.

The same is true for the “keep original image” functionality BTW. When that is off, the algorithm lacks the alpha blend step.

Creating the algorithm on the fly yields a faster algorithm, because I don’t need “if” statements for every individual pixel, as might be the case in a static program.

As it happens, I’ve done a lot of performance work over the last few months. Expect an even faster version soon.

Share this post


Link to post
Share on other sites

I tried to install this and it didn't work and now when I open PDN an error message pops up that says KrisVDM's plugin didn't work...

Do you think you could put Drop Shadow up so that it'll work, that was the main one that I wanted.

THANKS! boltbait.big_smile.png

If the message you get is "Kris Vandermotten's Effects installed incorrectly. The installer can be run now (requires administrative rights). Do you want to run the installer now?", just click yes.

If the message you get is "Kris Vandermotten's Effects installed incorrectly. Please run the installer (Install.exe) again.", then just run the installer. It's the "Install.exe" file in the zip you downloaded.

Share this post


Link to post
Share on other sites

I Did the first one, and nothing happened.

That's a surprise... Could you try again? In any case, running install.exe from the zip manually should solve the problem.

Share this post


Link to post
Share on other sites

As it happens, I’ve done a lot of performance work over the last few months. Expect an even faster version soon.

Unfortunately I'm limited to .NET 2.0 so probably most of your optimisations wont work for me :(

Anyway, I would love to see your new code. Are you planing to include sources?

Share this post


Link to post
Share on other sites

Unfortunately I'm limited to .NET 2.0 so probably most of your optimisations wont work for me :(

Anyway, I would love to see your new code. Are you planing to include sources?

If you are limited to .NET 2.0, you're probably also limited to C# 2.0. In that case my source is close to useless to you, as it relies heavilly on lambdas and closures. But the techniques work on .NET 2.0, it's just that you have to write the lambdas as anonymous delegates.

There were several reasons why I stopped sharing the code, the most important one being that I noticed nobody was interested in it. Most people just want to use the effects; they’re not developers, and the presence of source code only confuses them. The second reason, albeit less important, is that I wanted to stop rip-offs, people making illegal money out of my work. I believe this is also the reason why Rick stopped sharing the source for PDN itself.

However, I am willing to help you of course. I will send you a PM.

Share this post


Link to post
Share on other sites

Just updated without any problems. Just thought I would mention it so you know everything is hunkydory . :)

Thanks for the new plugins but surely they are just another take on plugins already available. Grid lines does the same as Grid/Checkerboard Maker and Object Align is the same as Align Object. Is there any reason why I should keep both versions of each?

Share this post


Link to post
Share on other sites

Great work, Kris.

May I make a small, very small, suggestion? For your grid line, I use the one that was written by MadJik, and I would like to know if you could add the ability to match horizontal and vertical. I think I'll uninstall the other Align plug-in and use yours. It seem to be much faster. Kudos!

Share this post


Link to post
Share on other sites

I think I will use yours(Object Align) as well Kris . It`s definitely faster and you don`t have a UI getting in the way. However I`ll be sticking with Madjik`s version of Grid Maker as there are far more options. ;)

Share this post


Link to post
Share on other sites

Thanks for the new plugins but surely they are just another take on plugins already available. Grid lines does the same as Grid/Checkerboard Maker and Object Align is the same as Align Object. Is there any reason why I should keep both versions of each?

Nope, as far as I know there is no reason to keep both. Feel free to remove one of them.

As for Madjik's Grid Maker, maybe I should have done my homework better: I wasn't aware that it existed. It's just something I needed myself some time ago, and was very easy to create. As I had it anyway, I just included it in the download.

The story is different for Object Align. The exisiting one hasn't been updated for years. I created my own version for different reasons, including speed and ease of use (which is subjective, feel free to disagree). I'm not sure whether moc426 intends to create new versions of his plugin, but I definitely intend to maintain mine at the same level as my other plugins (and that will include a version for PDN 4 when it comes out).

Share this post


Link to post
Share on other sites

Am I going mad or have the default settings on Drop-Shadow changed ?

You might be goind mad or not, I don't know about that ;)

But yes, the default settings have changed. I had received feedback from several people that they usually use it with both offsets set to zero. As that applies to myself as well, I changed the defaults.

Share this post


Link to post
Share on other sites

Thank you. Very nice workable package.

Had no problems getting these into C:\ProgramFiles\Paint.NET\EFFECTS and working well.

Will be looking forward to your newer effects.

When I get the nerve I will post a few of mine to show how ALL has worked so well for me.

lila

Share this post


Link to post
Share on other sites

I just tried a couple of those effects namely drop shadow with text, gradient, and color accent

with black and white picture, with layers combination and all the fuss

and if you know what you are doing i mean the results are quite good

thanks

Share this post


Link to post
Share on other sites

Kris, have you considered renaming this thread to better reflect the nature of it?

I updated the entry today in the Plugin Index, and wondered if you'd be better describing the thread like this:

Drop Shadow & Effects - KrisVDM's Plugin Pack

Your choice entirely of course. I'm making the suggestion only in the interest of making the title more descriptive.

Share this post


Link to post
Share on other sites

Hi Kris. Great plug-ins, especially DropShadow.

I've got a problem though:

If the message you get is "Kris Vandermotten's Effects installed incorrectly. Please run the installer (Install.exe) again.", then just run the installer. It's the "Install.exe" file in the zip you downloaded.

I've tried running the installer from the zip folder as well as from within Paint.NET and a windows pops up breifly and shows "100%" but nothing is installed and the message (above) pops up every time I open Paint.NET.

Any solutions? Thanks.

Edit:

Okay, I only really need 3 plug-ins from this pack. Can someone please send me a PM with the dlls Drop Shadow, Object Align, and Fade Edge? It would be much appreciated. Thanks.

Edit 2: Never mind. I got this to work through a different computer and transferred the files. Thanks again for these great plug-ins. :D

Edited by KeyLogic

Share this post


Link to post
Share on other sites

Okay, I only really need 3 plug-ins from this pack. Can someone please send me a PM with the dlls Drop Shadow, Object Align, and Fade Edge? It would be much appreciated. Thanks.

Just in case anyone has a similar problem: the installer will install only the effects you select, it's not all or nothing. I created the installer to make installation easy, inlcuding the scenario where you don't want everything.

In fact, you can also rerun the installer to remove some of the effects. Just deselect the ones you don't want.

The message that says "please run the installer again" is triggered by Vandermotten.PaintDotNetEffects.Installer.dll. I created this dll because a lot of people just copy the contents of the zip folder into Paint.Net's effects folder. In fact, if they also copied install.exe, this dll will pick it up and allow running it. When the installer has run correctly, that dll is removed and the message no longer appears.

Share this post


Link to post
Share on other sites

I can't run the installer because it can't detect that I have paint.net (I'm using LiberKey's version). Can you just upload the .dll's? It's not that hard to manually place plugins.

Share this post


Link to post
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.

Sign in to follow this