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_TYPE_POINT = 0;
25 constexpr auto SW_CURVE_TYPE_CUBIC = 1;
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);
59 size_t* cntrs; //the contour end points
60 size_t cntrsCnt; //number of contours in glyph
61 size_t reservedCntrsCnt;
62 SwPoint* pts; //the outline's points
63 size_t ptsCnt; //number of points in the glyph
64 size_t reservedPtsCnt;
65 uint8_t* types; //curve type
66 uint8_t fillMode; //outline fill mode
95 void shapeReset(SwShape& sdata);
96 bool shapeGenOutline(const Shape& shape, SwShape& sdata);
97 void shapeDelOutline(SwShape& sdata);
98 bool shapeGenRle(const Shape& shape, SwShape& sdata, const SwSize& clip);
99 void shapeTransformOutline(const Shape& shape, SwShape& sdata, const RenderTransform& transform);
100 SwRleData* rleRender(const SwShape& sdata, const SwSize& clip);
102 bool rasterShape(Surface& surface, SwShape& sdata, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
104 #endif /* _TVG_SW_COMMON_H_ */