PatternRadial.sel
#!./Selene
Selene.UseDRMCairo()
card,err,msg = SelDCCard.Open()
if not card then
print("*E*", err,msg)
os.exit()
end
local srf = card:GetPrimarySurface()
local w,h = srf:GetSize() srf:Clear( 0,0,0 )
local pat = SelDCPattern.createCircle(w/2-75,h/2-75,w/2, w/2+50,h/2+50,30)
pat:addFixPoint(0, 1.0, 0.4, 0.4)
pat:addFixPoint(1, 0.4, 1.0, 0.4)
pat:addFixPoint(0.5, 0.4, 0.4, 1.0)
srf:SetSourcePattern(pat)
local r = w/3
if h < w then
r = h/3
end
math.randomseed( os.time() )
srf:DrawArc( w/2, h/2, r, 0, 2*math.pi )
srf:DrawArc( w/2, h/2, r+05, 0, math.pi/2 ) srf:DrawArc( w/2, h/2, r+10, math.pi/2, math.pi ) srf:DrawArc( w/2, h/2, r+15, math.pi, 3*math.pi/2 ) srf:DrawArc( w/2, h/2, r+20, 3*math.pi/2, 2*math.pi )
srf:FillArc( w/2, h/2, r-15, 0, math.pi/2 )
local font = SelDCFont.createInternal("")
srf:SetFont(font, 20)
srf:DrawString("This is a colored test", 15,20)
srf:SetColor(0,1,0)
srf:DrawString("Fixed color text", 15, 40)
pat:Release()
fch,err,msg = srf:Dump("/tmp","Pattern")
if not fch then print("Can't dump", err,msg);
else
print("Dumped to", fch);
end
print "Hit 'enter' key to exit"
io.stdin:read'*l'
srf:Release()
card:Release()