Code for drawing basic 2D primitives on Texture2D

Does anyone have code to draw basic 2D primitives (circles, rectangles, ellipses, lines) with some more “advanced” functions like floodfill or drawing primitives with specific “border” width on Texture2D? I want to do some cool procedural stuff on my texture and so I need those functions (as drawing those pixel by pixel would quickly get messy).

Draw line in texture, draw circle in texture.