glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / state_trackers / vega / path.h
blobe34538b73681de2835e83ae7ef784dd8935a7653
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
15 * of the Software.
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 **************************************************************************/
27 #ifndef _PATH_H
28 #define _PATH_H
30 #include "VG/openvg.h"
32 struct path;
33 struct polygon;
34 struct matrix;
36 enum fill_rule {
37 ODD_EVEN_FILL,
38 WINDING_FILL
42 struct path_for_each_data {
43 VGubyte segment;
44 /* all coords are absolute, even if segment is relative */
45 const VGfloat *coords;
46 VGfloat sx, sy, ox, oy, px, py;
47 void *user_data;
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,
64 VGint numSegments,
65 const VGubyte * pathSegments,
66 const void * pathData);
68 void path_append_path(struct path *dst,
69 struct path *src);
71 VGint path_num_segments(struct path *p);
73 void path_bounding_rect(struct path *p, float *x, float *y,
74 float *w, float *h);
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,
90 VGint startIndex,
91 VGint numSegments,
92 const void * pathData);
94 struct path *path_create_stroke(struct path *p,
95 struct matrix *m);
97 void path_for_each_segment(struct path *path,
98 path_for_each_cb cb,
99 void *user_data);
101 void path_transform(struct path *dst, struct path *src);
102 VGboolean path_interpolate(struct path *dst,
103 struct path *start, struct path *end,
104 VGfloat amount);
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,
115 float x, float y);
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,
124 const VGfloat *data,
125 VGint num_coords);
126 #endif