-- lua-logo.lua

RESOLUTION=512

z = BEGIN (arg[1].."_pdf")


z:set_info("Creator", "lua-logo.lua")
z:set_info("Author", "Luiz Henrique de Figueiredo")
z:set_info("Title", "Lua logo")

z:begin_page(RESOLUTION, RESOLUTION)

z:translate(RESOLUTION/2, RESOLUTION/2)
z:scale(RESOLUTION/2/sqrt(2), RESOLUTION/2/sqrt(2))

-- planet
z:setcolor("both", "rgb", 0, 0, 0.5, 0)
z:circle(0, 0, 1)
z:fill()

-- hole
r=1-sqrt(2)/2
z:setcolor("both", "rgb", 1, 1, 1, 0)
z:circle(1-2*r, 1-2*r, r)
z:fill()

-- moon
z:setcolor("both", "rgb", 0, 0, 0.5, 0)
z:circle(1, 1, r)
z:fill()

-- logo
font = z:findfont("Helvetica", "host", 0)
z:setfont(font, 0.6)
x=z:stringwidth("Lua", font, 0.6)
z:setcolor("both", "rgb", 1, 1, 1, 0)
z:show_xy("Lua", -x/2, -0.5)
z:setcolor("both","rgb",0,1,0,0)
z:setfont(font, 0.2)
z:continue_text("Hi Nicholas")

-- orbit
z:setlinewidth(0.03)
x=(1+r)*(PI/180*5)
z:setdash(x,x)
z:setcolor("both", "gray", 0.5, 0, 0, 0)
z:arcn(0, 0, 1+r, 32, 57)
z:stroke()

z:END()
