User Guide
Example: ASCII Art 225
3. The remaining characters of the original word are extracted using substring(1), which
extracts a substring starting at index 1 (the second letter) through the end of the string
(indicated by leaving off the second parameter of the
substring() method).
4. The final word is created by combining the newly capitalized first letter with the remaining
letters using string concatenation:
firstLetter + otherLetters.
Generating the ASCII art text
The BitmapToAsciiConverter class provides the functionality of converting a bitmap image to
its ASCII text representation. This process is performed by the
parseBitmapData() method,
which is partially shown here:
var result:String = "";
// Loop through the rows of pixels top to bottom:
for (var y:uint = 0; y < _data.height; y += verticalResolution)
{
// Within each row, loop through pixels left to right:
for (var x:uint = 0; x < _data.width; x += horizontalResolution)
{
...
// Convert the gray value in the 0-255 range to a value
// in the 0-64 range (since that's the number of "shades of
// gray" in the set of available characters):
index = Math.floor(grayVal / 4);
result += palette.charAt(index);
}
result += "\n";
}
return result;