[Cdlib-users] simple sample
Antonio Scuri
scuri at tecgraf.puc-rio.br
Mon Apr 10 20:32:15 GMT+3 2006
At 18:45 10/4/2006, Pavol Severa wrote:
>can I find somewhere a simple Lua sample that would draw some picture
>and save it say as png? (of course I found your samples that draw to a
>iup window; everybody should be able to move from there - but not me:)
Hi,
To save the image in a file you will need the IM library. To draw
in the image you can use CD.
Here is the code to draw in an image and save it to a file (from
the IM documentation):
local image = im.ImageCreate(500, 500, im.RGB, im.BYTE)
local canvas = image:cdCreateCanvas() -- Creates a CD_IMAGERGB canvas
cd.Activate(canvas)
cd.Clear()
cd.Font(3, 1, 24)
cd.Text(100, 100, "Test")
cd.Line(0,0,100,100)
cd.KillCanvas(canvas)
im.FileImageSave(image, "new.bmp", "BMP")
You can find IM here:
http://www.tecgraf.puc-rio.br/im
Best Regards,
Antonio Scuri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.luaforge.net/pipermail/cdlib-users/attachments/20060410/8d42af01/attachment.html
More information about the cdlib-users
mailing list