The very first Paint.NET v4.0 screenshot!

It’s really not as exciting as it sounds unfortunately ๐Ÿ™‚ I’ve been quiet on the subject for some time, though, and wanted to put out some information.

For a long time I debated whether I should fully refactor Paint.NET, or do it from scratch. I finally decided on the latter, and have finally been able to make some progress. Bear in mind that "from scratch" means that I started with a brand new, empty solution file in Visual Studio. It does not mean I’m throwing out all the current Paint.NET code. There are many places where I will be able to reuse vast amounts of it — rendering kernels, effects, math, algorithms, etc. The entire structure of the program will be different, however. If you demolish your old house to build a new one, you don’t throw out the grand piano in the living room too. It still has plenty of value.

The screenshot above is from a build that so far contains about 12,000 lines of code. This sounds like an exorbitant amount for a few menus and an About dialog, but hear me out. I’m building it using Inversion-of-Control (IoC) and related patterns, which requires a lot of new decisions to be made regarding assembly layout (layering, essentially). I’ve also got a new system for asynchronous programming, separation of UI and logic, separation of "contract" and "implementation" assemblies (this becomes very important when plugins come into play), command routing and handling, etc. Along the way I’m learning more about .NET 3.5 and C# 3.0, and have come across some wickedly cool things that are now possible.

As far as possible, everything is lazy initialized or loaded in Paint.NET v4. To aid this, I have a new asynchronous programming model and exception handling pattern, which I could probably talk about for hours. For example, in the screenshot above, the icons for the menu items are not loaded until you click on the menu — in fact, they are loaded using background threads (the threadpool). The graphics and rich text that populate the About dialog are also loaded from the resource manager service using a background thread. For these specific cases, there are no major performance requirements that necessitate this; however, it’s much easier to solve these simple cases and to establish good patterns for later, than the reverse. I’ve also got an old Pentium 4 that I now have available for baseline performance testing, and it will be interesting to see if I can keep the program as responsive on that system as on my Core 2 Quad — even if rendering kernels take longer to complete, it should still always immediately respond to input. *crosses fingers* (Anyone else get sick of Safari on iPhone not being responsive while loading some web pages? Yeah.)

Also, in the screenshot you may notice that the mouse cursor is resting in the File menu even though the About dialog is open. In Paint.NET 3, all dialogs are modal and you can’t do anything with the rest of the program while one is open. In Paint.NET 4, I’m trying to remove this as much as possible and as far as it makes sense to. For example, why should an update download prevent you from using the rest of the program? Why can’t you switch from image 1 to image 2 while a compute-intensive (aka, "takes a long time") effect is rendering on image 1? Why can’t you interact with the canvas while an effect dialog is open? Or change the selected colors?

Anyway, that’s all for now. I estimate that Paint.NET v4 will be 200,000 lines-of-code when it is done, which places me at about 6% complete.

Advertisements

39 thoughts on “The very first Paint.NET v4.0 screenshot!

  1. Luke Foust says:

    Glad to hear you break the silence. I just want to encourage you to blog as much as possible about your experiences “rewriting” paint.net. It is very interesting both because it is a great application and because the source is available so those of us who are interested can follow along.

  2. Mark Zuber says:

    Lookin good Rick! You need your lazily-loaded Paypal donation icon in that about box tho… It’s never too soon to try to help fund your efforts. ๐Ÿ˜€ Can’t wait to pre-alpha test it…

  3. Steven H says:

    What is the story about source code licencing, I noticed you have some MSFT guys working on the project.

    it would be really cool to see your threadding and exception maangement stuff.

  4. OJ says:

    Dear God NO! Please, don’t add a ribbon ๐Ÿ™‚

    Looking forward the next version. Are you looking to build this all by yourself? Or are you open to outside help?

    Cheers and good luck.

  5. Rick Brewster says:

    Luke – Duly noted ๐Ÿ™‚

    Thomas – No.

    Mark – It’s already in the Help menu, just like in Paint.NET v3 ๐Ÿ™‚

    Steven – Source code license is currently the same as for v3.3x.

    OJ – All myself right now. Once I get to where new features can be added using existing extensibility systems, then I may look “outside” of course.

    James – WinForms. For various reasons, I do not like WPF. In other news, Firefox 3 just crashed while I was trying to access your page, but it recovered and even restored this comment text that I was writing. That’s awesome ๐Ÿ™‚

  6. Timothy Stone says:

    I have a question. Why can’t you get Version 4 of Paint.Net built right into the next version of Windows (Windows 7).

    MSPAINT is very old and outdated and should no longer be shipping with Windows. Paint.Net Version 4.x should ship with Windows 7 and you should be able to update it as needed through windows.

    You work for Microsoft and the latest version of .NET and Windows Presentation Foundation will be shipped with Windows 7. Since Windows 7 needs lots of polish, Paint.Net 4.x should be included on the disk.

  7. Count Flanders says:

    Rick,

    I have been using Paint.NET for a while now. I hope you continue to blog about your progress with version 4. I look forward to reading about how you’re using the latest and greatest from .NET 3.5 and C# 3.0.

    Keep up the excellent work!

    — Count

  8. Hutch says:

    Looks awesome so far – well, doesn’t look awesome, but it sounds great to hear about the progress that has been made. Any ideas what milestone 1 will be?

  9. Rick Brewster says:

    Hutch — Well it won’t be public, that’s for sure ๐Ÿ™‚ But I think, if I remember from my Word file correctly, my first real milestone will be a simple read only image *viewer*. Which still sounds very minimal, but requires a lot of design efforts for the data model, asynchronous rendering system, etc. I’m front-loading a *lot* of what I know will be very important and rather difficult design challenges.

  10. Steve says:

    “… WinForms. For various reasons, I do not like WPF ….”

    I would love to see a blog post on this topic.

    Cheers

  11. T_Lh says:

    Pumped!

    Not quite as cool as the first Paint.NET screenshot ever… ๐Ÿ˜‰

    Now that I’m post-college and using .NET 3.5 and C# 3.0 for a living, what you’re doing is very interesting to me…I think I’ll have to spend some time in the programming section of the forums.

    I’ve even got my supervisor’s blessing to dissect your 3.x source code every other Friday for “training”! ๐Ÿ˜€

  12. Dark says:

    Actually, how this program progresses is what entertain me the most and make it one of my favoriite programs
    so, Thanks for this amazing program

  13. Nidonocu says:

    At least I know I’m not crazy when I spend days writing lines of code and the app still doesn’t actually do anything yet! And of course, About box always comes first. ๐Ÿ™‚

    I also agree with others that I’d love to hear of your adventures as you rewrite. There aren’t many .net developers blogging about actual real code that they are writing and going to ship and since you can’t release the source yet, this would be the next best thing. I’m very interested to hear how you apply some of the techniques you’ve listed and put them in to practice.

    I’m also interested to learn why you aren’t going the WPF route, since it has nice things like command binding and other stuff. I’m guessing its something to do with writing raw graphics to the screen. Though I heard that has been somewhat addressed and improved in the SP1 update. (I remember seeing an interesting tech demo showing an audio visualiser.)

  14. Slackmaster K says:

    I’m looking forward to hearing more on why you don’t like WPF. I’m assuming it’s not because of the extra redistributable download, as you could simply package it… Performance?

  15. James Clarke says:

    Rick.. yes WPF is an acquired taste for sure. The new high performance writable bitmap API and other goodness in .NET 3.5 SP1 might be worth checking out if you haven’t already. My team has been shipping a WPF-based app for a couple of years. We really like the agility it gives us with building/changing/redesigning the UI. There are certainly downsides though.

  16. Keithius says:

    I will be looking forward to more of your posts as you discover new things in working towards 4.0… your posts are always very insightful and interesting – thank you!

  17. RTK says:

    Very nice to see you’re perfecting the new version. Not many people are willing to rewrite things from scratch.
    By the way, will you be releasing other 3.x versions?

  18. RTK says:

    Thank you for the response.
    I just forgot to thank you for this great piece of software.

  19. Olivier says:

    Now you are heading toward V4, have you ever think looking back to all the work you made?
    … and would it be possible to provide the community with a sort of “Paint.NET Museum”, with past releases available to download – at least major versions in source code form?
    I’m sure many of us would be very interested in understanding how such an app can be maintained and can evolve!

    PS: what scm do you use to manage the various branches?

  20. Geert says:

    Maybe a good idea to put a screenshot of the very first version of Paint.Net with the latest: example V3.35?

  21. peterp says:

    .NET Framwork 3.5 SP 1 is out and it can speed up applications very much. Are there any plans to switch to a newer framework than 2.0? Since Vista uses 3.0 ATM and support for older systems (95-2000) has been dropped, this shouldn’t be a problem, should it?

  22. Michael says:

    Sorry If this is the wrong place to put this.

    Is it possible to retrieve the HistoryMementoData that’s been persisted to disk and export as a separate file?

    I want to create something that works like photoshop actions so I can reload a historyStack and use it to perform the same operations on all open documents or even point the thing to a file and get it to perform the same actions many times over.

  23. Rick Brewster says:

    Michael — The HistoryMemento stuff is used for storing undo data. So technically you’d have to undo the whole stack and then serialize the “redo list”. But that won’t really work because most of the time undo/redo data is stored as bitmap deltas, not as descriptive actions (e.g., “draw circle at x,y with radius r”).

  24. Michael says:

    Hmm ok, if descriptive actions aren’t recorded then it will require a bit more effort than I first thought.

    Is it something that maybe planned for a future version? If you were to point me in the right direction I would be happy to add such functionality as it’s one of my most heavily used features in photoshop. Having it in Pdn would be just great.

  25. Irwin Cรฉspedes B says:

    Amazing. One question: Why don’t you use the fluent GUI (the same of MS Office 2007)? It’s just an idea. Anyway, thanks for this piece of art written to help the users. Thanks

  26. Rahul says:

    Eagerly waiting for paint.net 4…. Hope The quality is maintained as the present versions and about reliability.. paint.net is awsome…

  27. Irwin Cรฉspedes B says:

    Sorry, I’m not a programmer. However thanks for the explanation. Thanks again! ๐Ÿ™‚

Comments are closed.