Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / include / rive / generated / shapes / paint / stroke_base.hpp
1 #ifndef _RIVE_STROKE_BASE_HPP_
2 #define _RIVE_STROKE_BASE_HPP_
3 #include "rive/core/field_types/core_bool_type.hpp"
4 #include "rive/core/field_types/core_double_type.hpp"
5 #include "rive/core/field_types/core_uint_type.hpp"
6 #include "rive/shapes/paint/shape_paint.hpp"
7 namespace rive {
8     class StrokeBase : public ShapePaint {
9     protected:
10         typedef ShapePaint Super;
11
12     public:
13         static const uint16_t typeKey = 24;
14
15         /// Helper to quickly determine if a core object extends another without RTTI
16         /// at runtime.
17         bool isTypeOf(uint16_t typeKey) const override {
18             switch (typeKey) {
19                 case StrokeBase::typeKey:
20                 case ShapePaintBase::typeKey:
21                 case ContainerComponentBase::typeKey:
22                 case ComponentBase::typeKey:
23                     return true;
24                 default:
25                     return false;
26             }
27         }
28
29         uint16_t coreType() const override { return typeKey; }
30
31         static const uint16_t thicknessPropertyKey = 47;
32         static const uint16_t capPropertyKey = 48;
33         static const uint16_t joinPropertyKey = 49;
34         static const uint16_t transformAffectsStrokePropertyKey = 50;
35
36     private:
37         float m_Thickness = 1.0f;
38         uint32_t m_Cap = 0;
39         uint32_t m_Join = 0;
40         bool m_TransformAffectsStroke = true;
41
42     public:
43         inline float thickness() const { return m_Thickness; }
44         void thickness(float value) {
45             if (m_Thickness == value) {
46                 return;
47             }
48             m_Thickness = value;
49             thicknessChanged();
50         }
51
52         inline uint32_t cap() const { return m_Cap; }
53         void cap(uint32_t value) {
54             if (m_Cap == value) {
55                 return;
56             }
57             m_Cap = value;
58             capChanged();
59         }
60
61         inline uint32_t join() const { return m_Join; }
62         void join(uint32_t value) {
63             if (m_Join == value) {
64                 return;
65             }
66             m_Join = value;
67             joinChanged();
68         }
69
70         inline bool transformAffectsStroke() const { return m_TransformAffectsStroke; }
71         void transformAffectsStroke(bool value) {
72             if (m_TransformAffectsStroke == value) {
73                 return;
74             }
75             m_TransformAffectsStroke = value;
76             transformAffectsStrokeChanged();
77         }
78
79         Core* clone() const override;
80         void copy(const StrokeBase& object) {
81             m_Thickness = object.m_Thickness;
82             m_Cap = object.m_Cap;
83             m_Join = object.m_Join;
84             m_TransformAffectsStroke = object.m_TransformAffectsStroke;
85             ShapePaint::copy(object);
86         }
87
88         bool deserialize(uint16_t propertyKey, BinaryReader& reader) override {
89             switch (propertyKey) {
90                 case thicknessPropertyKey:
91                     m_Thickness = CoreDoubleType::deserialize(reader);
92                     return true;
93                 case capPropertyKey:
94                     m_Cap = CoreUintType::deserialize(reader);
95                     return true;
96                 case joinPropertyKey:
97                     m_Join = CoreUintType::deserialize(reader);
98                     return true;
99                 case transformAffectsStrokePropertyKey:
100                     m_TransformAffectsStroke = CoreBoolType::deserialize(reader);
101                     return true;
102             }
103             return ShapePaint::deserialize(propertyKey, reader);
104         }
105
106     protected:
107         virtual void thicknessChanged() {}
108         virtual void capChanged() {}
109         virtual void joinChanged() {}
110         virtual void transformAffectsStrokeChanged() {}
111     };
112 } // namespace rive
113
114 #endif