See: Description
Class | Description |
---|---|
Chr |
The
Chr class encapsulates a single character (intended for
display within a TextRegion) and all its attributes (the on-screen position
is not included because it is managed independently by the TextRegion class). |
Chr.Cmd |
The Chr.Cmd class provides a subset of the TextRegion.Cmd class's static
constants that are supported by the "randolf.fx.textmode.Chr" class.
While the constants hold the same values as those by the same names in the
TextRegion.Cmd class, it's important to note that the Chr class is specific
in its scope that focuses only on static attributes such as the foreground
and background colours, effects (e.g., underline, bold, etc.), and so on.
|
TextRegion |
The
TextRegion class is a high-performance pixel-perfect VGA
text mode JavaFX Region that provides threadsafe text manipulation
functions (which most JavaFX classes don't normally provide), and behaves,
by default, like a real 25-row 80-column text mode screen that was commonly
used in Unix and DOS (Disk Operating System) computing environments in the
late 1970s, 1980s, and early-to-mid 1990s. The use of AVATAR and ANSI
code sequences is supported by the various print() methods, and have been
tested with a fairly broad variety of AVATAR and ANSI art that was used by
many BBS (Bulletin Board System) operators to enhance the user interface
for their end-users (mainly to add colour and occasional animations to what
was traditionally a plain, single-colour, text-only communications medium). |
TextRegion.Cmd |
The TextRegion.Cmd class provides the complete set of static constants that
are supported by the "randolf.fx.textmode" package.
|
TextRegion is a high-performance pixel-perfect JavaFX text-mode region that accurately resembles the look-and-feel of Unix and DOS screens that were popular in the 1980s. In particular, the font's appearance has been accurately re-created, the cursor's behaviour has been implemented with the utmost attention to function and timing, and has support for both AVATAR (AVT/0+) and ANSI code sequences. New features are also introduced to modernize this extensive implementation of text mode, such as support for full RGB colour support with transparency (RGBA).
Acronyms used throughout this document |
|
The thread-safe design of TextRegion makes it possible for multiple threads to update it simultaneously because all commands and text output sent to it are queued to ensure atomic operations occur in the order in which they were injected. Further to that, Transactions are also supported which make it easy to arrange an assortment of commands and text output before committing the transaction for injection into the TextRegion without losing its place in the queue.
Perceptions
When people see a text mode screen, such as that presented by TextRegion, they often assume that they're using a DOS application. This is due to the fact that a text mode interface was used by the vast majority of DOS applications.
However, "text mode" is not equivilant to "DOS" and there are also many non-DOS applications that utilize text mode (such as the FAR Manager at http://www.farmanager.com/, which we assume was inspired by the Norton Commander, an advanced and famously popular file management system for DOS that was an essential tool for many computer users).
Capabilities
Extended ASCII is supported. Unicode, UTF-8, etc., is not at this time (but provisions have been included in the internal design to simplify adding support for it in the future), so if you need to support other languages that aren't possible with the standard Extended ASCII character set, then TextRegion probably won't satisfy your requirements (if there is sufficient demand and support for it, and free fonts are available for inclusion, I am interested in updating this class accordingly).
For ASCII art, ASCII games, text-mode interfaces, etc., TextRegion is very well-suited. TextRegion also supports blinking and underlining attributes, and custom (RGB) colours with transparency support (RGBA), for which more details are available in the "Features" section (below).
Text output is designed to be handled in the most efficient manner. All queued command sets that alter attributes, write to the TextRegion, etc., are processed on the secret JavaFX background thread as they become ready. Also, the use of primitive data types eliminates unnecessary memory and processor overhead incurred by the Object-wrapped variants of these types, which is particularly important for loops that draw characters, pixel-by-pixel, and manipulate groups of screen memory for scrolling and other such operations.
History
Some of the main reasons that text-mode applications disappeared, which were primarily architectural challenges imposed by DOS, included a variety of limitations:
The most notable aspect was the popularization of the GUI (Graphical User Interface), but not so much for reasons of practicality (because support for it required more powerful hardware) or because it looked attractive (in fact it tended to look very ugly and unfriendly with all the single-colour pixel patterns and shades of grey, and the small assortment of icons that were built with {at the time} limited numbers of colours, that all resided on top of bland colour schemes that were set up by default on the majority of the GUI-centric Operating Systems {after colours were introduced in the later versions}), but because it was well marketed to software developers and users in a way that emphasized that it was where the future of computing was headed.
This over-emphasis by marketers turned out to be a great success for the GUI, and although it, for the most-part, ended text-mode development, most of the ASCII art and ANSI art enthusiasts weren't discouraged and all the hardware manufacturers continue to support it to this day not only because there is so much software that still needs it (such as the BIOS interface), but also because it's so simple to implement. Text mode is extremely useful, and even Apple is finding that they can no longer continue to avoid it (they were the only vendor I'm aware of who manufactured computer hardware that had absolutely no text mode support {it started in graphics mode first, immediately after the power was switched on, displaying Apple's famous MacOS logo, icons, etc., prior to booting the Operating System}, until within the first decade after the turn of the century; c. year 2000).
Evolution - 1st generation text mode
The first generation of text mode was very simple, and was compatible with line printers (a.k.a., basic dot matrix printers), and later evolved to what I refer to as "second-generation text mode."
Functional control characters that could move the cursor's position (the most common provided tabulation, home position, and line feed support), clearing the screen, implementing the BackSpace key's function, etc., were essential aspects of the basic text-mode interface.
Some vendors ventured forth with a few additions that eventually became common-place on most platforms as well, most notably Unix, but those basic few mentioned in the previous paragraph were the only ones that were supported with actual consistency.
Evolution - 2nd generation text mode
The second generation introduced underlining, high-intensity (bold), and blinking effects, which were initially popular on monochrome (no colour) displays and various types of mainframe terminals. Some manufacturers made some significant enhancements to the feature-set, most notably IBM who added a 26th row to the bottom of the screen to display a small variety of some really nice looking non-standard characters to indicate the status for various actions/activities (note that TextRegion has built-in support for more than 256 characters, so this feature can be supported eventually).
The second generation also introduced 16 colours, with a background colour that could be set independently from the character colour. This, combined with the Extended ASCII characters, turned out to be a wonderful feature for ASCII art creators who wanted to use colours. With this colour came those who then wanted to take ASCII art into the 8-bit realm, and thus ANSI art was born due to the ubiquitous deployment of ANSI among users of BBSs (Bulletin Board Systems), which were the mainstream electronic communications medium to the introduction of the internet to the general public in the 1990s.
Unix environments contributed tremendously to text mode and were especially notable for the flexible screen sizing capabilities, some of which was made available to DOS users later on. Certain video card manufacturers, such as ATi, also pioneered support for some exotic text mode screen sizes that included hundreds of rows and columns (albeit with very small fonts) that also yielded better performance than using graphics mode to accomplish the same screen output (the newer high-performance video cards that were produced less than a decade later completely overcame this graphics mode performance challenge due to the inclusion of graphics card processors for which even later generations were referred to as GPUs, which is a variant of the acronym "CPU").
Evolution - 3nd generation text mode
Thanks to Java, the aforementioned limits are also not a hinderance, so the potential future of feature-rich text-mode applications and games is very promising. TextRegion takes text-mode screen technology to a new level with features like per-character transparency (Unix is known for providing a uniform transparency level only) which greatly simplifies the creation of "viewports" that reveal portions of background graphics (this could be used in text-mode platform game development with a background that scrolls or changes in other ways). In a future version I would like to expand TextRegion's support for more than 256 characters with an easy means of drawing custom characters on-the-fly.
The features introduced by TextRegion (documented below) evolves text mode into its 3rd generation of progress. Aside from per-character transparency and support for characters beyond the 8-bit realm, there is also multi-processor/thread and database-like transaction support that make it a very capable JavaFX Region Node.
Features
My hope, with these new features, is that a blizzard of new text-mode games that utilize TextRegion will increasily become available. I would love to recieve a letter or an eMail about any text-mode games (or applications of any type) that use TextRegion so that I many link to it from some of my web sites. In particular, I'd love to promote any educational games and applications.
I would also like to see interest from hardware manufacturers wanting to support this implementation of text-mode with the new features I've added, natively with their video cards. Whether they implement it with an embedded JVM (this is likely the best and easiest approach because it will require far less programming and can be updated easily), or directly in hardware (I can even help with implementation design and testing).
This is a specialized font used to implement text mode because Java doesn't support using any of the text modes natively supported by nearly all video hardware when specifying a custom graphics mode, and store it internally in the form of arrays of points to be drawn on the screen (this results in a small savings in memory, and uses fewer CPU cycles to draw characters than a typical TrueType Font).
The standard Extended ASCII (or "8-bit ASCII") character values range from 0 through 255. These "Extended" characters (values above 127) are essential to good user-friendly text-mode interface designs because they include, in particular, mathematical symbols and line-drawing characters (plus some language-specific letters with accents, umluts, etc.) that aid in presenting information to the user in a manner that's easier for audiences to understand.
Two specific commands for disabling and enabling the cursor are also provided. Since the implementation of this feature was different on early text-mode computers, many of which didn't have this feautre at all (so the work-around was to change the size of the cursor to make it invisible, although this was also problematic because rules for setting the cursor size were also inconsistent due to competing vendors interpreting these numbers differently).
Additionally, colours may be specified by providing RGB (or RGBA) colour values. This feature, which is not supported by the standard older first-evolution and second-evolution text modes, is unique to TextRegion.
Normally there are only 8 possible background colours unless a special flag is set to extend this to 16 (this flag was primarily intended to disable blinking text). TextRegion supports all 16 background colours without the need to set a special flag.
Additionally, colours may be specified by providing RGB (or RGBA) colour values. This feature, which is not supported by the standard older first-evolution and second-evolution text modes, is unique to TextRegion.
For more detailed control over transparency, which is provided with advanced alpha-blending techniques, TextRegion supports the use of custom RGBA colours for backround and/or foreground colours, which makes it possible to appear partially blended with whatever is in the background.
The flashing cursor always incorporates the alpha-blending setting of the character it obscures.
Additionally, colours may be specified by providing RGB (or RGBA) colour values. This feature, which is not supported by the standard older first-evolution and second-evolution text modes, is unique to TextRegion.
In text mode, all characters that blink do so at precisely the same moment, and at a rate that [hopefully] isn't bothersome. Much effort was expended to ensure that TextRegion simulates this effect well, and so the speed of the blinking was chosen with great care.
This feature was available on monochrome displays because certain colours indicated when text should appear underlined (this approach was a good one because colours were differentiated in a useful way; this is also the reason some DOS applications prompted the user as to whether they were using a colour display {a different colour scheme would be used for non-colour displays to prevent underlining from being displayed inappropriately}).
Although underlining was only really available on monocrhome displays, TextRegion supports this feature without compromising colour selection options.
This feature, which is not supported by the standard older first-evolution and second-evolution text modes, is unique to TextRegion.
The transparency features for backgrounds make it easy to display ASCII text within your applications, without interfering with the style and background behind it. One example of such an application is a hexadecimal file editor that shows all the binary characters on one side of the screen using a TextRegion object that doesn't need to obscure any characters by a period (as most editors that support hexadecimal editing mode normally do).
A low-overhead thread-safe queing system is used to ensure that every aspect of screen I/O is processed in the intended order, and without conflict or unneccesary complexity. This simplifies the reliable, high-performance implementation of a feature-rich command-set, which leads to greater flexibility for multi-threaded application development.
Transactions are a very useful concept that has a proven track record due to heavy use in enterprise-class SQL servers such as PostgreSQL and Oracle. The TextRegion transactions start with the begin() method call, and are ended with either the commit() or rollback() method calls, similarly to SQL transactions.
Any number of transactions are permitted within any transaction, but do note that nothing will appear on the screen until the root (first/initial) transaction in the hierarchy is finally committed.
A transaction is written to the screen when commit() is called, and not when the transaction was started, unless the point in time when the transaction was started is still in the queue (then the transaction will appear to have been inserted at that point instead). The commitNow() method will always add the transaction to the end of the queue regardless of whether its starting point is still in the queue (effectively moving the transaction to the end, like the "end of the line" in a bank).