July 2015
Intermediate to advanced
286 pages
6h 31m
English
ASCII art is undeniably functional, but not necessarily attractive. Often, we want our products to have a bit more polish. Fortunately, APIs are available for most languages for either drawing directly to a view, or (at the very least) rendering to an offscreen canvas and saving it as an image file. We’ll explore the latter of those techniques with a Ruby library called ChunkyPNG,[7] which will let us write our mazes as PNG images. (The concepts should translate readily to other UI and graphics APIs.)
If you’re following along in Ruby, you’ll need to install ChunkyPNG to get the code that follows to work. Fortunately, it’s not hard:
| | $ gem install chunky_png |
Now, then.
Just as we used the to_s method to render ...
Read now
Unlock full access