Multiple stop gradients on a rectangle

Hello,

I have an question regarding what the best way is to draw a multiple stop gradient on a simple rectangle.

The rectangle would be like a panel, which can have different type of brushes (Solid, Image or gradient). Got the first 2 working nicely, now how would a do the last one.
The 4 points are stored in a list. Would I have to generate an internal texture to do this ?

Can somebody please point me in the right direction.

Thanks a lot in advance

well there are basically two ways of doing this, one is the texture as you mentioned and the other is subdividing that rectangle in multiple sections so that you have two or more vertics for each color in the gradient.

Thanks, i’ll have a try.