<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div>Hello,</div><div><br></div><div><br></div><div>Is it possible to use LuaCairo with wxLua. I've seen CairoPad but I can't get it works on my computer (Debian Squeeze). <br></div><div><br></div><div>What sould I change to this code to display the cairo context on the screen :</div><div><br></div><div><br></div><div><br></div><div>package.cpath = package.cpath..";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;"<br><br>require("wx")<br>local Cairo = require("lcairo")<br><br>mainWin = wx.wxFrame(wx.NULL, -1,"Hello Shao",wx.wxPoint(100,100),wx.wxSize(500,500))<br> <br>function OnPaint(event)<br> local dc = wx.wxPaintDC(mainWin) <br> local cs =
Cairo.image_surface_create(Cairo.FORMAT_ARGB32, 250,250)<br> print ("cs",cs)<br> --doesn't work<br> --local cr = Cairo.CreateContext(wx.get_drawable(dc)) --HACK! <br> local cr = Cairo.Context(cs)<br> print ("cr", cr)<br> <br> cr:push_group_with_content(Cairo.CONTENT_COLOR)<br> cr:set_source_rgb (0, 0, 1)<br> cr:paint ()<br> cr:set_source_rgba(0,1,0,1)<br> cr:rectangle(0, 0, 100, 100)<br> cr:fill()<br>
cr:pop_group_to_source()<br> Cairo.surface_write_to_png(cs,"/tmp/test.png") -->ok if not push/pop group<br> dc:DrawRectangle(100,100,100,100) -->ok<br> dc:delete()<br><br>end<br> <br>mainWin:Connect(wx.wxEVT_PAINT, OnPaint)<br> <br>mainWin:Show(true)<br>wx.wxGetApp():MainLoop()</div><div><br></div><div><br></div><div>Thanks in advance<br></div><div><br></div><div>PS : Hakki, if you read me, why your Hack wx.get_drawable(dc) doesn't work ?</div><div><br></div><div><br></div></div></body></html>