My February project for 2017 is CmdArt. I had previously discussed my ConsoleImage library. It was a little library which allows you to post an image in a DOS command window. Due to the limitations of the platform we have to get creative about how we render the images and make them look as nice as possible (which still isn’t very nice, but better than an grey-on-black window).
The ConsoleImage library I originally posted about contained this image rendering algorithm and some basic methods for invoking it and putting the results into the console. Using this as a starting point I got a little bit more ambitious. I started working on a bigger library which contained a number of rendering and drawing primitives for the console. Then I moved on to layering and compositing. Then I started working on interactive controls like drop-downs, select lists, radio buttons, and text boxes. And then…I realized it was all a bit of a mess and a total waste of time. The DOS console wasn’t the place for all this. If people want a UI, they can throw one together in VisualStudio in a few minutes. Jumping through a bunch of hoops to produce a UI in DOS which is much less functional and attractive isn’t a good use of anybody’s time. Nobody needs a comprehensive, inversion-of-control UI framework for developing DOS programs. It’s far too much tooling for such a simple environment.
DOS is for little utilities, batch processing, and programs that you start before you go to lunch and come back to see a bunch of log output. It’s not as functional as the Linux terminal and frankly people just don’t use it in the same way. I’m not sure people would use it the same if they could. Hell, Windows has Powershell now, which isn’t quite iterm2 but it is a nice step up from DOS (I’m not sure if Powershell is any more suitable for artwork, though I suspect it isn’t).
The use-case I am imagining is that somebody already has a little console program, and they want to display some colorful ASCII art in there as a nice little bit of artistic flair, or include a down-resolution logo, or put up a big colorful warning when something goes wrong, or include some little joke or easter egg. This is for a little extra in an existing program and not a major productivity tool.
I went back to the beginning. I created a little double-buffering system for efficient screen updates (screen operations are unexpectedly expensive, so minimizing those can increase performance significantly), I created some basic primitives for working with screen regions and windowing, and some abstractions to give a little bit of implementation flexibility, which I’ve mostly used to faciliate unit testing. On top of this I dumped my Image rendering algorithms. It’s not a fancy library and it certainly won’t be the most popular download on Nuget.org, but I think it can be a nice little addition when you’re writing a console program and want to provide a little flair for your users.
The core of the library is available on nuget and is completely usable. There are a handful of features I want to add to it for specific use-cases, but for the most part I want to declare this “Mission Complete” and walk away from it before I waste any more of my time on it.