2 * Copyright (c) 2007 Ivan Leben
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library in the file COPYING;
16 * if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "shVectors.h"
27 /* Helper structures for subdivision */
58 /* Vertex flags for contour definition */
59 #define SH_VERTEX_FLAG_CLOSE (1 << 0)
60 #define SH_VERTEX_FLAG_SEGEND (1 << 1)
61 #define SH_SEGMENT_TYPE_COUNT 13
64 #define _ITEM_T SHVertex
65 #define _ARRAY_T SHVertexArray
66 #define _FUNC_T shVertexArray
67 #define _ARRAY_DECLARE
68 #include "shArrayBase.h"
81 VGPathDatatype datatype;
90 SHVertexArray vertices;
93 /* Additional stroke geometry (dash vertices if
94 path dashed or triangle vertices if width > 1 */
95 SHVector2Array stroke;
98 VGboolean cacheDataValid;
100 VGboolean cacheTransformInit;
101 SHMatrix3x3 cacheTransform;
103 VGboolean cacheStrokeInit;
104 VGboolean cacheStrokeTessValid;
105 SHfloat cacheStrokeLineWidth;
106 VGCapStyle cacheStrokeCapStyle;
107 VGJoinStyle cacheStrokeJoinStyle;
108 SHfloat cacheStrokeMiterLimit;
109 SHfloat cacheStrokeDashPhase;
110 VGboolean cacheStrokeDashPhaseReset;
114 void SHPath_ctor(SHPath *p);
115 void SHPath_dtor(SHPath *p);
118 /* Processing normalization flags */
119 #define SH_PROCESS_SIMPLIFY_LINES (1 << 0)
120 #define SH_PROCESS_SIMPLIFY_CURVES (1 << 1)
121 #define SH_PROCESS_CENTRALIZE_ARCS (1 << 2)
122 #define SH_PROCESS_REPAIR_ENDS (1 << 3)
124 /* Segment callback function type */
125 typedef void (*SegmentFunc) (SHPath *p, VGPathSegment segment,
126 VGPathCommand originalCommand,
127 SHfloat *data, void *userData);
129 /* Processes raw path data into normalized segments */
130 void shProcessPathData(SHPath *p, int flags,
131 SegmentFunc callback,
135 /* Pointer-to-path array */
136 #define _ITEM_T SHPath*
137 #define _ARRAY_T SHPathArray
138 #define _FUNC_T shPathArray
139 #define _ARRAY_DECLARE
140 #include "shArrayBase.h"
142 #endif /* __SHPATH_H */