You are not logged in.
Hi all
may be sombody know how to pass cairo surface to widget in awesome 3.5?
I did:
cairo= wibox.widget.imagebox()
cs = Cairo.image_surface_create("argb32", 50, 14)
cr = Cairo.context_create(cs)
cr:new_path()
cr:move_to(10, 10)
cr:line_to(40, 0)
cr:set_source_rgb(0, 0, 0)
cr:set_line_width(3)
cr:stroke()
img = capi.image.argb32(50, 14, cs:get_data()) --don't work (old way)
cs:write_to_png("/tmp/simple-example.png") -- work
cairo:draw(wibox,cr, 50,14) --don't work
thanks
Last edited by anur (2013-02-16 18:21:30)
Offline
Hi anur,
it seems that you are using the "old way" for awesome v < 3.5 which was to create an image widget, create an image with cairo and update the widget image with the generated cairo context.
For awesome WM 3.5 you have to create a new widget with: wibox.widget.base.make_widget() and create a draw function for this widget where you set the cairo instructions
see here for the basics:
http://awesome.naquadah.org/wiki/Writing_own_widgets
If you want to include this in a more advanced way, you should create an object in a module. I have written a "template" for this see:
https://github.com/cedlemo/blingbling/b … mplate.lua.
Even if it 's not a functionnal example, it can give you an overview on how to write your own widget that you can fill with vicious for example.
Have a looks to the code of my graphicals widgets, it could help you too ( line_graph, progress_bar ...):
https://github.com/cedlemo/blingbling.
One of my best source of informations are of course:
/usr/share/awesome/lib/awful/widget/graph.lua
/usr/share/awesome/lib/awful/widget/progressbar.lua
Offline
O, thanks! your points to read are excellent. Thanks. I solved my small issue.
Offline
Phasme,
Thanks again, may be you know why while drawing with cairo I got flustarting line between drawings
Color of these lines are different.
Thnaks
Offline
flustarting line between drawings
Do you mean "frustrating"?
Since this seems unrelated to your original post, it would be good to start a new thread.
Offline