avatare Posted April 7, 2010 Share Posted April 7, 2010 I want to make and effect using the blur plugin by increasing the amount of blur in a circular fashion to simulate DOF. Not sure how do i change the selection in order to be able to call it multiple times with different parameters. I might not be understanding how some parts work. Any help ?? Not posting the code because right now all i got is how to call the blur effect. The idea is to create and effect like this one image That was done by hand and it took 15 layers.... Quote My blog http://www.alfredoalvarez.com/blog My pictures http://avatare.deviantart.com Link to comment Share on other sites More sharing options...
pyrochild Posted April 7, 2010 Share Posted April 7, 2010 Plugins cannot modify the selection. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
avatare Posted April 7, 2010 Author Share Posted April 7, 2010 I guess i did not explain myself properly at teh end i don't want the selection to be modified It was just an example of how i did it manually. What i'm wondering is what is the best way to blur between to raidus in a circular motion. For example first circle uses unblur comparatively to one Second circle to 5 Third circle to 10 I think i might have to reimplement unfocus in order to do that but i don't really now how to figure the are in which the circle would be applied. Does this make my question clearer ? Quote My blog http://www.alfredoalvarez.com/blog My pictures http://avatare.deviantart.com Link to comment Share on other sites More sharing options...
KrisVDM Posted April 7, 2010 Share Posted April 7, 2010 What i'm wondering is what is the best way to blur between to raidus in a circular motion. For example first circle uses unblur comparatively to one Second circle to 5 Third circle to 10 Sounds like a good description of the algorithm to me. Just implement it. I think the trick is to realise that you don't need a selection to perform an effect on a subset of the pixels. After all, when OnRender is called, you can copy the original image to the destination and then modify (e.g. blur) part of the destination. After all, you control the rectangle on which you perform an effect. Also, you could consider first blurring the biggest circle, and then blurring smaller circles more (or less, whichever you want). Hope this helps. Quote Kris VandermottenDownload my Paint.NET Effects Link to comment Share on other sites More sharing options...
MadJik Posted May 2, 2010 Share Posted May 2, 2010 This sounds like my Gradient Blur... The plugin topic is a broken link, but you could find it in the package and the source is also available. Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
BoltBait Posted July 7, 2010 Share Posted July 7, 2010 I want to make and effect using the blur plugin by increasing the amount of blur in a circular fashion to simulate DOF. Not sure how do i change the selection in order to be able to call it multiple times with different parameters. I might not be understanding how some parts work. Any help ?? Not posting the code because right now all i got is how to call the blur effect. The idea is to create and effect like this one image That was done by hand and it took 15 layers.... Here is a start: // Submenu: Blurs // Name: Focus Point #region UICode int Amount1 = 50; // [1,200] Max Radius Pair<double, double> Amount2 = Pair.Create( 0.0 , 0.0 ); // Focus Point #endregion private UserBlendOp normalOp = new UserBlendOps.NormalBlendOp(); void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); int width = selection.Right - selection.Left; int height = selection.Bottom - selection.Top; int CenterX = (int)Math.Round(((Amount2.First + 1) / 2) * width); int CenterY = (int)Math.Round(((Amount2.Second + 1) / 2) * height); int MaxWidth = (int)(((src.Width > src.Height)?src.Width:src.Height) * 1.2)/2; int MinWidth = 1; int Dif = MaxWidth - MinWidth; // Call the Gaussian Blur effect GaussianBlurEffect blurEffect = new GaussianBlurEffect(); PropertyCollection bProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken bParameters = new PropertyBasedEffectConfigToken(bProps); bParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); blurEffect.SetRenderInfo(bParameters, new RenderArgs(dst), new RenderArgs(src)); blurEffect.Render(new Rectangle[1] {rect},0,1); // Loop through all pixels and calculate final pixel values ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; double dist = Math.Sqrt(((CenterX-x)*(CenterX-x))+((CenterY-y)*(CenterY-y))); if (dist > MaxWidth) { CurrentPixel.A = 0; } else { CurrentPixel.A = (byte)(255-(255*((-Math.Cos((dist-MinWidth)/Dif * Math.PI)+1)/2))); } CurrentPixel = normalOp.Apply(dst[x,y], CurrentPixel); dst[x,y] = CurrentPixel; } } } Use CodeLab to make that into a DLL and see if you like it. BTW, this is just a quick mixture of calling Gaussian Blur and the vingette code from here http://forums.getpaint.net/index.php?/topic/11785- changed from black to alpha. It is probably wrong. I did the whole thing in, like, 5 minutes. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game 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.