Linear Gradient with Angle & Strength

I want implement one function that given in input width and height of a picture, 2 colors, angle and strength it returns one picture with the background calculate with non linear gradient, the following link shows an example of output picture:

Linear Gradient

Another example, angle: 45°, red and green:

Xojo’s example give me only vertical and horizzontal gradient but I need the angle and the strength of the gradient.
Someone can help me please?

Thank you very much.