Vermiculus Posted December 29, 2009 Share Posted December 29, 2009 Isn't there a plug-in that will simply swap the alpha channel with a grayscale value? It would be simple to make... RRGGBB-->AA FFFFFF-->FF ABABAB-->AB 161616-->16 000000-->00 and so on... I found the Color to Alpha <http://paintdotnet.forumer.com/viewtopic.php?f=16&t=25155&hilit=advanced> plugin, but that is too complicated really. Quote CodeLab makes me giddy inside Link to comment Share on other sites More sharing options...
BoltBait Posted December 29, 2009 Share Posted December 29, 2009 I made a plugin that does exactly what you want. Let me see if I can find it. EDIT: Here it is... // Author: BoltBait // URL: http://www.BoltBait.com/pdn // Name: Alpha to Gray // Submenu: Object #region UICode byte Amount1 = 0; // Convert|Alpha to Gray|Gray to Alpha bool Amount2 = false; // [0,1] Invert calculation #endregion private UnaryPixelOps.Desaturate desaturateOp = new UnaryPixelOps.Desaturate(); void Render(Surface dst, Surface src, Rectangle rect) { ColorBgra CurrentPixel; for (int y = rect.Top; y { for (int x = rect.Left; x { CurrentPixel = src[x,y]; switch(Amount1) { case 0: // Alpha to Gray CurrentPixel.R = CurrentPixel.A; CurrentPixel.G = CurrentPixel.A; CurrentPixel.B = CurrentPixel.A; CurrentPixel.A = (byte)255; if (Amount2) { CurrentPixel.R = (byte)(255-CurrentPixel.R); CurrentPixel.G = (byte)(255-CurrentPixel.G); CurrentPixel.B = (byte)(255-CurrentPixel.; } break; case 1: // Gray to Alpha CurrentPixel.A = (byte)(255-(desaturateOp.Apply(CurrentPixel).R)); if (Amount2) { CurrentPixel.A = (byte)(255-CurrentPixel.A); } break; } dst[x,y] = CurrentPixel; } } } Are you familiar with CodeLab? If not, here is the effect DLL: Alpha2Gray.zip Place it into your C:\Program Files\Paint.NET\Effects folder and unzip the file. If you have trouble installing this, post your troubles here: viewtopic.php?f=16&t=2023 By the way, did you know that this type of thing is really easy with pyrochild's Curves+ plugin? There is no need for this plugin if you are proficient with Curves+. 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...
Vermiculus Posted December 31, 2009 Author Share Posted December 31, 2009 CodeLab is awesome! Thanks for taking responsibility for it -- I'm sure I'm not the only one who feels this way And excellent plugin! CodeLab is making me giddy.... O.O Quote CodeLab makes me giddy inside 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.