Red ochre Posted April 10, 2012 Share Posted April 10, 2012 (edited) Overblur Now in my plugin pack here: Red ochre plugin pack This is a very simple plugin. It compares the blurred picture to the original and lets you choose how much of that change to apply. Results range from an odd effect useful for making textures through to a passable sharpen effect. And here is the codelab code: Spoiler /* =================================================== */ /* overblur */ /* (c) 2012 Red Ochre */ /* Description: compare blur to source & alter the change */ /* ========================================== ======== */ // Name: Overblur // Author: Red Ochre (John Robbins) // Submenu: Blurs // URL: http://www.getpaint.net/redirect/plugins.html // Title: Overblur Red ochre April 2012 #region UICode int Amount1 = 10; // [0,50] blur radius double Amount2 = 0; // [-10,10] overblur (0 = straight blur,1 = unchanged) sharpen(under blur) bool Amount3 = true; // [0,1] retain original transparency #endregion void Render(Surface dst, Surface src, Rectangle rect) { // 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); ColorBgra CP;//current pixel int cB,cG,cR,cA;// current BGRA values ColorBgra bP;// blurred destination pixel int bB,bG,bR,bA;// blur BGRA values ColorBgra sP;// source pixel int sB,sG,sR,sA;// source BGRA values int diffB,diffG,diffR,diffA; double rat = Amount2 - 1; for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { bP = dst[x,y];bB = bP.B;bG = bP.G;bR = bP.R;bA = bP.A;//blur dst values sP = src[x,y];sB = sP.B;sG = sP.G;sR = sP.R;sA = sP.A;// source values diffB = sB - bB;diffG = sG - bG;diffR = sR - bR;diffA = sA - bA;// difference between them cB = sB;cG = sG;cR = sR;cA = sA;// assign current to source // simple over blur cB = (int)(sB + (rat * diffB)); cG = (int)(sG + (rat * diffG)); cR = (int)(sR + (rat * diffR)); cA = sA;// retain transparency if (!Amount3) { cA = (int)(sA + (rat * diffA)); } // re assemble CP = ColorBgra.FromBgra( Int32Util.ClampToByte(cB), Int32Util.ClampToByte(cG), Int32Util.ClampToByte(cR), Int32Util.ClampToByte(cA)); dst[x,y] = CP; } } } Edited April 13, 2018 by toe_head2001 Fixed broken Photobucket images 1 Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to comment Share on other sites More sharing options...
barbieq25 Posted April 10, 2012 Share Posted April 10, 2012 I'll try this out later but it looks pretty useful. Thankies! Quote Knowledge is no burden to carry. April Jones, 2012 Gallery My DA Gallery Link to comment Share on other sites More sharing options...
nitenurse79 Posted April 10, 2012 Share Posted April 10, 2012 Sweet, looks useful "downloads for later" thanks Red Ochre for the excellent plugins Quote Link to comment Share on other sites More sharing options...
Red ochre Posted April 10, 2012 Author Share Posted April 10, 2012 Thanks Barbieq25 and Nitenurse79 - hope you're both well and happy Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings 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.