2 * Copyright (c) 2020-2021 Samsung Electronics Co., Ltd. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 #ifndef _TVG_SVG_LOADER_COMMON_H_
23 #define _TVG_SVG_LOADER_COMMON_H_
25 #include "tvgCommon.h"
28 enum class SvgNodeType
33 //Switch, //Not support
51 //Custome_command, //Not support
55 enum class SvgLengthType
67 enum class SvgFillFlags
76 enum class SvgStrokeFlags
88 enum class SvgGradientType
94 enum class SvgStyleType
108 enum class SvgFillRule
114 //Length type to recalculate %, pt, pc, mm, cm etc
115 enum class SvgParserLengthType
119 //In case of, for example, radius of radial gradient
124 struct SvgStyleGradient;
145 Array<SvgStyleGradient*> gradients;
152 struct SvgEllipseNode
192 struct SvgPolygonNode
198 struct SvgLinearGradient
206 struct SvgRadialGradient
215 struct SvgGradientStop
226 CompositeMethod method; //TODO: Currently support either one method
233 SvgStyleGradient* gradient;
247 struct SvgStyleGradient
249 SvgGradientType type;
253 SvgRadialGradient* radial;
254 SvgLinearGradient* linear;
256 Array<Fill::ColorStop *> stops;
266 SvgFillRule fillRule;
269 struct SvgStyleStroke
271 SvgStrokeFlags flags;
283 struct SvgStyleProperty
286 SvgStyleStroke stroke;
298 Array<SvgNode*> child;
300 SvgStyleProperty *style;
307 SvgCircleNode circle;
308 SvgEllipseNode ellipse;
309 SvgPolygonNode polygon;
310 SvgPolygonNode polyline;
321 SvgStyleGradient* styleGrad;
322 Fill::ColorStop* gradStop;
337 Array<SvgNode *> stack = {nullptr, 0, 0};
338 SvgNode* doc = nullptr;
339 SvgNode* def = nullptr;
340 Array<SvgStyleGradient*> gradients;
341 SvgStyleGradient* latestGradient = nullptr; //For stops
342 SvgParser* svgParse = nullptr;
348 * https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strtof-strtod-l-wcstod-wcstod-l?view=vs-2017
350 * src should be one of the following form :
352 * [whitespace] [sign] {digits [radix digits] | radix digits} [{e | E} [sign] digits]
353 * [whitespace] [sign] {INF | INFINITY}
354 * [whitespace] [sign] NAN [sequence]
356 * No hexadecimal form supported
357 * no sequence supported after NAN
359 float customStrtof(const char *nptr, char **endptr);