#! lua
-- Example to show use of draw library
local draw = require "draw"

  local rgb in draw

-- colour definitions
  local agate = rgb (0, 128, 128)
  local azure = rgb (0, 200, 200)
  local white = rgb (255, 255, 255)
  local green = rgb (0, 250, 0)
  local navy = rgb (0, 0, 125)
  local crimson = rgb (128, 0, 0)
-- fontsize
  local fontsize = 0x8000
-- coordinates
  local A, B, C = 0x80000, 0x40000, 0x1000

 local oevre = draw.create ( )  -- create draw object
 oevre.font = { "Trinity.Medium" } -- give it a font;
   --  do this before any text definitions

--  define text and path objects
--  the order determines the layer

  local label = oevre:text {
    colour = agate;
    font = 1;
    fontx = fontsize;
    fonty = fontsize;
    }
  local p = oevre:path { fill = azure; outline = green; thickness = 1000; }
  local q = oevre:path { fill = navy; outline = crimson; thickness = 2000; }
  local r = oevre:path { fill = white;}
  local ell = oevre:path { fill = agate; outline = navy; thickness = 3000; }

-- where and what for label
  label (12*C, B/2) "Hello"

-- define the path components
   p:triangle (C, C, A, B)
   p:rectangle(C, B/2, 10*C, 10*C)
   p:END ( )

   q:triangle (A/4, 8*C, 3*A/4, B/2)
   q:END ( )

   r:rectangle (5*A/6, B/4, 10*C, 10*C)
   r:END ( )

   ell:ellipse (2*A/3, 3*B/4, 20*C, 10*C)
   ell:END ( )

-- save as a drawfile and run it
   oevre:save (nil, "run")

