1 /**************************************************************************
3 * Copyright 2009 VMware, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 **************************************************************************/
30 #include "VG/openvg.h"
42 struct path_for_each_data
{
44 /* all coords are absolute, even if segment is relative */
45 const VGfloat
*coords
;
46 VGfloat sx
, sy
, ox
, oy
, px
, py
;
50 typedef VGboolean (*path_for_each_cb
)(struct path
*p
,
51 struct path_for_each_data
*data
);
54 struct path
*path_create(VGPathDatatype dt
, VGfloat scale
, VGfloat bias
,
55 VGint segmentCapacityHint
,
56 VGint coordCapacityHint
,
57 VGbitfield capabilities
);
58 void path_destroy(struct path
*p
);
60 VGbitfield
path_capabilities(struct path
*p
);
61 void path_set_capabilities(struct path
*p
, VGbitfield bf
);
63 void path_append_data(struct path
*p
,
65 const VGubyte
* pathSegments
,
66 const void * pathData
);
68 void path_append_path(struct path
*dst
,
71 VGint
path_num_segments(struct path
*p
);
73 void path_bounding_rect(struct path
*p
, float *x
, float *y
,
75 float path_length(struct path
*p
, int start_segment
, int num_segments
);
77 void path_set_fill_rule(enum fill_rule fill
);
78 enum fill_rule
path_fill_rule(enum fill_rule fill
);
80 VGboolean
path_is_empty(struct path
*p
);
82 VGbyte
path_datatype_size(struct path
*p
);
84 VGPathDatatype
path_datatype(struct path
*p
);
85 VGfloat
path_scale(struct path
*p
);
86 VGfloat
path_bias(struct path
*p
);
87 VGint
path_num_coords(struct path
*p
);
89 void path_modify_coords(struct path
*p
,
92 const void * pathData
);
94 struct path
*path_create_stroke(struct path
*p
,
97 void path_for_each_segment(struct path
*path
,
101 void path_transform(struct path
*dst
, struct path
*src
);
102 VGboolean
path_interpolate(struct path
*dst
,
103 struct path
*start
, struct path
*end
,
106 void path_clear(struct path
*p
, VGbitfield capabilities
);
107 void path_render(struct path
*p
, VGbitfield paintModes
);
108 void path_fill(struct path
*p
, struct matrix
*mat
);
109 void path_stroke(struct path
*p
);
111 void path_move_to(struct path
*p
, float x
, float y
);
112 void path_line_to(struct path
*p
, float x
, float y
);
113 void path_cubic_to(struct path
*p
, float px1
, float py1
,
114 float px2
, float py2
,
117 void path_point(struct path
*p
, VGint startSegment
, VGint numSegments
,
118 VGfloat distance
, VGfloat
*point
, VGfloat
*normal
);
122 void vg_float_to_datatype(VGPathDatatype datatype
,
123 VGubyte
*common_data
,