July 2015
Intermediate to advanced
286 pages
6h 31m
English
These masks were previously compared to images, where each cell is like a pixel that you turn on or off. It might make sense, then, to use actual images for the templates, where pixels of a particular color (say, black) are considered off and everything else is considered on. This would let us design our templates using an image editor, which ought to make larger masks a lot easier.
Let’s implement this. We’re going to create a method that will accept an image in PNG format, so the first thing we’ll need to do is make sure the ChunkyPNG library is loaded. Open up mask.rb again and add the following line at the very top of the file:
| | require 'chunky_png' |
Once we have that, we can add our new method, just like we did for defining ...
Read now
Unlock full access