Processing
Warp 10 includes a large subset of the Processing drawing library. You can create and manipulate images, then push a base64 encoded png onto the stack.
- Step 1: create a processing graphic object with
PGraphics
function.
- Step 2: manipulate this object with Processing functions.
- Step 3: render the processing graphic with
Pencode
function.
To view the results, you can use VSCode plugin for WarpScript.
//simple example
200 150 '2D3' PGraphics //new image instance, 200x150 pixels
0xffffff6c Pbackground //yellow background
3 PstrokeWeight //stroke width 3pixels
0xff0000ff Pstroke //blue stroke (ARGB color)
0x7fff0000 Pfill //semi transparent red fill
10 30 100 50 Prect //draw a rectangle, left corner 10 30, size 100 50
20 PtextSize //set text size to 20pt
0xffff0000 Pfill //red fill
"Hello Warp 10" 10 100 Ptext //text, bottom left at 10 100.
Pencode //render the image in a base64 format on the stack