[ANN] rewritten cairo binding and API
Good news everyone,
There's a new cairo binding and API available which is more complete and more compressed (fewer functions), and now it has a full API table with individual links to cairo's documentation for every function, and there's also a unit test file for the binding.
Ah, I forgot about that one. Updated, thanks.
Btw, you should probably be using nw instead of cplayer. Don't mind the "work in progress" status, the API is pretty stable, just not complete.
cplayer is just for making graphics/interactivity demos for the various libs that deal with graphics, but it only works on Windows. I plan to re-implement it on top of nw in order to make the demos cross-platform and its API will probably change a bit in the process.
well, still have very little time actually for Lua, so just looking here and there and trying few things, so cplayer was okay for a few tests.
by the way there are also some points that should be corrected on the nw example.
the keydown function isn't working like that and there's also the cr:rgb change..
here are the simple changes I made to make it work, but I get back to the same way as the click function :
if key == 'F11' then
self:fullscreen(not self:fullscreen()) --toggle fullscreen state
function win:repaint() --called when window needs repainting
local bmp = win:bitmap() --get the window's bitmap
local cr = bmp:cairo() --get a cairo drawing context
cr:rgb(0, 1, 0) --make it green
is there a way to show code on the forum ?
Thanks for the heads up. I guess I forgot to grep for set_source_rgb in doc files.
You say there's also a problem with keydown in the example. What is it?
it doesn't work like it is, I got this error :
C:\dev\luapower\tests\tst1-nw.lua:22: <name> or '...' expected near ''keydown''
if I replace it the way I did it's ok, but so it's not the 'another way' you wanted to show in this code exemple.
I see. Corrected.
sorry if I missed something, but it still doesn't work....
well the program is not crashing this time and all is ok, except that hitting F11 does nothing.
was ok with the "function win:keydown(key)" change.
sorry, fixed :)
yep, ok for F11 like that, thanks..
I forget about the last thing, if you look at my code, I change the line 'local cr = bitmap:cairo()' into 'local cr = bmp:cairo()' without doing that, it's still crashing.
Thanks again Fred. This is a lesson for me to never write code off the top of my head and not running it first.