Hello,
Background : I use Lua and Cairo to write some little widgets for Conky on my Linux System (http://u-scripts.blogspot.com/)I've seen this example on how to iterating through a cairo_path_t in C.
I can reproduce it in Python but ... not in Lua.
Here is the sample code from http://www.dynaset.org/dogusanh/luacairo.html in the section cairo_path_data_t :*****
* Here is sample code for iterating through a #cairo_path_t:
*
*
* int i;
* cairo_path_t
*path;
* cairo_path_data_t *data;
*
* path = cairo_copy_path (cr);
*
* for (i=0; i < path->num_data; i += path->data[i].header.length) {
* data = ""> * switch (data->header.type) {
* case CAIRO_PATH_MOVE_TO:
* do_move_to_things (data[1].point.x, data[1].point.y);
* break;
* case
CAIRO_PATH_LINE_TO:
* do_line_to_things (data[1].point.x, data[1].point.y);
* break;
* case CAIRO_PATH_CURVE_TO:
* do_curve_to_things (data[1].point.x, data[1].point.y,
* data[2].point.x, data[2].point.y,
* data[3].point.x,
data[3].point.y);
* break;
* case CAIRO_PATH_CLOSE_PATH:
* do_close_path_things ();
* break;
* }
* }
* cairo_path_destroy (path);
*****
What I've done so far is to retrieve the cairo_path_length with .numdata and cairo_path_data_t with .data :
path=cairo_copy_path(cr)
print ("status,data,num_data",path.status, path.data, path.num_data)
but how to loop through the cairo_path_data_t like in C ??
I
someone can help thanks !!
Wlourf