Picasso API  2.2
Typedefs | Enumerations | Functions
Path
Graphic Functions

Typedefs

typedef enum _ps_path_cmd ps_path_cmd
 Path command for vertices.
typedef enum _ps_path_op ps_path_operation
 Path clipping operations.

Enumerations

enum  _ps_path_cmd {
  PATH_CMD_STOP = 0, PATH_CMD_MOVE_TO = 1, PATH_CMD_LINE_TO = 2, PATH_CMD_CURVE3 = 3,
  PATH_CMD_CURVE4 = 4, PATH_CMD_END_POLY = 0x0F
}
 Path command for vertices. More...
enum  _ps_path_op { PATH_OP_UNION, PATH_OP_INTERSECT, PATH_OP_XOR, PATH_OP_DIFF }
 Path clipping operations. More...

Functions

PEXPORT ps_path *PICAPI ps_path_create (void)
 Create a new empty path object.
PEXPORT ps_path *PICAPI ps_path_create_copy (const ps_path *path)
 Create a copy from an existing path object.
PEXPORT ps_path *PICAPI ps_path_ref (ps_path *path)
 Increases the reference count of the path by 1.
PEXPORT void PICAPI ps_path_unref (ps_path *path)
 Decrements the reference count for the path object. If the reference count on the path falls to 0, the path is freed.
PEXPORT void PICAPI ps_path_move_to (ps_path *path, const ps_point *point)
 Begin a new sub path, and set the current point in the path.
PEXPORT void PICAPI ps_path_line_to (ps_path *path, const ps_point *point)
 Add a line to the path from the current point to given point.
PEXPORT void PICAPI ps_path_tangent_arc_to (ps_path *path, float radius, const ps_point *tp, const ps_point *ep)
 Add an arc to the path which tangent at two line.
PEXPORT void PICAPI ps_path_arc_to (ps_path *path, float radiusX, float radiusY, float angle, ps_bool large_arc, ps_bool clockwise, const ps_point *ep)
 Add an arc to the path, using radius, angle and end point.
PEXPORT void PICAPI ps_path_bezier_to (ps_path *path, const ps_point *fcp, const ps_point *scp, const ps_point *ep)
 Add a cubic bezier spline to the path from current point to end point.
PEXPORT void PICAPI ps_path_quad_to (ps_path *path, const ps_point *cp, const ps_point *ep)
 Add a quadratic bezier spline to the path from current point to end point.
PEXPORT void PICAPI ps_path_sub_close (ps_path *path)
 Close the sub path, and begin a new one.
PEXPORT float PICAPI ps_path_get_length (const ps_path *path)
 Return The length of the path.
PEXPORT void PICAPI ps_path_clear (ps_path *path)
 Clear the path to empty.
PEXPORT ps_bool PICAPI ps_path_is_empty (const ps_path *path)
 Checks whether the path is empty.
PEXPORT unsigned int PICAPI ps_path_get_vertex_count (const ps_path *path)
 Return the count of vertices in the path.
PEXPORT ps_path_cmd PICAPI ps_path_get_vertex (const ps_path *path, unsigned int index, ps_point *point)
 Get a vertex from the path by index, and return the vertex command.
PEXPORT ps_bool PICAPI ps_path_bounding_rect (const ps_path *path, ps_rect *rect)
 Get the bounding rectangle of the path.
PEXPORT ps_bool PICAPI ps_path_contains (const ps_path *path, const ps_point *point, ps_fill_rule rule)
 Check whether a point is contained in the path by fill method.
PEXPORT ps_bool PICAPI ps_path_stroke_contains (const ps_path *path, const ps_point *point, float width)
 Check whether a point is contained in the path by stroke method.
PEXPORT void PICAPI ps_path_add_line (ps_path *path, const ps_point *p1, const ps_point *p2)
 Add a line to the path.
PEXPORT void PICAPI ps_path_add_arc (ps_path *path, const ps_point *cp, float radius, float sangle, float eangle, ps_bool clockwise)
 Add a arc to the path.
PEXPORT void PICAPI ps_path_add_rect (ps_path *path, const ps_rect *rect)
 Add a rectangle to the path.
PEXPORT void PICAPI ps_path_add_ellipse (ps_path *path, const ps_rect *rect)
 Add an ellipse to the path.
PEXPORT void PICAPI ps_path_add_rounded_rect (ps_path *path, const ps_rect *rect, float ltx, float lty, float rtx, float rty, float lbx, float lby, float rbx, float rby)
 Add a rounded rectangle to the path.
PEXPORT void PICAPI ps_path_add_sub_path (ps_path *path, const ps_path *spath)
 Add an sub path to the path.
PEXPORT void PICAPI ps_path_clipping (ps_path *result, ps_path_operation op, const ps_path *a, const ps_path *b)
 Clipping two path with the operation and get the result path.

Enumeration Type Documentation

Path command for vertices.

Enumerator:
PATH_CMD_STOP 

Stop command.

PATH_CMD_MOVE_TO 

Move to command.

PATH_CMD_LINE_TO 

Line to command.

PATH_CMD_CURVE3 

Quad curve to command.

PATH_CMD_CURVE4 

Bezier curve to command.

PATH_CMD_END_POLY 

End polyline command.

Definition at line 3321 of file picasso.h.

Path clipping operations.

Enumerator:
PATH_OP_UNION 

Union.

PATH_OP_INTERSECT 

Intersection.

PATH_OP_XOR 

Exclusive or.

PATH_OP_DIFF 

Difference.

Definition at line 3497 of file picasso.h.


Function Documentation

void ps_path_add_arc ( ps_path path,
const ps_point cp,
float  radius,
float  sangle,
float  eangle,
ps_bool  clockwise 
)

Add a arc to the path.

Parameters:
pathPointer to an existing path object.
cpThe center point of the arc.
radiusThe radius of the arc.
sangleThe start angle, in radians.
eangleThe end angle, in radians.
clockwiseTrue is clockwise, False is counter clockwise.
See also:
ps_path_add_line, ps_path_add_rect, ps_path_add_ellipse, ps_path_add_rounded_rect, ps_path_add_sub_path
void ps_path_add_ellipse ( ps_path path,
const ps_rect rect 
)

Add an ellipse to the path.

Parameters:
pathPointer to an existing path object.
rectThe rectangle to enclose the ellipse.
See also:
ps_path_add_arc, ps_path_add_line, ps_path_add_rect, ps_path_add_rounded_rect, ps_path_add_sub_path
void ps_path_add_line ( ps_path path,
const ps_point p1,
const ps_point p2 
)

Add a line to the path.

Parameters:
pathPointer to an existing path object.
p1The start point for the line.
p2The end point for the line.
See also:
ps_path_add_arc, ps_path_add_rect, ps_path_add_ellipse, ps_path_add_rounded_rect, ps_path_add_sub_path
void ps_path_add_rect ( ps_path path,
const ps_rect rect 
)

Add a rectangle to the path.

Parameters:
pathPointer to an existing path object.
rectThe rectangle to be added.
See also:
ps_path_add_arc, ps_path_add_line, ps_path_add_ellipse, ps_path_add_rounded_rect, ps_path_add_sub_path
void ps_path_add_rounded_rect ( ps_path path,
const ps_rect rect,
float  ltx,
float  lty,
float  rtx,
float  rty,
float  lbx,
float  lby,
float  rbx,
float  rby 
)

Add a rounded rectangle to the path.

Parameters:
pathPointer to an existing path object.
rectThe rectangle which will be added.
ltxThe left top horizontal radius.
ltyThe left top vertical radius.
rtxThe right top horizontal radius.
rtyThe right top vertical radius.
lbxThe left bottom horizontal radius.
lbyThe left bottom vertical radius.
rbxThe right bottom horizontal radius.
rbyThe right bottom vertical radius.
See also:
ps_path_add_arc, ps_path_add_line, ps_path_add_rect, ps_path_add_ellipse, ps_path_add_sub_path
void ps_path_add_sub_path ( ps_path path,
const ps_path spath 
)

Add an sub path to the path.

Parameters:
pathPointer to an existing path object.
spathThe path will be added.
See also:
ps_path_add_arc, ps_path_add_line, ps_path_add_rect, ps_path_add_rounded_rect, ps_path_add_ellipse
void ps_path_arc_to ( ps_path path,
float  radiusX,
float  radiusY,
float  angle,
ps_bool  large_arc,
ps_bool  clockwise,
const ps_point ep 
)

Add an arc to the path, using radius, angle and end point.

Parameters:
pathPointer to an existing path object.
radiusXThe horizontal radius of arc.
radiusYThe vertical radius of arc.
angleThe angle of arc, in radians.
large_arcTrue is large arc, False is small arc.
clockwiseTrue is clockwise, False is counter clockwise.
epThe end point of the arc.
See also:
ps_path_move_to, ps_path_bezier_to, ps_path_quad_to ps_path_tangent_arc_to, ps_path_line_to
void ps_path_bezier_to ( ps_path path,
const ps_point fcp,
const ps_point scp,
const ps_point ep 
)

Add a cubic bezier spline to the path from current point to end point.

Parameters:
pathPointer to an existing path object.
fcpThe first control point of the curve.
scpThe second control point of the curve.
epThe end point of the curve.
See also:
ps_path_move_to, ps_path_arc_to, ps_path_quad_to ps_path_tangent_arc_to, ps_path_line_to
ps_bool ps_path_bounding_rect ( const ps_path path,
ps_rect rect 
)

Get the bounding rectangle of the path.

Parameters:
pathPointer to an existing path object.
rectPointer to a buffer to receiving the rect.
Returns:
True if is success, otherwise False.
Note:
To get extended error information, call ps_last_status.
See also:
ps_path_get_vertex_count, ps_path_get_vertex, ps_path_contains, ps_path_stroke_contains
void ps_path_clear ( ps_path path)

Clear the path to empty.

Parameters:
pathPointer to an existing path object.
See also:
ps_path_sub_close, ps_path_get_length, ps_path_is_empty
void ps_path_clipping ( ps_path result,
ps_path_operation  op,
const ps_path a,
const ps_path b 
)

Clipping two path with the operation and get the result path.

Parameters:
resultPointer to an existing path object for result.
opThe specified operation for clipping.
aThe source path for clipping.
bThe path which will be clipping.
See also:
ps_path_get_vertex, ps_path_get_vertex_count
ps_bool ps_path_contains ( const ps_path path,
const ps_point point,
ps_fill_rule  rule 
)

Check whether a point is contained in the path by fill method.

Parameters:
pathPointer to an existing path object.
pointThe point to be checked.
ruleThe filling rule for the path.
Returns:
True if the point is contained, otherwise False.
See also:
ps_path_get_vertex_count, ps_path_get_vertex, ps_path_bounding_rect, ps_path_stroke_contains
ps_path * ps_path_create ( void  )

Create a new empty path object.

Returns:
If the function succeeds, the return value is the pointer to a new path object. If the function fails, the return value is NULL.
Note:
To get extended error information, call ps_last_status.
See also:
ps_path_create_copy, ps_path_ref, ps_path_unref
ps_path * ps_path_create_copy ( const ps_path path)

Create a copy from an existing path object.

Parameters:
pathPointer to an existing path object.
Returns:
If the function succeeds, the return value is the pointer to a new path object. If the function fails, the return value is NULL.
Note:
To get extended error information, call ps_last_status.
See also:
ps_path_create, ps_path_ref, ps_path_unref
float ps_path_get_length ( const ps_path path)

Return The length of the path.

Parameters:
pathPointer to an existing path object.
Returns:
If the function succeeds, the return value is the length of the path object. If the function fails, the return value is 0.
Note:
To get extended error information, call ps_last_status.
See also:
ps_path_sub_close, ps_path_clear, ps_path_is_empty
ps_path_cmd ps_path_get_vertex ( const ps_path path,
unsigned int  index,
ps_point point 
)

Get a vertex from the path by index, and return the vertex command.

Parameters:
pathPointer to an existing path object.
indexThe index of the vertex.
pointPointer to a structure to receiving the vertex.
Returns:
If the function succeeds, the return value is the command of the vertex. If the function fails, the return value is PATH_CMD_STOP.
Note:
To get extended error information, call ps_last_status.
See also:
ps_path_get_vertex_count, ps_path_bounding_rect, ps_path_contains, ps_path_stroke_contains
unsigned int ps_path_get_vertex_count ( const ps_path path)

Return the count of vertices in the path.

Parameters:
pathPointer to an existing path object.
Returns:
If the function succeeds, the return value is the vertices count in the path object. If the function fails, the return value is 0.
Note:
To get extended error information, call ps_last_status.
See also:
ps_path_get_vertex, ps_path_bounding_rect, ps_path_contains, ps_path_stroke_contains
ps_bool ps_path_is_empty ( const ps_path path)

Checks whether the path is empty.

Parameters:
pathPointer to an existing path object.
See also:
ps_path_sub_close, ps_path_get_length, ps_path_clear
void ps_path_line_to ( ps_path path,
const ps_point point 
)

Add a line to the path from the current point to given point.

Parameters:
pathPointer to an existing path object.
pointThe point which will be set.
See also:
ps_path_move_to, ps_path_bezier_to, ps_path_quad_to ps_path_arc_to, ps_path_tangent_arc_to
void ps_path_move_to ( ps_path path,
const ps_point point 
)

Begin a new sub path, and set the current point in the path.

Parameters:
pathPointer to an existing path object.
pointThe point which will be set.
See also:
ps_path_line_to, ps_path_bezier_to, ps_path_quad_to ps_path_arc_to, ps_path_tangent_arc_to
void ps_path_quad_to ( ps_path path,
const ps_point cp,
const ps_point ep 
)

Add a quadratic bezier spline to the path from current point to end point.

Parameters:
pathPointer to an existing path object.
cpThe control point of the curve.
epThe end point of the curve.
See also:
ps_path_move_to, ps_path_arc_to, ps_path_bezier_to ps_path_tangent_arc_to, ps_path_line_to
ps_path * ps_path_ref ( ps_path path)

Increases the reference count of the path by 1.

Parameters:
pathPointer to an existing path object.
Returns:
If the function succeeds, the return value is the pointer to the path object. If the function fails, the return value is NULL.
Note:
To get extended error information, call ps_last_status.
See also:
ps_path_create, ps_path_create_copy, ps_path_unref
ps_bool ps_path_stroke_contains ( const ps_path path,
const ps_point point,
float  width 
)

Check whether a point is contained in the path by stroke method.

Parameters:
pathPointer to an existing path object.
pointThe point to be checked.
widthThe line width to use, in pixels, must be greater than 0.
Returns:
True if the point is contained, otherwise False.
See also:
ps_path_get_vertex_count, ps_path_get_vertex, ps_path_bounding_rect, ps_path_contains
void ps_path_sub_close ( ps_path path)

Close the sub path, and begin a new one.

Parameters:
pathPointer to an existing path object.
See also:
ps_path_get_length, ps_path_clear, ps_path_is_empty
void ps_path_tangent_arc_to ( ps_path path,
float  radius,
const ps_point tp,
const ps_point ep 
)

Add an arc to the path which tangent at two line.

Parameters:
pathPointer to an existing path object.
radiusThe radius of the arc.
tpThe point which the first tangent line from current point to.
epThe point which the second tangent line from tp to.
See also:
ps_path_move_to, ps_path_bezier_to, ps_path_quad_to ps_path_arc_to, ps_path_line_to
void ps_path_unref ( ps_path path)

Decrements the reference count for the path object. If the reference count on the path falls to 0, the path is freed.

Parameters:
pathPointer to an existing path object.
See also:
ps_path_create, ps_path_create_copy, ps_path_ref