up-to-date submodule(rive-cpp)
[platform/core/uifw/rive-tizen.git] / submodule / include / generated / shapes / paint / linear_gradient_base.hpp
1 #ifndef _RIVE_LINEAR_GRADIENT_BASE_HPP_
2 #define _RIVE_LINEAR_GRADIENT_BASE_HPP_
3 #include "container_component.hpp"
4 #include "core/field_types/core_double_type.hpp"
5 namespace rive
6 {
7         class LinearGradientBase : public ContainerComponent
8         {
9         protected:
10                 typedef ContainerComponent Super;
11
12         public:
13                 static const uint16_t typeKey = 22;
14
15                 /// Helper to quickly determine if a core object extends another without
16                 /// RTTI at runtime.
17                 bool isTypeOf(uint16_t typeKey) const override
18                 {
19                         switch (typeKey)
20                         {
21                                 case LinearGradientBase::typeKey:
22                                 case ContainerComponentBase::typeKey:
23                                 case ComponentBase::typeKey:
24                                         return true;
25                                 default:
26                                         return false;
27                         }
28                 }
29
30                 uint16_t coreType() const override { return typeKey; }
31
32                 static const uint16_t startXPropertyKey = 42;
33                 static const uint16_t startYPropertyKey = 33;
34                 static const uint16_t endXPropertyKey = 34;
35                 static const uint16_t endYPropertyKey = 35;
36                 static const uint16_t opacityPropertyKey = 46;
37
38         private:
39                 float m_StartX = 0.0f;
40                 float m_StartY = 0.0f;
41                 float m_EndX = 0.0f;
42                 float m_EndY = 0.0f;
43                 float m_Opacity = 1.0f;
44         public:
45                 inline float startX() const { return m_StartX; }
46                 void startX(float value)
47                 {
48                         if (m_StartX == value)
49                         {
50                                 return;
51                         }
52                         m_StartX = value;
53                         startXChanged();
54                 }
55
56                 inline float startY() const { return m_StartY; }
57                 void startY(float value)
58                 {
59                         if (m_StartY == value)
60                         {
61                                 return;
62                         }
63                         m_StartY = value;
64                         startYChanged();
65                 }
66
67                 inline float endX() const { return m_EndX; }
68                 void endX(float value)
69                 {
70                         if (m_EndX == value)
71                         {
72                                 return;
73                         }
74                         m_EndX = value;
75                         endXChanged();
76                 }
77
78                 inline float endY() const { return m_EndY; }
79                 void endY(float value)
80                 {
81                         if (m_EndY == value)
82                         {
83                                 return;
84                         }
85                         m_EndY = value;
86                         endYChanged();
87                 }
88
89                 inline float opacity() const { return m_Opacity; }
90                 void opacity(float value)
91                 {
92                         if (m_Opacity == value)
93                         {
94                                 return;
95                         }
96                         m_Opacity = value;
97                         opacityChanged();
98                 }
99
100                 Core* clone() const override;
101                 void copy(const LinearGradientBase& object)
102                 {
103                         m_StartX = object.m_StartX;
104                         m_StartY = object.m_StartY;
105                         m_EndX = object.m_EndX;
106                         m_EndY = object.m_EndY;
107                         m_Opacity = object.m_Opacity;
108                         ContainerComponent::copy(object);
109                 }
110
111                 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
112                 {
113                         switch (propertyKey)
114                         {
115                                 case startXPropertyKey:
116                                         m_StartX = CoreDoubleType::deserialize(reader);
117                                         return true;
118                                 case startYPropertyKey:
119                                         m_StartY = CoreDoubleType::deserialize(reader);
120                                         return true;
121                                 case endXPropertyKey:
122                                         m_EndX = CoreDoubleType::deserialize(reader);
123                                         return true;
124                                 case endYPropertyKey:
125                                         m_EndY = CoreDoubleType::deserialize(reader);
126                                         return true;
127                                 case opacityPropertyKey:
128                                         m_Opacity = CoreDoubleType::deserialize(reader);
129                                         return true;
130                         }
131                         return ContainerComponent::deserialize(propertyKey, reader);
132                 }
133
134         protected:
135                 virtual void startXChanged() {}
136                 virtual void startYChanged() {}
137                 virtual void endXChanged() {}
138                 virtual void endYChanged() {}
139                 virtual void opacityChanged() {}
140         };
141 } // namespace rive
142
143 #endif