Paint.Net C# Code.

Today at work I needed a Color Chooser dialog that supported Alpha. The standard Windows Color Picker from Common Controls can’t do that I don’t think.  Hence I decided to have a look at the code in Paint.Net’s color dialog which does.

Outwardly Paint.Net looks well engineered, therefore I went looking at the source. Crikey what a mess. Now I know how hard it is to write and manage a moderately sized code-base with a small team, but I at least try and organize my code well. I also constantly refactor to improve the design & code readability.

Paint.Net Color Picker.

After spending the day trying to adapt Paint.Net’s color picker I ran into some serious performance issues (amongst other things). It seems their gradient widget renderer is very slow for anything other than the tiny little gradients that get rendered in their color picker form. I think someone needs to introduce them to LinearGradientBrush‘s InterpolationColors property and ColorBlend.

I think the coders on Paint.Net probably already know some of their code is pretty dire, considering this comment in ColorsForm.cs.

// TODO: rewrite this … the code is out of control here as it has grown organically,
// and it’s impossible to maintain. post-3.0

Now I’m not trying to pick on the coders responsible for Paint.Net. I’d actually like to thank them, as I use the application regularly and appreciate that the code is MIT licensed. This is what enables me to go rifling through their code in the first place.

But unfortunately for me the Color Picker code is not good enough and is too Paint.Net specific.  I’m going to have to write my own damn fancy color picker.

Advertisements

6 thoughts on “Paint.Net C# Code.

  1. hi. i have much time searching the code of paint.net but i do not find it. Someone me can help to find it please.

    my english not is very good.

    • It seems that the guys who make Paint.Net have removed the source code from download. I found an older version of the source here by doing a little Googleing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s