Sign in to follow this  
Mike Ryan

Invert Alpha

Recommended Posts

Invert Alpha

A Simple Plugin to Invert the Alpha Channel

Invert Alpha is a simple plugin that inverts your Alpha Channel based off of your set tolerance. This plugin is most useful when dealing with transparency gradients, creating alpha masks, and more. To use this plugin, simply extract the zip file to your Effects folder and restart Paint.NET. Then go to Adjustments-> Invert Alpha. Toying with the tolerance is recommended to discover some more interesting uses for this plugin.

Share this post


Link to post
Share on other sites
Also, I want to give my thanks to Pyrochild for helping me out with this basic plugin.

Don't say that - people will think it's another prank!

Share this post


Link to post
Share on other sites

TrueLove, while it is a basic plugin I would prefer that the source to any or all of my plugins be distributed solely by me. But I am glad that you enjoy using this plugin, and I hope it is a good start for future plugins from me.

Share this post


Link to post
Share on other sites

If that's true, you have a bug in your code. You should use Utility.ClampToByte in there somewhere... :D

Share this post


Link to post
Share on other sites

...?

What bug? Who is buggin around?

Anyways, this plugin is going to be superseded soon with some extra features. It will be entitled 'Alpha Works' and I wish I could confirm some extra features. Until then, good night to you all!

Share this post


Link to post
Share on other sites

Don't know right I'm or not, but this is new Utility.ClampToByte() code:

#region UICode
int Amount1 = 0; // [0,255] Transparensy
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
   PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds);
   ColorBgra CurrentPixel;
   int R, G, B;
   byte A;
   for(int y = rect.Top; y < rect.Bottom; y++)
   {
       for (int x = rect.Left; x < rect.Right; x++)
       {
               CurrentPixel = src[x,y];
               R = (int)CurrentPixel.R;
               G = (int)CurrentPixel.G;
               B = (int)CurrentPixel.B;
               A = (byte)(int)(Amount1 - CurrentPixel.A);
               dst[x,y] = ColorBgra.FromBgra(Utility.ClampToByte(,Utility.ClampToByte(G),Utility.ClampToByte(R),Utility.ClampToByte(A));
       }
   }
}

Share this post


Link to post
Share on other sites
Alright, Alpha Works is finished but not compiled yet. I need Code Lab to start behaving correctly and I will make the big upload.

CodeLab is fine. It's your script... Don't use anything but alphanumeric characters in the .cs file name of your effect. CodeLab uses that filename as your namespace... "namespaces" must be alphanumeric without spaces. I have added a note about this to CodeLab's help file.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this