Enormator Posted March 22, 2010 Share Posted March 22, 2010 (edited) Makes a triangular gradient in selection (or on the full image when nothing is selected) from primary to secondary color (including alpha). Here is the (quite simple) CodeLab source: Spoiler #region UICode int Amount1=0; //[0,100]Slider 1 Description int Amount2=0; //[0,100]Slider 2 Description int Amount3=0; //[0,100]Slider 3 Description #endregion void Render(Surface dst, Surface src, Rectangle rect) { // Delete any of these lines you don't need Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); long CenterX = (long)(((selection.Right - selection.Left) / 2)+selection.Left); long CenterY = (long)(((selection.Bottom - selection.Top) / 2)+selection.Top); ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor; int BrushWidth = (int)EnvironmentParameters.BrushWidth; double m,topborder; int locx,locy; ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { locy = y-selection.Top; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; locx = x-selection.Left; m = (((double)selection.Bottom-selection.Top)/(selection.Right-selection.Left)); topborder = m*locx; CurrentPixel.R = (byte)((PrimaryColor.R*locy+SecondaryColor.R*(topborder-locy))/topborder); CurrentPixel.G = (byte)((PrimaryColor.G*locy+SecondaryColor.G*(topborder-locy))/topborder); CurrentPixel.B = (byte)((PrimaryColor.B*locy+SecondaryColor.B*(topborder-locy))/topborder); CurrentPixel.A = (byte)((locy<=topborder ? ((PrimaryColor.A*locy+SecondaryColor.A*(topborder-locy))/topborder) : 0)); dst[x,y] = CurrentPixel; } } } I did this because I needed it but you still may tell me what you think about it. I use PdN 3.36 and have no clue what the recent version of PdN will say about that dll. If it doesn't work, just use codelab (if that still exists, don't know, was not here for quite a while) TriangularGradient.zip Edited February 23, 2018 by toe_head2001 Restored broken content Quote :Link: website Link to comment Share on other sites More sharing options...
Sarkut Posted March 22, 2010 Share Posted March 22, 2010 In the Render sub-menu. It works OK in my Paint.NET v3.5.4 install. Quote Link to comment Share on other sites More sharing options...
arana Posted August 15, 2010 Share Posted August 15, 2010 i downloaded this and it makes script lab crash like this: File: C:\Archivos de programa\Paint.NET\Effects\ScriptLab.dll Effect Name: pyrochild.effects.scriptlab.ScriptLab Full error message: System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at pyrochild.effects.scriptlab.ConfigDialog..ctor() at pyrochild.effects.scriptlab.ScriptLab.get_Dialog() at pyrochild.effects.scriptlab.ScriptLab.CreateConfigDialog() at PaintDotNet.Menus.EffectMenuBase.RunEffectImpl(Type effectType) in D:\src\pdn\pdn_35x\src\PaintDotNet\Menus\EffectMenuBase.cs:line 799 using pdn 3.5.5 if i remove the dll scriptlab works again, any ideas? (i am using latest pyro plug pack 2010-4-01) Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 16, 2010 Share Posted August 16, 2010 I'm not an expert on the inner working of scriptlab, but see if you have two of the same *.dll file installed. If you have two files the same, delete the earlier version & restart PDN. 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...
dj1551 Posted April 6, 2011 Share Posted April 6, 2011 The link seems to be broken. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted April 6, 2011 Share Posted April 6, 2011 Problems with the forum over the last day or two have led to some data loss (e.g. Avatars). Attachments may have also suffered. Hopefully this will be fixed before too long. 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.