Cookies Posted September 2, 2010 Share Posted September 2, 2010 I was fiddling with codelab today at school trying to create a highpass filter like the one in photoshop, i ended up having the same effect like the one in photoshop with a radius of 1 and mine with a radius of 3, mine turned out to be more smooth and i noticed that it only needed to be sharpened a bit to end up like photoshop's, my problem is i dont know how to sharpen it, i already called a gaussian blur so i can't run another effect like that as i understand, codelab source is below #region UICode int Amount1 = 10; // [0,100] Radius #endregion // Setup for using Invert pixel op private UnaryPixelOps.Invert invertOp = new UnaryPixelOps.Invert(); // Setup for using Normal blend op private UserBlendOps.NormalBlendOp normalOp = new UserBlendOps.NormalBlendOp(); void Render(Surface dst, Surface src, Rectangle rect) { // Setup for calling the Gaussian Blur effect GaussianBlurEffect blurEffect = new GaussianBlurEffect(); PropertyCollection blurProps = blurEffect.CreatePropertyCollection(); PropertyBasedEffectConfigToken BlurParameters = new PropertyBasedEffectConfigToken(blurProps); BlurParameters.SetPropertyValue(GaussianBlurEffect.PropertyNames.Radius, Amount1); blurEffect.SetRenderInfo(BlurParameters, new RenderArgs(dst), new RenderArgs(src)); // Call the Gaussian Blur function blurEffect.Render(new Rectangle[1] {rect},0,1); // Now in the main render loop, the dst canvas has a blurred version of the src canvas for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { ColorBgra CurrentPixel = src[x,y]; CurrentPixel = invertOp.Apply(CurrentPixel); ColorBgra cp = dst[x,y]; cp.A = Int32Util.ClampToByte(cp.A / 2); CurrentPixel = normalOp.Apply(CurrentPixel, cp); CurrentPixel = invertOp.Apply(CurrentPixel); dst[x,y] = CurrentPixel; } } } Tried some different sharpening code i found with google, they didn't work. Would be nice if i could adjust the sharpness too Quote Link to comment Share on other sites More sharing options...
BoltBait Posted September 2, 2010 Share Posted September 2, 2010 Read this source code: http://forums.getpaint.net/index.php?/topic/16736- Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Cookies Posted September 2, 2010 Author Share Posted September 2, 2010 Thanks, but i found another way to do it I think i will release it tomorrow, need to get an icon and i have to shut down my computer now it got a few more settings than photoshop's version but more simple Quote Link to comment Share on other sites More sharing options...
Lance McKnight Posted September 2, 2010 Share Posted September 2, 2010 If you release this plug-in, I'll be forever grateful. I have been waiting for a plug-in like this ever since I discovered PDN. Quote Officially retired from this forum. Have a nice day. 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.