GraphicsBuilder Tutorial II: Outlines & Shapes
Now that you now shapes can be stored to be later reused we can put them to work. A recurrent question arose in the comments of the last part of this series: do shapes honor the current clip? the answer is yes they do. The default clip on a GraphicsPanel, the component GraphicsPad uses to display your drawings, is set to the panel's boundaries, but you can set a custom clip if you want, just reuse a shape definition with a clip node.
ellipse( cx: 100, cy: 75, radiusx: 90, radiusy: 40, asShape: yes, id: 'c' )
clip( c )
rect( x:10, y:10, width: 200, height: 120, arcWidth: 40,
arcHeight: 20, arcWidth: 20, borderWidth: 2,
borderColor: 'darkGreen', fill: 'green' )
circle( cx:75, cy:75, radius: 50, borderWidth: 2,
borderColor: 'darkRed', fill: 'red' )
star( cx:150, cy:75, or: 50, ir: 30, borderWidth: 2,
borderColor: 'orange', fill: 'yellow' )
Now you now how to draw shapes and outlines, applying antialiasing options to make your drawings smoother and even reusing shapes and setting custom clips. The next part of this series will show you how to control the color options of borders and fills, and the more versatile and subtle paints and gradients.