Separated CGImage generation into a class method that can be used externally

I did this so I could use the gradient image in a normal NSView.