1// Under a shell type: box -l g translucent.box
2// ---
3// Here we show translucent effects on Cairo Windows.
4
5include "g"
6
7w = Window[][
8  BBox[(-20, -18), (20, 22)]
9  c1 = Color[color.red,  .a=0.5], c2 = Color[color.yellow, .a=0.5]
10  c3 = Color[color.blue, .a=0.5], c4 = Color[color.green, .a=0.5]
11  radius = 20.0
12
13  Circle[(-5, -2), 4, c4]                            // One circle (behind)
14  i = 0, delta = 4*const.pi/5, angle0 = const.pi/2   // The star
15  Line[radius*Vec[i*delta + angle0], For[++i < 5]
16       Close[], Border[2, c1, Join["round"]]]
17  Circle[(2, -5), 8, c2]                             // Other two circles
18  Circle[(-1, 1), 6, c3]
19  .Save["translucency.png"
20        Window["rgb24", .Res[Dpi[100]]]]             // Save to PNG
21]
22