AsciiPaint (aka Project AsciiPaint)
AsciiPaint is Microsoft Access application written in VBA.
With AsciiPaint you can create drawings using the characters of a font that is installed on your computer by placing the characters on a grid, the canvas, and then add color to your drawing by changing attributes like the forecolor and backcolor of a character.
The AsciiPaint project with source code is now on github.
You can download here a zip archive of the 32bits binaries (compiled Access accde version and 32bits consoul dll) to take a look at AsciiPaint; unzip the contents in a directory anywhere and open the AsciiPaint.accde database with a 32bits installation of Microsoft Office (2016 up).
Enhanced ASCII art
AsciiPaint can be used to produce enhanced ASCII art. AsciiPaint uses a console window created with the Consoul library to support editing and display of the drawings, so it supports additional features that the Consoul library implements, like using the full (displayable) unicode character set of a font and colors from a 32 bits palette, among others.
CConsoleGrid is a class which responsibility is to let the class user see a Consoul VT100 grid as a two dimensional array, and translate between Consoul's VT100 line streams and CConsoleGrid's two dimensional array. CConsoleGrid makes it possible to poke and peek characters and (VT100) attributes with a [line, column] index, copy and paste regions, create another CConsoleGrid from an existing one, save/load (serialize/unserialize) its contents, etc...
CConsoleGrid is at the core of AsciiPaint's capabilities.
CRibbon & CCTabStrip
By combining a Consoul window that displays and support interactivity of a tabstip like UI, and groups of Microsoft Access native controls underneath it, linked to the tab strip tabs, a ribbon like interface is created.
In AsciiPaint the controls that are shown/hidden depending on the active tab, are layed out one ribbon strip under the other in design mode (in the "Canvas" form):
The Canvas form InitForm() method handles a lot of UI initialisation work; for the ribbon, it calls the CreateRibbon() method.
The PositionBandControls() method of the CRibbon class, will iterate the controls on the form and for thos marked with a ribbon index in their .Tag property, e.g. "rbindex=3", and build a list of control references and tab number. The controls are then aligned to a top position given by a strategically named "rectRibRef1" control. In fact, the first ribbon band is already positioned at its final position, "rectRibRef1" being the rectangle around the buttons of this first ribbon.
The other ribbons all have their "rectRibRefN" rectangle, where N is the tab index (meaning the tab number of the embedded tab strip control).
With some dynamic routing in the ICsMouseEventSink interface implementation in the Canvas form that delegates messages of the internal tab control Consoul window, to the CRibbon class, the correct set of control is show/hidden with the corresponding active tab.
Note: CCTabStrip, the first C stands for Class, the second for Consoul, an informal naming scheme that designate code controls using a Consoul window for their UI to to render and interact.
A developer tool
AsciiPaint was born as a Test Driver tool for the Consoul library, and it still is. It implements experimental features and code modules that may not (ie have not) have been fully tested. Handle with care.
VT100 export and inspection
Drawings in AsciiPaint can be saved in different file formats. The native AsciiPaint file format uses the ".ascp" filename extension and is the recomended format to use when saving drawings which you're working on.
When saving in the text formats (with either ".txt", ".asc", ".vt100") AsciiPaint generates (Consoul compatible) VT100 text that may be then reused as needed, probably in other Consoul VT100 aware applications.
The save as a Windows bitmap file ("*.bmp") feature is used to export the drawing in this graphical file format, that can be then easily converted by another application in other formats like jpeg or png.
This feature was integrated in AsciiPaint primarily to test the CSPaintOnDC Consoul API function. The advantage of exporting a drawing via this feature, over using a screenshotting tool, is that the full console image is saved, not only the visible part.
The "debug console" (which visibility can be toggled via the "Developer" ribbon tab) maya be helpful to live inspect the VT100 code that AsciiPaint generates from the canvas contents.
Code generation (VBA/AutoIT)
Code generation is aimed to produce VBA/AutoIT code that generates the drawing with commands that output the VT100 content to a Consoul console window.
The feature is still quite raw at this time and the generated code may need some tweaking, but can be of great service.
The pumpkin sprite in the halloween_demo has actually been drawn in AsciiPaint and the output of the code generator is used to draw the pumpkin on each Consoul window that acts as a sprite. The demo also changes randomly the color of the pumpkin sprites just by changing the rgb value of the pumpkin's forecolor console, where appropriate, in the generated code.
The librarian is an experimental addition to AsciiPaint. The main goal is to be able to build collections of drawings, tag them with properties like author and copyright, and then sign them so they can be shared (or even monetized) according to the terms of their authors.
Another envisioned use for drawings collections, is to prepare animation frames for a future extension or eventually an AsciiAnimate application.
The librarian is still a bit cumbersome and the dll it will use to sign libraries (with certificates) is about half done (written in C, VBA friendly, will open source on github). Watch this page and the AsciiPaint project on github to follow progress on the librarian features.
Not all of the Consoul flavoured VT100 capacities are useable with AsciiPaint, particularly the VT100X_xxx codes.