Update gradient.class.js

Fixed some errors introduced with previous commit.
Added correct alpha channel management.