2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _TVG_SW_COMMON_H_
18 #define _TVG_SW_COMMON_H_
20 #include "tvgCommon.h"
24 constexpr auto SW_CURVE_TAG_ON = 1;
25 constexpr auto SW_CURVE_TAG_CUBIC = 2;
26 constexpr auto SW_OUTLINE_FILL_WINDING = 0;
27 constexpr auto SW_OUTLINE_FILL_EVEN_ODD = 1;
29 using SwCoord = signed long;
35 SwPoint operator+(const SwPoint& rhs) const {
36 return {x + rhs.x, y + rhs.y};
39 SwPoint operator-(const SwPoint& rhs) const {
40 return {x - rhs.x, y - rhs.y};
43 bool operator==(const SwPoint& rhs ) const {
44 return (x == rhs.x && y == rhs.y);
47 bool operator!=(const SwPoint& rhs) const {
48 return (x != rhs.x || y != rhs.y);
54 size_t* cntrs; //the contour end points
55 size_t cntrsCnt; //number of contours in glyph
56 size_t reservedCntrsCnt;
57 SwPoint* pts; //the outline's points
58 size_t ptsCnt; //number of points in the glyph
59 size_t reservedPtsCnt;
60 char* tags; //the points flags
61 uint8_t fillMode; //outline fill mode
90 void shapeReset(SwShape& sdata);
91 bool shapeGenOutline(const ShapeNode& shape, SwShape& sdata);
92 void shapeDelOutline(const ShapeNode& shape, SwShape& sdata);
93 bool shapeGenRle(const ShapeNode& shape, SwShape& sdata);
94 bool shapeTransformOutline(const ShapeNode& shape, SwShape& sdata);
96 SwRleData* rleRender(const SwShape& sdata);
98 bool rasterShape(Surface& surface, SwShape& sdata, size_t color);
100 #endif /* _TVG_SW_COMMON_H_ */