void cogl2_path_ellipse (CoglPath *path, float center_x, float center_y, float radius_x, float radius_y) { float angle_step = 10; _COGL_RETURN_IF_FAIL (cogl_is_path (path)); /* FIXME: if shows to be slow might be optimized * by mirroring just a quarter of it */ _cogl_path_arc (path, center_x, center_y, radius_x, radius_y, 0, 360, angle_step, 1 /* move first */); cogl2_path_close (path); }
void cogl2_path_fill (CoglPath *path) { _COGL_RETURN_IF_FAIL (cogl_is_path (path)); if (path->data->path_nodes->len == 0) return; /* If the path is a simple rectangle then we can divert to using cogl_rectangle which should be faster because it can go through the journal instead of uploading the geometry just for two triangles */ if (path->data->is_rectangle) { float x_1, y_1, x_2, y_2; _cogl_path_get_bounds (path, &x_1, &y_1, &x_2, &y_2); cogl_rectangle (x_1, y_1, x_2, y_2); } else _cogl_path_fill_nodes (path, 0); }
void cogl2_path_arc (CoglPath *path, float center_x, float center_y, float radius_x, float radius_y, float angle_1, float angle_2) { float angle_step = 10; _COGL_RETURN_IF_FAIL (cogl_is_path (path)); /* it is documented that a move to is needed to create a freestanding * arc */ _cogl_path_arc (path, center_x, center_y, radius_x, radius_y, angle_1, angle_2, angle_step, 0 /* no move */); }
void cogl_path_rel_curve_to (CoglPath *path, float x_1, float y_1, float x_2, float y_2, float x_3, float y_3) { CoglPathData *data; _COGL_RETURN_IF_FAIL (cogl_is_path (path)); data = path->data; cogl_path_curve_to (path, data->path_pen.x + x_1, data->path_pen.y + y_1, data->path_pen.x + x_2, data->path_pen.y + y_2, data->path_pen.x + x_3, data->path_pen.y + y_3); }