Translucent colors through Cairo


It is highly recommended to compile Box with Cairo support. You’ll then be able to use translucent colors, color gradients and many others useful features. To run this example you will need the following file(s): ./ If the example requires more than one file, then you should put them into the same directory. You can then launch Box with box -l g ./

// Under a shell type: box -l g
// ---
// Here we show translucent effects on Cairo Windows.

include "g"

w = Window[][
  BBox[(-20, -18), (20, 22)]
  c1 = Color[,  .a=0.5], c2 = Color[color.yellow, .a=0.5]
  c3 = Color[, .a=0.5], c4 = Color[, .a=0.5]
  radius = 20.0

  Circle[(-5, -2), 4, c4]                            // One circle (behind)
  i = 0, delta = 4*const.pi/5, angle0 = const.pi/2   // The star
  Line[radius*Vec[i*delta + angle0], For[++i < 5]
       Close[], Border[2, c1, Join["round"]]]
  Circle[(2, -5), 8, c2]                             // Other two circles
  Circle[(-1, 1), 6, c3]

       Window["rgb24", .Res[Dpi[100]]]]              // Save to PNG

Table Of Contents

This Page

Get The figure description language: Box at Fast, secure and Free Open Source software downloads