Vectorial 2D Path manipulation functions. More...
This section documents the 2D path object used in the GPAC framework.
| typedef struct _path_iterator GF_PathIterator |
The path iterator object is used to compute the length of a given path as well as transformation matrices along this path.
| anonymous enum |
| anonymous enum |
2D Path flags
| anonymous enum |
2D Polygon convexity type
| anonymous enum |
| anonymous enum |
| anonymous enum |
| anonymous enum |
Dash types for outlining
| GF_Path* gf_path_new | ( | ) |
Constructs an empty 2D path object
| void gf_path_del | ( | GF_Path * | gp | ) |
Destructs a 2D path object
| gp | the target path |
| void gf_path_reset | ( | GF_Path * | gp | ) |
Resets the 2D path object
| gp | the target path |
Resets a copy of a 2D path object
| gp | the target path |
Closes current path contour
| gp | the target path |
Starts a new contour from the specified point
| gp | the target path | |
| x | x-coordinate of the new point | |
| y | y-coordinate of the new point |
| GF_Err gf_path_add_move_to_vec | ( | GF_Path * | gp, | |
| GF_Point2D * | pt | |||
| ) |
Starts a new contour from the specified point
| gp | the target path | |
| pt | pointer to the new start point |
Adds a line from the current point in path to the specified point
| gp | the target path | |
| x | x-coordinate of the line end | |
| y | y-coordinate of the line end |
| GF_Err gf_path_add_line_to_vec | ( | GF_Path * | gp, | |
| GF_Point2D * | pt | |||
| ) |
Adds a line from the current point in path to the specified point
| gp | the target path | |
| pt | line end |
| GF_Err gf_path_add_cubic_to | ( | GF_Path * | gp, | |
| Fixed | c1_x, | |||
| Fixed | c1_y, | |||
| Fixed | c2_x, | |||
| Fixed | c2_y, | |||
| Fixed | x, | |||
| Fixed | y | |||
| ) |
Adds a cubic bezier curve to the current contour, starting from the current path point
| gp | the target path | |
| c1_x | x-coordinate of the first control point of the cubic curve | |
| c1_y | y-coordinate of the first control point of the cubic curve | |
| c2_x | x-coordinate of the second control point of the cubic curve | |
| c2_y | y-coordinate of the second control point of the cubic curve | |
| x | x-coordinate of the end point of the cubic curve | |
| y | y-coordinate of the end point of the cubic curve |
| GF_Err gf_path_add_cubic_to_vec | ( | GF_Path * | gp, | |
| GF_Point2D * | c1, | |||
| GF_Point2D * | c2, | |||
| GF_Point2D * | pt | |||
| ) |
Adds a cubic bezier curve to the current contour, starting from the current path point
| gp | the target path | |
| c1 | first control point of the cubic curve | |
| c2 | second control point of the cubic curve | |
| pt | end point of the cubic curve |
Adds a quadratic bezier curve to the current contour, starting from the current path point
| gp | the target path | |
| c_x | x-coordinate of the control point of the quadratic curve | |
| c_y | y-coordinate of the control point of the quadratic curve | |
| x | x-coordinate of the end point of the cubic quadratic | |
| y | y-coordinate of the end point of the cubic quadratic |
| GF_Err gf_path_add_quadratic_to_vec | ( | GF_Path * | gp, | |
| GF_Point2D * | c, | |||
| GF_Point2D * | pt | |||
| ) |
Adds a quadratic bezier curve to the current contour, starting from the current path point
| gp | the target path | |
| c | control point of the quadratic curve | |
| pt | end point of the cubic quadratic |
Adds a rectangle contour to the path
| gp | the target path | |
| cx | x-coordinate of the rectangle center | |
| cy | y-coordinate of the rectangle center | |
| w | width of the rectangle | |
| h | height of the rectangle |
Adds a rectangle contour to the path
| gp | the target path | |
| ox | left-most coordinate of the rectangle | |
| oy | top-most coordinate of the rectangle | |
| w | width of the rectangle | |
| h | height of the rectangle |
Adds an ellipse contour to the path
| gp | the target path | |
| cx | x-coordinate of the ellipse center | |
| cy | y-coordinate of the ellipse center | |
| a_axis | length of the horizontal ellipse axis | |
| b_axis | length of the vertical ellipse axis |
| GF_Err gf_path_add_bezier | ( | GF_Path * | gp, | |
| GF_Point2D * | pts, | |||
| u32 | nb_pts | |||
| ) |
Adds an N-degree bezier curve to the path, starting from the current point
| gp | the target path | |
| pts | points used to define the curve | |
| nb_pts | number of points used to define the curve. The degree of the curve is therefore (nb_pts-1). |
| GF_Err gf_path_add_arc_to | ( | GF_Path * | gp, | |
| Fixed | end_x, | |||
| Fixed | end_y, | |||
| Fixed | fa_x, | |||
| Fixed | fa_y, | |||
| Fixed | fb_x, | |||
| Fixed | fb_y, | |||
| Bool | cw | |||
| ) |
Adds an arc contour to the path from focal and end points.
| gp | the target path | |
| end_x | x-coordinate of the arc end point | |
| end_y | y-coordinate of the arc end point | |
| fa_x | x-coordinate of the arc first focal point | |
| fa_y | y-coordinate of the arc first focal point | |
| fb_x | x-coordinate of the arc second focal point | |
| fb_y | y-coordinate of the arc second focal point | |
| cw | if 1, the arc will be clockwise, otherwise counter-clockwise. |
| GF_Err gf_path_add_svg_arc_to | ( | GF_Path * | gp, | |
| Fixed | end_x, | |||
| Fixed | end_y, | |||
| Fixed | r_x, | |||
| Fixed | r_y, | |||
| Fixed | x_axis_rotation, | |||
| Bool | large_arc_flag, | |||
| Bool | sweep_flag | |||
| ) |
Adds an arc contour to the path from end point, radii and 3 parameters.
| gp | the target path | |
| end_x | x-coordinate of the arc end point | |
| end_y | y-coordinate of the arc end point | |
| r_x | x-axis radius | |
| r_y | y-axis radius | |
| x_axis_rotation | angle for the x-axis | |
| large_arc_flag | large or short arc selection | |
| sweep_flag | if 1, the arc will be clockwise, otherwise counter-clockwise. |
| GF_Err gf_path_add_arc | ( | GF_Path * | gp, | |
| Fixed | radius, | |||
| Fixed | start_angle, | |||
| Fixed | end_angle, | |||
| u32 | close_type | |||
| ) |
Adds an arc contour to the path.
| gp | the target path | |
| radius | radius of the arc | |
| start_angle | start angle of the arc in radians | |
| end_angle | end angle of the arc in radians | |
| close_type | closing type: 0 for open arc, 1 for close arc, 2 for pie |
| GF_Err gf_path_add_subpath | ( | GF_Path * | gp, | |
| GF_Path * | subpath, | |||
| GF_Matrix2D * | mx | |||
| ) |
Adds a sub-path to the path with a given transform.
| gp | the target path | |
| subpath | the path to add | |
| mat | Matrix for subpath |
Gets the path control bounds, i.e. the rectangle covering all lineTo and bezier control points.
| gp | the target path | |
| rc | pointer to rectangle receiving the control rectangle |
Gets the path bounds, i.e. the rectangle covering all points in path except bezier control points.
| gp | the target path | |
| rc | pointer to rectangle receiving the control rectangle |
| void gf_path_flatten | ( | GF_Path * | gp | ) |
Flattens the path, i.e. transform all bezier curves to lines according to the path flatness.
| gp | the target path |
Gets a flatten copy of the path.
| gp | the target path |
Tests if a point is over a path or not, according to the path filling rule.
| gp | the target path | |
| x | x-coordinate of the point to check | |
| y | y-coordinate of the point to check |
| Bool gf_path_is_empty | ( | GF_Path * | gp | ) |
Tests if the path is empty or not.
| gp | the target path |
| GF_PathIterator* gf_path_iterator_new | ( | GF_Path * | gp | ) |
Creates a new path iterator from a given path
| gp | the target path |
| void gf_path_iterator_del | ( | GF_PathIterator * | it | ) |
Destructs the path iterator object
| it | the target path iterator |
| Fixed gf_path_iterator_get_length | ( | GF_PathIterator * | it | ) |
Gets a path length from its iterator
| it | the target path iterator |
| Bool gf_path_iterator_get_transform | ( | GF_PathIterator * | it, | |
| Fixed | offset, | |||
| Bool | follow_tangent, | |||
| GF_Matrix2D * | mat, | |||
| Bool | smooth_edges, | |||
| Fixed | length_after_point | |||
| ) |
Gets the transformation of a given point on the path, given by offset from origin. The transform is so that a local system is translated to the given point, its x-axis tangent to the path and in the same direction. The path direction is from first point to last point of the path.
| it | the target path iterator | |
| offset | length on the path in local system unit | |
| follow_tangent | indicates if transformation shall be computed if offset indicates a point outside the path (<0 or >path_length). In which case the path shall be virtually extended by the tangent at origin (offset <0) or at end (offset>path_length). Otherwise the transformation is not computed and 0 is returned. | |
| mat | matrix to be transformed (transformation shall be appended) - the matrix shall not be initialized | |
| smooth_edges | indicates if discontinuities shall be smoothed. If not set, the rotation angle THETA is the slope (DX/DY) of the current segment found. | |
| length_after_point | if set and smooth_edges is set, the amount of the object that lies on next segment shall be computed according to length_after_point.
Let:
len_last: length of current checked segment
len1: length of all previous segments so that len1 + len_last >= offset then if (offset + length_after_point > len1 + len_last) {
ratio = (len1 + len_last - offset) / length_after_point;
then THETA = ratio * slope(L1) + (1-ratio) * slope(L2)
Of course care must be taken for PI/2 angles and similar situations
|
| u32 gf_polygone2d_get_convexity | ( | GF_Point2D * | pts, | |
| u32 | nb_pts | |||
| ) |
brief gets convexity type for a 2D polygon
Gets the convexity type of the given 2D polygon
| pts | the points of the polygon | |
| nb_pts | number of points in the polygon |
| GF_Path* gf_path_get_outline | ( | GF_Path * | path, | |
| GF_PenSettings | pen | |||
| ) |
brief builds the vectorial outline of a path
Builds the vectorial outline of a path for the given settings. The outline of a path is a path.
| path | the desired path to outline | |
| pen | the properties of the virtual pen used for outlining |
1.6.1