setInvertedStencil, when called without arguments, seem to do the same thing.
setStencil could take a second argument which determines whether it is normal or inverted? This would eliminate the redudancy mentioned above, and there'd be one less function.
newStencil doesn't seem to really do anything other than return the function it's given, which seems unnecessary and kind of makes stencils seem like objects. Maybe
newStencil could be removed?