Pratyush Posted January 31, 2018 Author Share Posted January 31, 2018 2 minutes ago, BoltBait said: As long as you are using CodeLab v3.0 (or higher), you can. Please, make a codelab tutorial part 7/8/9 ( whichever number is correct.) It's an important feature and users should be aware of this. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted January 31, 2018 Share Posted January 31, 2018 Once I publish the next release of CodeLab (which should be in the next day or so), I will revisit all of my tutorials. I've already rewritten #7. But, I'll start at the beginning and do them all over again. 3 Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Pratyush Posted February 3, 2018 Author Share Posted February 3, 2018 (edited) I don't understand what is happening here, I want declare a method and call it. How to make it work? Spoiler // Name: Gradual Stripes // Submenu: Render // Author: Pratyush // Title: Gradual Stripes // Version: 1.2.0 // Desc: Draws stripes with gradual change in shades // Keywords: Stripes|Grayscale|Lines // URL: // Help: #region UICode IntSliderControl Amount1 = 5; // [2,64] Quantity of Gradual Stripes IntSliderControl Amount2 = 1; // [1,10] No. of repeatation ColorWheelControl Amount3 = ColorBgra.FromBgr(0,0,0); // [PrimaryColor] Primary Color ColorWheelControl Amount4 = ColorBgra.FromBgr(255,255,255); // [SecondaryColor] Secondary color CheckboxControl Amount5 = false; // [0,1] Invert CheckboxControl Amount6 = false; // [0,1] Center CheckboxControl Amount7 = true; // [0,1] Smoothen #endregion void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra PC = Amount3; ColorBgra SC = Amount4; //Invert color in plugin if ( Amount5 == true) { ColorBgra k = PC; PC = SC; SC = k; } // Step 0 is the first step, how much left to do: Amount - 1 int Maxgroup = Amount1 - 1; //Maxgroup = Maxgroup; // Define the size of step per Channel // assuming PC is the start and SC is the end int stepR = (SC.R - PC.R) / Maxgroup; int stepG = (SC.G - PC.G) / Maxgroup; int stepB = (SC.B - PC.B) / Maxgroup; int stepA = 0; //(PC.A + SC.A) / Maxgroup; ColorBgra CurrentPixel; // qunatity of shade to cover the canvas float divide = (float)rect.Width / Amount1; divide = divide/Amount2; int sf1,sf2,sf3; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; int k,group; k=x; if(Amount6 == true){k=(k+(rect.Width/2))%rect.Width;} group = (int)(k / divide); group = (group)%Amount1; k = (int)(k% divide); sf1 = SmoothingFactor(int k, int StepR); sf2 = SmoothingFactor(int k, int StepG); sf3 = SmoothingFactor(int k, int StepB); sf4 = SmoothingFactor(int k, int StepA); CurrentPixel.R = (byte)(PC.R + stepR * group + sf1); CurrentPixel.G = (byte)(PC.G + stepG * group + sf2); CurrentPixel.B = (byte)(PC.B + stepB * group + sf3); CurrentPixel.A = (byte)(PC.A + stepA * group + sf4); dst[x,y] = CurrentPixel; } } } public int SmoothingFactor(int ki, int Step) { double c = (double)ki/Step; c= (10-9*c)*Math.Pow(c,9); return (int)c; } Edited February 3, 2018 by Pratyush Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted February 3, 2018 Share Posted February 3, 2018 1 hour ago, Pratyush said: I don't understand what is happening here, I want declare a method and call it. How to make it work? Don't declare types in the call. Change: sf1 = SmoothingFactor(int k, int stepR); to: sf1 = SmoothingFactor(k, stepR); Quote My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Pratyush Posted February 3, 2018 Author Share Posted February 3, 2018 :face palm: Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 3, 2018 Share Posted February 3, 2018 ColorBgra PC = Amount3; ColorBgra SC = Amount4; //Invert color in plugin if ( Amount5 == true) { ColorBgra k = PC; PC = SC; SC = k; } Tidier... (edited thanks to MadJik's tip) ColorBgra PC, SC; //reverse colors if Amount5 is true if (Amount5) // you can optionally omit "== true" here { PC = Amount4; SC = Amount3; } else { PC = Amount3; SC = Amount4; } 1 Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
MadJik Posted February 4, 2018 Share Posted February 4, 2018 PC and SC must be defined before the if... 1 Quote My DeviantArt | My Pictorium | My Plugins | Donate via Paypal Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted February 4, 2018 Share Posted February 4, 2018 I really should check my code before posting Edit: fixed. Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker 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.